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

package com.azure.resourcemanager.paloaltonetworks.ngfw.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.paloaltonetworks.ngfw.models.DnsProxy;
import com.azure.resourcemanager.paloaltonetworks.ngfw.models.DnsSettings;
import com.azure.resourcemanager.paloaltonetworks.ngfw.models.EnabledDnsType;
import com.azure.resourcemanager.paloaltonetworks.ngfw.models.IpAddress;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class DnsSettingsTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        DnsSettings model =
            BinaryData
                .fromString(
                    "{\"enableDnsProxy\":\"ENABLED\",\"enabledDnsType\":\"CUSTOM\",\"dnsServers\":[{\"resourceId\":\"nyhgbijtji\",\"address\":\"xzsjabib\"},{\"resourceId\":\"stawfsdjpvkv\",\"address\":\"jxbkzbzkdvn\"}]}")
                .toObject(DnsSettings.class);
        Assertions.assertEquals(DnsProxy.ENABLED, model.enableDnsProxy());
        Assertions.assertEquals(EnabledDnsType.CUSTOM, model.enabledDnsType());
        Assertions.assertEquals("nyhgbijtji", model.dnsServers().get(0).resourceId());
        Assertions.assertEquals("xzsjabib", model.dnsServers().get(0).address());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        DnsSettings model =
            new DnsSettings()
                .withEnableDnsProxy(DnsProxy.ENABLED)
                .withEnabledDnsType(EnabledDnsType.CUSTOM)
                .withDnsServers(
                    Arrays
                        .asList(
                            new IpAddress().withResourceId("nyhgbijtji").withAddress("xzsjabib"),
                            new IpAddress().withResourceId("stawfsdjpvkv").withAddress("jxbkzbzkdvn")));
        model = BinaryData.fromObject(model).toObject(DnsSettings.class);
        Assertions.assertEquals(DnsProxy.ENABLED, model.enableDnsProxy());
        Assertions.assertEquals(EnabledDnsType.CUSTOM, model.enabledDnsType());
        Assertions.assertEquals("nyhgbijtji", model.dnsServers().get(0).resourceId());
        Assertions.assertEquals("xzsjabib", model.dnsServers().get(0).address());
    }
}
