// 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.BfdConfiguration;
import com.azure.resourcemanager.managednetworkfabric.models.ExternalNetworkPropertiesOptionAProperties;
import org.junit.jupiter.api.Assertions;

public final class ExternalNetworkPropertiesOptionAPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ExternalNetworkPropertiesOptionAProperties model =
            BinaryData
                .fromString(
                    "{\"mtu\":1234217414,\"vlanId\":370586550,\"fabricASN\":939289474,\"peerASN\":1561704632,\"bfdConfiguration\":{\"administrativeState\":\"Enabled\",\"interval\":1155749150,\"multiplier\":754811246},\"primaryIpv4Prefix\":\"orwkqnyh\",\"primaryIpv6Prefix\":\"ij\",\"secondaryIpv4Prefix\":\"ivfxzsjabibsyst\",\"secondaryIpv6Prefix\":\"fsdjpvkvp\"}")
                .toObject(ExternalNetworkPropertiesOptionAProperties.class);
        Assertions.assertEquals("orwkqnyh", model.primaryIpv4Prefix());
        Assertions.assertEquals("ij", model.primaryIpv6Prefix());
        Assertions.assertEquals("ivfxzsjabibsyst", model.secondaryIpv4Prefix());
        Assertions.assertEquals("fsdjpvkvp", model.secondaryIpv6Prefix());
        Assertions.assertEquals(1234217414, model.mtu());
        Assertions.assertEquals(370586550, model.vlanId());
        Assertions.assertEquals(1561704632, model.peerAsn());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ExternalNetworkPropertiesOptionAProperties model =
            new ExternalNetworkPropertiesOptionAProperties()
                .withPrimaryIpv4Prefix("orwkqnyh")
                .withPrimaryIpv6Prefix("ij")
                .withSecondaryIpv4Prefix("ivfxzsjabibsyst")
                .withSecondaryIpv6Prefix("fsdjpvkvp")
                .withMtu(1234217414)
                .withVlanId(370586550)
                .withPeerAsn(1561704632)
                .withBfdConfiguration(new BfdConfiguration());
        model = BinaryData.fromObject(model).toObject(ExternalNetworkPropertiesOptionAProperties.class);
        Assertions.assertEquals("orwkqnyh", model.primaryIpv4Prefix());
        Assertions.assertEquals("ij", model.primaryIpv6Prefix());
        Assertions.assertEquals("ivfxzsjabibsyst", model.secondaryIpv4Prefix());
        Assertions.assertEquals("fsdjpvkvp", model.secondaryIpv6Prefix());
        Assertions.assertEquals(1234217414, model.mtu());
        Assertions.assertEquals(370586550, model.vlanId());
        Assertions.assertEquals(1561704632, model.peerAsn());
    }
}
