// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.datadog.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.datadog.fluent.models.DatadogSingleSignOnResourceInner;
import com.azure.resourcemanager.datadog.models.DatadogSingleSignOnProperties;
import com.azure.resourcemanager.datadog.models.DatadogSingleSignOnResourceListResponse;
import com.azure.resourcemanager.datadog.models.SingleSignOnStates;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class DatadogSingleSignOnResourceListResponseTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        DatadogSingleSignOnResourceListResponse model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"provisioningState\":\"Succeeded\",\"singleSignOnState\":\"Disable\",\"enterpriseAppId\":\"zpwv\",\"singleSignOnUrl\":\"dqgbiqylihkaetc\"},\"id\":\"vfcivfsnkymuc\",\"name\":\"qhjfbebr\",\"type\":\"cxerf\"},{\"properties\":{\"provisioningState\":\"Updating\",\"singleSignOnState\":\"Disable\",\"enterpriseAppId\":\"fvjrbirphxepcy\",\"singleSignOnUrl\":\"hfnljkyq\"},\"id\":\"vuujq\",\"name\":\"idokgjlj\",\"type\":\"oxgvclt\"},{\"properties\":{\"provisioningState\":\"Deleted\",\"singleSignOnState\":\"Disable\",\"enterpriseAppId\":\"kjeszz\",\"singleSignOnUrl\":\"ijhtxf\"},\"id\":\"xbf\",\"name\":\"mxnehmp\",\"type\":\"ec\"}],\"nextLink\":\"odebfqkkrbmpu\"}")
                .toObject(DatadogSingleSignOnResourceListResponse.class);
        Assertions.assertEquals(SingleSignOnStates.DISABLE, model.value().get(0).properties().singleSignOnState());
        Assertions.assertEquals("zpwv", model.value().get(0).properties().enterpriseAppId());
        Assertions.assertEquals("odebfqkkrbmpu", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        DatadogSingleSignOnResourceListResponse model =
            new DatadogSingleSignOnResourceListResponse()
                .withValue(
                    Arrays
                        .asList(
                            new DatadogSingleSignOnResourceInner()
                                .withProperties(
                                    new DatadogSingleSignOnProperties()
                                        .withSingleSignOnState(SingleSignOnStates.DISABLE)
                                        .withEnterpriseAppId("zpwv")),
                            new DatadogSingleSignOnResourceInner()
                                .withProperties(
                                    new DatadogSingleSignOnProperties()
                                        .withSingleSignOnState(SingleSignOnStates.DISABLE)
                                        .withEnterpriseAppId("fvjrbirphxepcy")),
                            new DatadogSingleSignOnResourceInner()
                                .withProperties(
                                    new DatadogSingleSignOnProperties()
                                        .withSingleSignOnState(SingleSignOnStates.DISABLE)
                                        .withEnterpriseAppId("kjeszz"))))
                .withNextLink("odebfqkkrbmpu");
        model = BinaryData.fromObject(model).toObject(DatadogSingleSignOnResourceListResponse.class);
        Assertions.assertEquals(SingleSignOnStates.DISABLE, model.value().get(0).properties().singleSignOnState());
        Assertions.assertEquals("zpwv", model.value().get(0).properties().enterpriseAppId());
        Assertions.assertEquals("odebfqkkrbmpu", model.nextLink());
    }
}
