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

package com.azure.resourcemanager.vmwarecloudsimple.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.vmwarecloudsimple.fluent.models.VirtualMachineTemplateInner;
import com.azure.resourcemanager.vmwarecloudsimple.fluent.models.VirtualNicInner;
import com.azure.resourcemanager.vmwarecloudsimple.models.DiskIndependenceMode;
import com.azure.resourcemanager.vmwarecloudsimple.models.NicType;
import com.azure.resourcemanager.vmwarecloudsimple.models.VirtualDisk;
import com.azure.resourcemanager.vmwarecloudsimple.models.VirtualDiskController;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class VirtualMachineTemplateInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        VirtualMachineTemplateInner model =
            BinaryData
                .fromString(
                    "{\"id\":\"wgxhn\",\"location\":\"kxfbkpycgklwndn\",\"name\":\"dauwhvylwzbtd\",\"properties\":{\"amountOfRam\":980501173,\"controllers\":[{\"id\":\"mpowuwpr\",\"name\":\"lve\",\"subType\":\"lupj\",\"type\":\"hfxobbcswsrtj\"},{\"id\":\"plrbpbewtghf\",\"name\":\"lcgwxzvlvqh\",\"subType\":\"begibtnmxiebwwa\",\"type\":\"ayqcgw\"},{\"id\":\"zjuzgwyz\",\"name\":\"txon\",\"subType\":\"ts\",\"type\":\"jcbpwxqpsrknft\"}],\"description\":\"vriuhprwmdyvx\",\"disks\":[{\"controllerId\":\"yriwwroyqb\",\"independenceMode\":\"independent_persistent\",\"totalSize\":1717005830,\"virtualDiskId\":\"cqibycnojv\",\"virtualDiskName\":\"mefqsgzvahapjyzh\"},{\"controllerId\":\"vgqzcjrvxd\",\"independenceMode\":\"persistent\",\"totalSize\":1207917179,\"virtualDiskId\":\"wlxkvugfhzovaw\",\"virtualDiskName\":\"zunlu\"},{\"controllerId\":\"hnnpr\",\"independenceMode\":\"independent_nonpersistent\",\"totalSize\":112324206,\"virtualDiskId\":\"eilpjzuaejxdu\",\"virtualDiskName\":\"skzbb\"},{\"controllerId\":\"dzumveekg\",\"independenceMode\":\"persistent\",\"totalSize\":1817395780,\"virtualDiskId\":\"uh\",\"virtualDiskName\":\"p\"}],\"exposeToGuestVM\":true,\"guestOS\":\"ofd\",\"guestOSType\":\"uusdttouwa\",\"nics\":[{\"ipAddresses\":[],\"macAddress\":\"kelnsmvbxwyjsf\",\"nicType\":\"E1000E\",\"powerOnBoot\":true,\"virtualNicId\":\"aln\",\"virtualNicName\":\"xisxyawjoyaqcsl\"},{\"ipAddresses\":[],\"macAddress\":\"iidzyexzne\",\"nicType\":\"VMXNET\",\"powerOnBoot\":false,\"virtualNicId\":\"rzt\",\"virtualNicName\":\"lhbnxkna\"}],\"numberOfCores\":2019040636,\"path\":\"ppg\",\"privateCloudId\":\"dtpnapnyiropuhp\",\"vSphereNetworks\":[\"pgylg\",\"git\",\"medjvcslynqwwncw\",\"zhxgktrmgucn\"],\"vSphereTags\":[\"t\"],\"vmwaretools\":\"ellwptfdy\"},\"type\":\"fqbuaceopzf\"}")
                .toObject(VirtualMachineTemplateInner.class);
        Assertions.assertEquals("kxfbkpycgklwndn", model.location());
        Assertions.assertEquals(980501173, model.amountOfRam());
        Assertions.assertEquals("vriuhprwmdyvx", model.description());
        Assertions.assertEquals("yriwwroyqb", model.disks().get(0).controllerId());
        Assertions.assertEquals(DiskIndependenceMode.INDEPENDENT_PERSISTENT, model.disks().get(0).independenceMode());
        Assertions.assertEquals(1717005830, model.disks().get(0).totalSize());
        Assertions.assertEquals("cqibycnojv", model.disks().get(0).virtualDiskId());
        Assertions.assertEquals(true, model.exposeToGuestVM());
        Assertions.assertEquals("kelnsmvbxwyjsf", model.nics().get(0).macAddress());
        Assertions.assertEquals(NicType.E1000E, model.nics().get(0).nicType());
        Assertions.assertEquals(true, model.nics().get(0).powerOnBoot());
        Assertions.assertEquals("aln", model.nics().get(0).virtualNicId());
        Assertions.assertEquals(2019040636, model.numberOfCores());
        Assertions.assertEquals("ppg", model.path());
        Assertions.assertEquals("dtpnapnyiropuhp", model.privateCloudId());
        Assertions.assertEquals("pgylg", model.vSphereNetworks().get(0));
        Assertions.assertEquals("t", model.vSphereTags().get(0));
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        VirtualMachineTemplateInner model =
            new VirtualMachineTemplateInner()
                .withLocation("kxfbkpycgklwndn")
                .withAmountOfRam(980501173)
                .withControllers(
                    Arrays
                        .asList(new VirtualDiskController(), new VirtualDiskController(), new VirtualDiskController()))
                .withDescription("vriuhprwmdyvx")
                .withDisks(
                    Arrays
                        .asList(
                            new VirtualDisk()
                                .withControllerId("yriwwroyqb")
                                .withIndependenceMode(DiskIndependenceMode.INDEPENDENT_PERSISTENT)
                                .withTotalSize(1717005830)
                                .withVirtualDiskId("cqibycnojv"),
                            new VirtualDisk()
                                .withControllerId("vgqzcjrvxd")
                                .withIndependenceMode(DiskIndependenceMode.PERSISTENT)
                                .withTotalSize(1207917179)
                                .withVirtualDiskId("wlxkvugfhzovaw"),
                            new VirtualDisk()
                                .withControllerId("hnnpr")
                                .withIndependenceMode(DiskIndependenceMode.INDEPENDENT_NONPERSISTENT)
                                .withTotalSize(112324206)
                                .withVirtualDiskId("eilpjzuaejxdu"),
                            new VirtualDisk()
                                .withControllerId("dzumveekg")
                                .withIndependenceMode(DiskIndependenceMode.PERSISTENT)
                                .withTotalSize(1817395780)
                                .withVirtualDiskId("uh")))
                .withExposeToGuestVM(true)
                .withNics(
                    Arrays
                        .asList(
                            new VirtualNicInner()
                                .withIpAddresses(Arrays.asList())
                                .withMacAddress("kelnsmvbxwyjsf")
                                .withNicType(NicType.E1000E)
                                .withPowerOnBoot(true)
                                .withVirtualNicId("aln"),
                            new VirtualNicInner()
                                .withIpAddresses(Arrays.asList())
                                .withMacAddress("iidzyexzne")
                                .withNicType(NicType.VMXNET)
                                .withPowerOnBoot(false)
                                .withVirtualNicId("rzt")))
                .withNumberOfCores(2019040636)
                .withPath("ppg")
                .withPrivateCloudId("dtpnapnyiropuhp")
                .withVSphereNetworks(Arrays.asList("pgylg", "git", "medjvcslynqwwncw", "zhxgktrmgucn"))
                .withVSphereTags(Arrays.asList("t"));
        model = BinaryData.fromObject(model).toObject(VirtualMachineTemplateInner.class);
        Assertions.assertEquals("kxfbkpycgklwndn", model.location());
        Assertions.assertEquals(980501173, model.amountOfRam());
        Assertions.assertEquals("vriuhprwmdyvx", model.description());
        Assertions.assertEquals("yriwwroyqb", model.disks().get(0).controllerId());
        Assertions.assertEquals(DiskIndependenceMode.INDEPENDENT_PERSISTENT, model.disks().get(0).independenceMode());
        Assertions.assertEquals(1717005830, model.disks().get(0).totalSize());
        Assertions.assertEquals("cqibycnojv", model.disks().get(0).virtualDiskId());
        Assertions.assertEquals(true, model.exposeToGuestVM());
        Assertions.assertEquals("kelnsmvbxwyjsf", model.nics().get(0).macAddress());
        Assertions.assertEquals(NicType.E1000E, model.nics().get(0).nicType());
        Assertions.assertEquals(true, model.nics().get(0).powerOnBoot());
        Assertions.assertEquals("aln", model.nics().get(0).virtualNicId());
        Assertions.assertEquals(2019040636, model.numberOfCores());
        Assertions.assertEquals("ppg", model.path());
        Assertions.assertEquals("dtpnapnyiropuhp", model.privateCloudId());
        Assertions.assertEquals("pgylg", model.vSphereNetworks().get(0));
        Assertions.assertEquals("t", model.vSphereTags().get(0));
    }
}
