// 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.NetworkFunctionUserConfiguration;
import com.azure.resourcemanager.hybridnetwork.models.NetworkFunctionUserConfigurationOsProfile;
import com.azure.resourcemanager.hybridnetwork.models.NetworkInterface;
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 NetworkFunctionUserConfigurationTests {
    @Test
    public void testDeserialize() {
        NetworkFunctionUserConfiguration model =
            BinaryData
                .fromString(
                    "{\"roleName\":\"oqijgkdmbpaz\",\"networkInterfaces\":[{\"networkInterfaceName\":\"fp\",\"macAddress\":\"nrbtcqqjnq\",\"ipConfigurations\":[],\"vmSwitchType\":\"Management\"}],\"osProfile\":{\"customData\":\"foooj\"}}")
                .toObject(NetworkFunctionUserConfiguration.class);
        Assertions.assertEquals("oqijgkdmbpaz", model.roleName());
        Assertions.assertEquals("fp", model.networkInterfaces().get(0).networkInterfaceName());
        Assertions.assertEquals("nrbtcqqjnq", model.networkInterfaces().get(0).macAddress());
        Assertions.assertEquals(VMSwitchType.MANAGEMENT, model.networkInterfaces().get(0).vmSwitchType());
        Assertions.assertEquals("foooj", model.osProfile().customData());
    }

    @Test
    public void testSerialize() {
        NetworkFunctionUserConfiguration model =
            new NetworkFunctionUserConfiguration()
                .withRoleName("oqijgkdmbpaz")
                .withNetworkInterfaces(
                    Arrays
                        .asList(
                            new NetworkInterface()
                                .withNetworkInterfaceName("fp")
                                .withMacAddress("nrbtcqqjnq")
                                .withIpConfigurations(Arrays.asList())
                                .withVmSwitchType(VMSwitchType.MANAGEMENT)))
                .withOsProfile(new NetworkFunctionUserConfigurationOsProfile().withCustomData("foooj"));
        model = BinaryData.fromObject(model).toObject(NetworkFunctionUserConfiguration.class);
        Assertions.assertEquals("oqijgkdmbpaz", model.roleName());
        Assertions.assertEquals("fp", model.networkInterfaces().get(0).networkInterfaceName());
        Assertions.assertEquals("nrbtcqqjnq", model.networkInterfaces().get(0).macAddress());
        Assertions.assertEquals(VMSwitchType.MANAGEMENT, model.networkInterfaces().get(0).vmSwitchType());
        Assertions.assertEquals("foooj", model.osProfile().customData());
    }
}
