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

package com.azure.resourcemanager.managednetworkfabric.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.managednetworkfabric.fluent.models.InternalNetworkInner;
import com.azure.resourcemanager.managednetworkfabric.models.InternalNetworksList;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class InternalNetworksListTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        InternalNetworksList model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"disabledOnResources\":[],\"administrativeState\":\"Disabled\",\"bgpDisabledOnResources\":[],\"bfdDisabledOnResources\":[],\"bfdForStaticRoutesDisabledOnResources\":[],\"provisioningState\":\"Failed\",\"vlanId\":708392093,\"mtu\":1032331086,\"connectedIPv4Subnets\":[],\"connectedIPv6Subnets\":[],\"importRoutePolicyId\":\"xzfe\",\"exportRoutePolicyId\":\"tpp\",\"annotation\":\"o\"},\"id\":\"or\",\"name\":\"altol\",\"type\":\"ncwsob\"},{\"properties\":{\"disabledOnResources\":[],\"administrativeState\":\"Disabled\",\"bgpDisabledOnResources\":[],\"bfdDisabledOnResources\":[],\"bfdForStaticRoutesDisabledOnResources\":[],\"provisioningState\":\"Deleting\",\"vlanId\":297328779,\"mtu\":425472203,\"connectedIPv4Subnets\":[],\"connectedIPv6Subnets\":[],\"importRoutePolicyId\":\"fuvglsbjjca\",\"exportRoutePolicyId\":\"xbvtvudu\",\"annotation\":\"cormr\"},\"id\":\"qtvcofudflvkgj\",\"name\":\"bgdknnqv\",\"type\":\"aznqntoru\"},{\"properties\":{\"disabledOnResources\":[],\"administrativeState\":\"Enabled\",\"bgpDisabledOnResources\":[],\"bfdDisabledOnResources\":[],\"bfdForStaticRoutesDisabledOnResources\":[],\"provisioningState\":\"Canceled\",\"vlanId\":103703544,\"mtu\":830439521,\"connectedIPv4Subnets\":[],\"connectedIPv6Subnets\":[],\"importRoutePolicyId\":\"etaebu\",\"exportRoutePolicyId\":\"vdmovsmzlxwabm\",\"annotation\":\"efkifr\"},\"id\":\"puqujmqlgkfbtn\",\"name\":\"oaongbjc\",\"type\":\"tujitcjedft\"},{\"properties\":{\"disabledOnResources\":[],\"administrativeState\":\"Disabled\",\"bgpDisabledOnResources\":[],\"bfdDisabledOnResources\":[],\"bfdForStaticRoutesDisabledOnResources\":[],\"provisioningState\":\"Failed\",\"vlanId\":1994175863,\"mtu\":2090841381,\"connectedIPv4Subnets\":[],\"connectedIPv6Subnets\":[],\"importRoutePolicyId\":\"uicybxarzgszuf\",\"exportRoutePolicyId\":\"ciqopidoa\",\"annotation\":\"iodhkhazxkhnz\"},\"id\":\"nlwntoe\",\"name\":\"okdwb\",\"type\":\"hksz\"}],\"nextLink\":\"mrv\"}")
                .toObject(InternalNetworksList.class);
        Assertions.assertEquals(708392093, model.value().get(0).vlanId());
        Assertions.assertEquals(1032331086, model.value().get(0).mtu());
        Assertions.assertEquals("xzfe", model.value().get(0).importRoutePolicyId());
        Assertions.assertEquals("tpp", model.value().get(0).exportRoutePolicyId());
        Assertions.assertEquals("o", model.value().get(0).annotation());
        Assertions.assertEquals("mrv", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        InternalNetworksList model =
            new InternalNetworksList()
                .withValue(
                    Arrays
                        .asList(
                            new InternalNetworkInner()
                                .withVlanId(708392093)
                                .withMtu(1032331086)
                                .withConnectedIPv4Subnets(Arrays.asList())
                                .withConnectedIPv6Subnets(Arrays.asList())
                                .withImportRoutePolicyId("xzfe")
                                .withExportRoutePolicyId("tpp")
                                .withAnnotation("o"),
                            new InternalNetworkInner()
                                .withVlanId(297328779)
                                .withMtu(425472203)
                                .withConnectedIPv4Subnets(Arrays.asList())
                                .withConnectedIPv6Subnets(Arrays.asList())
                                .withImportRoutePolicyId("fuvglsbjjca")
                                .withExportRoutePolicyId("xbvtvudu")
                                .withAnnotation("cormr"),
                            new InternalNetworkInner()
                                .withVlanId(103703544)
                                .withMtu(830439521)
                                .withConnectedIPv4Subnets(Arrays.asList())
                                .withConnectedIPv6Subnets(Arrays.asList())
                                .withImportRoutePolicyId("etaebu")
                                .withExportRoutePolicyId("vdmovsmzlxwabm")
                                .withAnnotation("efkifr"),
                            new InternalNetworkInner()
                                .withVlanId(1994175863)
                                .withMtu(2090841381)
                                .withConnectedIPv4Subnets(Arrays.asList())
                                .withConnectedIPv6Subnets(Arrays.asList())
                                .withImportRoutePolicyId("uicybxarzgszuf")
                                .withExportRoutePolicyId("ciqopidoa")
                                .withAnnotation("iodhkhazxkhnz")))
                .withNextLink("mrv");
        model = BinaryData.fromObject(model).toObject(InternalNetworksList.class);
        Assertions.assertEquals(708392093, model.value().get(0).vlanId());
        Assertions.assertEquals(1032331086, model.value().get(0).mtu());
        Assertions.assertEquals("xzfe", model.value().get(0).importRoutePolicyId());
        Assertions.assertEquals("tpp", model.value().get(0).exportRoutePolicyId());
        Assertions.assertEquals("o", model.value().get(0).annotation());
        Assertions.assertEquals("mrv", model.nextLink());
    }
}
