// 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.models.DeviceInterfaceProperties;
import com.azure.resourcemanager.managednetworkfabric.models.SupportedConnectorProperties;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class DeviceInterfacePropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        DeviceInterfaceProperties model =
            BinaryData
                .fromString(
                    "{\"identifier\":\"ywvtylbfpnc\",\"interfaceType\":\"doiwi\",\"supportedConnectorTypes\":[{\"connectorType\":\"ywub\",\"maxSpeedInMbps\":709721668},{\"connectorType\":\"h\",\"maxSpeedInMbps\":1060824316},{\"connectorType\":\"fdntwjchrdgoih\",\"maxSpeedInMbps\":1654736009},{\"connectorType\":\"ctondz\",\"maxSpeedInMbps\":518244659}]}")
                .toObject(DeviceInterfaceProperties.class);
        Assertions.assertEquals("ywvtylbfpnc", model.identifier());
        Assertions.assertEquals("doiwi", model.interfaceType());
        Assertions.assertEquals("ywub", model.supportedConnectorTypes().get(0).connectorType());
        Assertions.assertEquals(709721668, model.supportedConnectorTypes().get(0).maxSpeedInMbps());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        DeviceInterfaceProperties model =
            new DeviceInterfaceProperties()
                .withIdentifier("ywvtylbfpnc")
                .withInterfaceType("doiwi")
                .withSupportedConnectorTypes(
                    Arrays
                        .asList(
                            new SupportedConnectorProperties().withConnectorType("ywub").withMaxSpeedInMbps(709721668),
                            new SupportedConnectorProperties().withConnectorType("h").withMaxSpeedInMbps(1060824316),
                            new SupportedConnectorProperties()
                                .withConnectorType("fdntwjchrdgoih")
                                .withMaxSpeedInMbps(1654736009),
                            new SupportedConnectorProperties()
                                .withConnectorType("ctondz")
                                .withMaxSpeedInMbps(518244659)));
        model = BinaryData.fromObject(model).toObject(DeviceInterfaceProperties.class);
        Assertions.assertEquals("ywvtylbfpnc", model.identifier());
        Assertions.assertEquals("doiwi", model.interfaceType());
        Assertions.assertEquals("ywub", model.supportedConnectorTypes().get(0).connectorType());
        Assertions.assertEquals(709721668, model.supportedConnectorTypes().get(0).maxSpeedInMbps());
    }
}
