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

package com.azure.resourcemanager.avs.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.avs.fluent.models.WorkloadNetworkSegmentInner;
import com.azure.resourcemanager.avs.models.WorkloadNetworkSegmentSubnet;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class WorkloadNetworkSegmentInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        WorkloadNetworkSegmentInner model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"displayName\":\"n\",\"connectedGateway\":\"bpzkafkuwbc\",\"subnet\":{\"dhcpRanges\":[\"mehhseyvjusrtsl\",\"spkdee\"],\"gatewayAddress\":\"ofmxagkvtmelmqkr\"},\"portVif\":[{\"portName\":\"ljuahaquhcdh\"},{\"portName\":\"ualaexqpvfadmw\"},{\"portName\":\"crgvxpvgom\"}],\"status\":\"SUCCESS\",\"provisioningState\":\"Succeeded\",\"revision\":3141876003584230040},\"id\":\"bnbbeldawkz\",\"name\":\"ali\",\"type\":\"urqhaka\"}")
                .toObject(WorkloadNetworkSegmentInner.class);
        Assertions.assertEquals("n", model.displayName());
        Assertions.assertEquals("bpzkafkuwbc", model.connectedGateway());
        Assertions.assertEquals("mehhseyvjusrtsl", model.subnet().dhcpRanges().get(0));
        Assertions.assertEquals("ofmxagkvtmelmqkr", model.subnet().gatewayAddress());
        Assertions.assertEquals(3141876003584230040L, model.revision());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        WorkloadNetworkSegmentInner model =
            new WorkloadNetworkSegmentInner()
                .withDisplayName("n")
                .withConnectedGateway("bpzkafkuwbc")
                .withSubnet(
                    new WorkloadNetworkSegmentSubnet()
                        .withDhcpRanges(Arrays.asList("mehhseyvjusrtsl", "spkdee"))
                        .withGatewayAddress("ofmxagkvtmelmqkr"))
                .withRevision(3141876003584230040L);
        model = BinaryData.fromObject(model).toObject(WorkloadNetworkSegmentInner.class);
        Assertions.assertEquals("n", model.displayName());
        Assertions.assertEquals("bpzkafkuwbc", model.connectedGateway());
        Assertions.assertEquals("mehhseyvjusrtsl", model.subnet().dhcpRanges().get(0));
        Assertions.assertEquals("ofmxagkvtmelmqkr", model.subnet().gatewayAddress());
        Assertions.assertEquals(3141876003584230040L, model.revision());
    }
}
