// 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.DataDisk;
import com.azure.resourcemanager.hybridnetwork.models.DiskCreateOptionTypes;
import com.azure.resourcemanager.hybridnetwork.models.ImageReference;
import com.azure.resourcemanager.hybridnetwork.models.OperatingSystemTypes;
import com.azure.resourcemanager.hybridnetwork.models.OsDisk;
import com.azure.resourcemanager.hybridnetwork.models.StorageProfile;
import com.azure.resourcemanager.hybridnetwork.models.VirtualHardDisk;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class StorageProfileTests {
    @Test
    public void testDeserialize() {
        StorageProfile model =
            BinaryData
                .fromString(
                    "{\"imageReference\":{\"publisher\":\"nqbqqwxr\",\"offer\":\"eallnwsubisnj\",\"sku\":\"pmng\",\"version\":\"scxaq\",\"exactVersion\":\"ochcbonqvpkvl\"},\"osDisk\":{\"osType\":\"Linux\",\"name\":\"ase\",\"vhd\":{\"uri\":\"eo\"},\"diskSizeGB\":248230839},\"dataDisks\":[{\"createOption\":\"Unknown\",\"name\":\"enjbdlwtgrhp\",\"diskSizeGB\":469621378}]}")
                .toObject(StorageProfile.class);
        Assertions.assertEquals("nqbqqwxr", model.imageReference().publisher());
        Assertions.assertEquals("eallnwsubisnj", model.imageReference().offer());
        Assertions.assertEquals("pmng", model.imageReference().sku());
        Assertions.assertEquals("scxaq", model.imageReference().version());
        Assertions.assertEquals("ochcbonqvpkvl", model.imageReference().exactVersion());
        Assertions.assertEquals(OperatingSystemTypes.LINUX, model.osDisk().osType());
        Assertions.assertEquals("ase", model.osDisk().name());
        Assertions.assertEquals("eo", model.osDisk().vhd().uri());
        Assertions.assertEquals(248230839, model.osDisk().diskSizeGB());
        Assertions.assertEquals(DiskCreateOptionTypes.UNKNOWN, model.dataDisks().get(0).createOption());
        Assertions.assertEquals("enjbdlwtgrhp", model.dataDisks().get(0).name());
        Assertions.assertEquals(469621378, model.dataDisks().get(0).diskSizeGB());
    }

    @Test
    public void testSerialize() {
        StorageProfile model =
            new StorageProfile()
                .withImageReference(
                    new ImageReference()
                        .withPublisher("nqbqqwxr")
                        .withOffer("eallnwsubisnj")
                        .withSku("pmng")
                        .withVersion("scxaq")
                        .withExactVersion("ochcbonqvpkvl"))
                .withOsDisk(
                    new OsDisk()
                        .withOsType(OperatingSystemTypes.LINUX)
                        .withName("ase")
                        .withVhd(new VirtualHardDisk().withUri("eo"))
                        .withDiskSizeGB(248230839))
                .withDataDisks(
                    Arrays
                        .asList(
                            new DataDisk()
                                .withCreateOption(DiskCreateOptionTypes.UNKNOWN)
                                .withName("enjbdlwtgrhp")
                                .withDiskSizeGB(469621378)));
        model = BinaryData.fromObject(model).toObject(StorageProfile.class);
        Assertions.assertEquals("nqbqqwxr", model.imageReference().publisher());
        Assertions.assertEquals("eallnwsubisnj", model.imageReference().offer());
        Assertions.assertEquals("pmng", model.imageReference().sku());
        Assertions.assertEquals("scxaq", model.imageReference().version());
        Assertions.assertEquals("ochcbonqvpkvl", model.imageReference().exactVersion());
        Assertions.assertEquals(OperatingSystemTypes.LINUX, model.osDisk().osType());
        Assertions.assertEquals("ase", model.osDisk().name());
        Assertions.assertEquals("eo", model.osDisk().vhd().uri());
        Assertions.assertEquals(248230839, model.osDisk().diskSizeGB());
        Assertions.assertEquals(DiskCreateOptionTypes.UNKNOWN, model.dataDisks().get(0).createOption());
        Assertions.assertEquals("enjbdlwtgrhp", model.dataDisks().get(0).name());
        Assertions.assertEquals(469621378, model.dataDisks().get(0).diskSizeGB());
    }
}
