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

package com.azure.resourcemanager.securitydevops.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.securitydevops.fluent.models.AzureDevOpsProjectInner;
import com.azure.resourcemanager.securitydevops.models.AutoDiscovery;
import com.azure.resourcemanager.securitydevops.models.AzureDevOpsProjectListResponse;
import com.azure.resourcemanager.securitydevops.models.AzureDevOpsProjectProperties;
import com.azure.resourcemanager.securitydevops.models.ProvisioningState;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class AzureDevOpsProjectListResponseTests {
    @Test
    public void testDeserialize() {
        AzureDevOpsProjectListResponse model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"provisioningState\":\"Canceled\",\"projectId\":\"muouqfp\",\"orgName\":\"zw\",\"autoDiscovery\":\"Disabled\"},\"id\":\"itnwuizgazxufi\",\"name\":\"uckyf\",\"type\":\"hr\"}],\"nextLink\":\"dfvzwdzuhty\"}")
                .toObject(AzureDevOpsProjectListResponse.class);
        Assertions.assertEquals(ProvisioningState.CANCELED, model.value().get(0).properties().provisioningState());
        Assertions.assertEquals("muouqfp", model.value().get(0).properties().projectId());
        Assertions.assertEquals("zw", model.value().get(0).properties().orgName());
        Assertions.assertEquals(AutoDiscovery.DISABLED, model.value().get(0).properties().autoDiscovery());
        Assertions.assertEquals("dfvzwdzuhty", model.nextLink());
    }

    @Test
    public void testSerialize() {
        AzureDevOpsProjectListResponse model =
            new AzureDevOpsProjectListResponse()
                .withValue(
                    Arrays
                        .asList(
                            new AzureDevOpsProjectInner()
                                .withProperties(
                                    new AzureDevOpsProjectProperties()
                                        .withProvisioningState(ProvisioningState.CANCELED)
                                        .withProjectId("muouqfp")
                                        .withOrgName("zw")
                                        .withAutoDiscovery(AutoDiscovery.DISABLED))))
                .withNextLink("dfvzwdzuhty");
        model = BinaryData.fromObject(model).toObject(AzureDevOpsProjectListResponse.class);
        Assertions.assertEquals(ProvisioningState.CANCELED, model.value().get(0).properties().provisioningState());
        Assertions.assertEquals("muouqfp", model.value().get(0).properties().projectId());
        Assertions.assertEquals("zw", model.value().get(0).properties().orgName());
        Assertions.assertEquals(AutoDiscovery.DISABLED, model.value().get(0).properties().autoDiscovery());
        Assertions.assertEquals("dfvzwdzuhty", model.nextLink());
    }
}
