// 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.PeeringLocationInner;
import com.azure.resourcemanager.peering.models.Kind;
import com.azure.resourcemanager.peering.models.PeeringLocationListResult;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class PeeringLocationListResultTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        PeeringLocationListResult model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"kind\":\"Exchange\",\"properties\":{\"peeringLocation\":\"qyeg\",\"country\":\"lhbxxhejjzzvdud\",\"azureRegion\":\"dslfhotwmcy\"},\"id\":\"pwlbjnpg\",\"name\":\"cftadeh\",\"type\":\"nltyfsoppusuesnz\"},{\"kind\":\"Direct\",\"properties\":{\"peeringLocation\":\"orxzdmohctbqvud\",\"country\":\"dndnvow\",\"azureRegion\":\"jjugwdkcglhslaz\"},\"id\":\"dyggdtjixhbku\",\"name\":\"fqweykhmene\",\"type\":\"fyexfwhy\"},{\"kind\":\"Direct\",\"properties\":{\"peeringLocation\":\"dcsi\",\"country\":\"nnaamdectehfiqsc\",\"azureRegion\":\"ypvhezrkg\"},\"id\":\"hcjrefovgmk\",\"name\":\"sle\",\"type\":\"yvxyqjp\"},{\"kind\":\"Exchange\",\"properties\":{\"peeringLocation\":\"gjcrcczsqpjhvm\",\"country\":\"jvnysounqe\",\"azureRegion\":\"noae\"},\"id\":\"pfhyhl\",\"name\":\"rpmopjmc\",\"type\":\"atuokthfuiu\"}],\"nextLink\":\"dsfcpkvxodpuoz\"}")
                .toObject(PeeringLocationListResult.class);
        Assertions.assertEquals(Kind.EXCHANGE, model.value().get(0).kind());
        Assertions.assertEquals("qyeg", model.value().get(0).peeringLocation());
        Assertions.assertEquals("lhbxxhejjzzvdud", model.value().get(0).country());
        Assertions.assertEquals("dslfhotwmcy", model.value().get(0).azureRegion());
        Assertions.assertEquals("dsfcpkvxodpuoz", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        PeeringLocationListResult model =
            new PeeringLocationListResult()
                .withValue(
                    Arrays
                        .asList(
                            new PeeringLocationInner()
                                .withKind(Kind.EXCHANGE)
                                .withPeeringLocation("qyeg")
                                .withCountry("lhbxxhejjzzvdud")
                                .withAzureRegion("dslfhotwmcy"),
                            new PeeringLocationInner()
                                .withKind(Kind.DIRECT)
                                .withPeeringLocation("orxzdmohctbqvud")
                                .withCountry("dndnvow")
                                .withAzureRegion("jjugwdkcglhslaz"),
                            new PeeringLocationInner()
                                .withKind(Kind.DIRECT)
                                .withPeeringLocation("dcsi")
                                .withCountry("nnaamdectehfiqsc")
                                .withAzureRegion("ypvhezrkg"),
                            new PeeringLocationInner()
                                .withKind(Kind.EXCHANGE)
                                .withPeeringLocation("gjcrcczsqpjhvm")
                                .withCountry("jvnysounqe")
                                .withAzureRegion("noae")))
                .withNextLink("dsfcpkvxodpuoz");
        model = BinaryData.fromObject(model).toObject(PeeringLocationListResult.class);
        Assertions.assertEquals(Kind.EXCHANGE, model.value().get(0).kind());
        Assertions.assertEquals("qyeg", model.value().get(0).peeringLocation());
        Assertions.assertEquals("lhbxxhejjzzvdud", model.value().get(0).country());
        Assertions.assertEquals("dslfhotwmcy", model.value().get(0).azureRegion());
        Assertions.assertEquals("dsfcpkvxodpuoz", model.nextLink());
    }
}
