// 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.AzureDevOpsConnectorStatsListResponseInner;
import com.azure.resourcemanager.securitydevops.models.AzureDevOpsConnectorStats;
import com.azure.resourcemanager.securitydevops.models.AzureDevOpsConnectorStatsProperties;
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 AzureDevOpsConnectorStatsListResponseInnerTests {
    @Test
    public void testDeserialize() {
        AzureDevOpsConnectorStatsListResponseInner model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"provisioningState\":\"Failed\",\"orgsCount\":2124589833110260151,\"projectsCount\":3582129751960614945,\"reposCount\":5348039389469426548},\"id\":\"mmnkzsmodmgl\",\"name\":\"ugpbkw\",\"type\":\"mutduqktaps\"}],\"nextLink\":\"gcue\"}")
                .toObject(AzureDevOpsConnectorStatsListResponseInner.class);
        Assertions.assertEquals(ProvisioningState.FAILED, model.value().get(0).properties().provisioningState());
        Assertions.assertEquals(2124589833110260151L, model.value().get(0).properties().orgsCount());
        Assertions.assertEquals(3582129751960614945L, model.value().get(0).properties().projectsCount());
        Assertions.assertEquals(5348039389469426548L, model.value().get(0).properties().reposCount());
        Assertions.assertEquals("gcue", model.nextLink());
    }

    @Test
    public void testSerialize() {
        AzureDevOpsConnectorStatsListResponseInner model =
            new AzureDevOpsConnectorStatsListResponseInner()
                .withValue(
                    Arrays
                        .asList(
                            new AzureDevOpsConnectorStats()
                                .withProperties(
                                    new AzureDevOpsConnectorStatsProperties()
                                        .withProvisioningState(ProvisioningState.FAILED)
                                        .withOrgsCount(2124589833110260151L)
                                        .withProjectsCount(3582129751960614945L)
                                        .withReposCount(5348039389469426548L))))
                .withNextLink("gcue");
        model = BinaryData.fromObject(model).toObject(AzureDevOpsConnectorStatsListResponseInner.class);
        Assertions.assertEquals(ProvisioningState.FAILED, model.value().get(0).properties().provisioningState());
        Assertions.assertEquals(2124589833110260151L, model.value().get(0).properties().orgsCount());
        Assertions.assertEquals(3582129751960614945L, model.value().get(0).properties().projectsCount());
        Assertions.assertEquals(5348039389469426548L, model.value().get(0).properties().reposCount());
        Assertions.assertEquals("gcue", model.nextLink());
    }
}
