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

package com.azure.resourcemanager.hybridnetwork.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.hybridnetwork.models.LinuxConfiguration;
import com.azure.resourcemanager.hybridnetwork.models.NetworkFunctionVendorConfiguration;
import com.azure.resourcemanager.hybridnetwork.models.NetworkInterface;
import com.azure.resourcemanager.hybridnetwork.models.OsProfile;
import com.azure.resourcemanager.hybridnetwork.models.VMSwitchType;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class NetworkFunctionVendorConfigurationTests {
    @Test
    public void testDeserialize() {
        NetworkFunctionVendorConfiguration model =
            BinaryData
                .fromString(
                    "{\"roleName\":\"vyxlwhzlsicohoqq\",\"osProfile\":{\"adminUsername\":\"lryav\",\"linuxConfiguration\":{},\"customData\":\"unmmq\",\"customDataRequired\":false},\"networkInterfaces\":[{\"networkInterfaceName\":\"noc\",\"macAddress\":\"oklyaxuconuq\",\"ipConfigurations\":[],\"vmSwitchType\":\"Wan\"},{\"networkInterfaceName\":\"ypewrmjmwvvjekt\",\"macAddress\":\"senhwlrs\",\"ipConfigurations\":[],\"vmSwitchType\":\"Management\"}]}")
                .toObject(NetworkFunctionVendorConfiguration.class);
        Assertions.assertEquals("vyxlwhzlsicohoqq", model.roleName());
        Assertions.assertEquals("lryav", model.osProfile().adminUsername());
        Assertions.assertEquals("unmmq", model.osProfile().customData());
        Assertions.assertEquals(false, model.osProfile().customDataRequired());
        Assertions.assertEquals("noc", model.networkInterfaces().get(0).networkInterfaceName());
        Assertions.assertEquals("oklyaxuconuq", model.networkInterfaces().get(0).macAddress());
        Assertions.assertEquals(VMSwitchType.WAN, model.networkInterfaces().get(0).vmSwitchType());
    }

    @Test
    public void testSerialize() {
        NetworkFunctionVendorConfiguration model =
            new NetworkFunctionVendorConfiguration()
                .withRoleName("vyxlwhzlsicohoqq")
                .withOsProfile(
                    new OsProfile()
                        .withAdminUsername("lryav")
                        .withLinuxConfiguration(new LinuxConfiguration())
                        .withCustomData("unmmq")
                        .withCustomDataRequired(false))
                .withNetworkInterfaces(
                    Arrays
                        .asList(
                            new NetworkInterface()
                                .withNetworkInterfaceName("noc")
                                .withMacAddress("oklyaxuconuq")
                                .withIpConfigurations(Arrays.asList())
                                .withVmSwitchType(VMSwitchType.WAN),
                            new NetworkInterface()
                                .withNetworkInterfaceName("ypewrmjmwvvjekt")
                                .withMacAddress("senhwlrs")
                                .withIpConfigurations(Arrays.asList())
                                .withVmSwitchType(VMSwitchType.MANAGEMENT)));
        model = BinaryData.fromObject(model).toObject(NetworkFunctionVendorConfiguration.class);
        Assertions.assertEquals("vyxlwhzlsicohoqq", model.roleName());
        Assertions.assertEquals("lryav", model.osProfile().adminUsername());
        Assertions.assertEquals("unmmq", model.osProfile().customData());
        Assertions.assertEquals(false, model.osProfile().customDataRequired());
        Assertions.assertEquals("noc", model.networkInterfaces().get(0).networkInterfaceName());
        Assertions.assertEquals("oklyaxuconuq", model.networkInterfaces().get(0).macAddress());
        Assertions.assertEquals(VMSwitchType.WAN, model.networkInterfaces().get(0).vmSwitchType());
    }
}
