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

package com.azure.resourcemanager.peering.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.peering.fluent.models.PeeringServiceLocationInner;
import com.azure.resourcemanager.peering.models.PeeringServiceLocationListResult;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class PeeringServiceLocationListResultTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        PeeringServiceLocationListResult model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"country\":\"fkuwbcrnwbmehhse\",\"state\":\"jusrtslhspk\",\"azureRegion\":\"emaofmxagkvt\"},\"id\":\"elmqk\",\"name\":\"hahvljuahaq\",\"type\":\"hcdhmdual\"}],\"nextLink\":\"xqpvfadmw\"}")
                .toObject(PeeringServiceLocationListResult.class);
        Assertions.assertEquals("fkuwbcrnwbmehhse", model.value().get(0).country());
        Assertions.assertEquals("jusrtslhspk", model.value().get(0).state());
        Assertions.assertEquals("emaofmxagkvt", model.value().get(0).azureRegion());
        Assertions.assertEquals("xqpvfadmw", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        PeeringServiceLocationListResult model =
            new PeeringServiceLocationListResult()
                .withValue(
                    Arrays
                        .asList(
                            new PeeringServiceLocationInner()
                                .withCountry("fkuwbcrnwbmehhse")
                                .withState("jusrtslhspk")
                                .withAzureRegion("emaofmxagkvt")))
                .withNextLink("xqpvfadmw");
        model = BinaryData.fromObject(model).toObject(PeeringServiceLocationListResult.class);
        Assertions.assertEquals("fkuwbcrnwbmehhse", model.value().get(0).country());
        Assertions.assertEquals("jusrtslhspk", model.value().get(0).state());
        Assertions.assertEquals("emaofmxagkvt", model.value().get(0).azureRegion());
        Assertions.assertEquals("xqpvfadmw", model.nextLink());
    }
}
