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

package com.azure.resourcemanager.networkcloud.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.networkcloud.models.DefaultGateway;
import com.azure.resourcemanager.networkcloud.models.NetworkAttachment;
import com.azure.resourcemanager.networkcloud.models.VirtualMachineIpAllocationMethod;
import org.junit.jupiter.api.Assertions;

public final class NetworkAttachmentTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        NetworkAttachment model =
            BinaryData
                .fromString(
                    "{\"attachedNetworkId\":\"tdtbnnhadooc\",\"defaultGateway\":\"False\",\"ipAllocationMethod\":\"Dynamic\",\"ipv4Address\":\"khnvpam\",\"ipv6Address\":\"x\",\"macAddress\":\"u\",\"networkAttachmentName\":\"ik\"}")
                .toObject(NetworkAttachment.class);
        Assertions.assertEquals("tdtbnnhadooc", model.attachedNetworkId());
        Assertions.assertEquals(DefaultGateway.FALSE, model.defaultGateway());
        Assertions.assertEquals(VirtualMachineIpAllocationMethod.DYNAMIC, model.ipAllocationMethod());
        Assertions.assertEquals("khnvpam", model.ipv4Address());
        Assertions.assertEquals("x", model.ipv6Address());
        Assertions.assertEquals("ik", model.networkAttachmentName());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        NetworkAttachment model =
            new NetworkAttachment()
                .withAttachedNetworkId("tdtbnnhadooc")
                .withDefaultGateway(DefaultGateway.FALSE)
                .withIpAllocationMethod(VirtualMachineIpAllocationMethod.DYNAMIC)
                .withIpv4Address("khnvpam")
                .withIpv6Address("x")
                .withNetworkAttachmentName("ik");
        model = BinaryData.fromObject(model).toObject(NetworkAttachment.class);
        Assertions.assertEquals("tdtbnnhadooc", model.attachedNetworkId());
        Assertions.assertEquals(DefaultGateway.FALSE, model.defaultGateway());
        Assertions.assertEquals(VirtualMachineIpAllocationMethod.DYNAMIC, model.ipAllocationMethod());
        Assertions.assertEquals("khnvpam", model.ipv4Address());
        Assertions.assertEquals("x", model.ipv6Address());
        Assertions.assertEquals("ik", model.networkAttachmentName());
    }
}
