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

package com.azure.resourcemanager.appcontainers.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.appcontainers.fluent.models.AvailableWorkloadProfileInner;
import com.azure.resourcemanager.appcontainers.models.Applicability;
import com.azure.resourcemanager.appcontainers.models.AvailableWorkloadProfileProperties;
import com.azure.resourcemanager.appcontainers.models.AvailableWorkloadProfilesCollection;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class AvailableWorkloadProfilesCollectionTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AvailableWorkloadProfilesCollection model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"location\":\"gmaajrm\",\"properties\":{\"category\":\"wzrlovmclwhij\",\"applicability\":\"Custom\",\"cores\":1491222167,\"memoryGiB\":1583993126,\"displayName\":\"aqsqsycbkbfk\"},\"id\":\"kdkexxp\",\"name\":\"ofmx\",\"type\":\"x\"},{\"location\":\"jpgd\",\"properties\":{\"category\":\"c\",\"applicability\":\"LocationDefault\",\"cores\":1303757459,\"memoryGiB\":193768750,\"displayName\":\"uexhdzx\"},\"id\":\"qeojnxqbzvddntw\",\"name\":\"deicbtwnpzao\",\"type\":\"vuhrhcffcyddgl\"},{\"location\":\"t\",\"properties\":{\"category\":\"kw\",\"applicability\":\"Custom\",\"cores\":1516038621,\"memoryGiB\":775876395,\"displayName\":\"ciwqvhk\"},\"id\":\"xuigdtopbobj\",\"name\":\"ghmewuam\",\"type\":\"uhrzayvvt\"},{\"location\":\"vdfgiotk\",\"properties\":{\"category\":\"tqxln\",\"applicability\":\"Custom\",\"cores\":1542158785,\"memoryGiB\":719588208,\"displayName\":\"nxkrx\"},\"id\":\"mi\",\"name\":\"tthzrvqd\",\"type\":\"abhjybi\"}],\"nextLink\":\"h\"}")
                .toObject(AvailableWorkloadProfilesCollection.class);
        Assertions.assertEquals("gmaajrm", model.value().get(0).location());
        Assertions.assertEquals("wzrlovmclwhij", model.value().get(0).properties().category());
        Assertions.assertEquals(Applicability.CUSTOM, model.value().get(0).properties().applicability());
        Assertions.assertEquals(1491222167, model.value().get(0).properties().cores());
        Assertions.assertEquals(1583993126, model.value().get(0).properties().memoryGiB());
        Assertions.assertEquals("aqsqsycbkbfk", model.value().get(0).properties().displayName());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AvailableWorkloadProfilesCollection model =
            new AvailableWorkloadProfilesCollection()
                .withValue(
                    Arrays
                        .asList(
                            new AvailableWorkloadProfileInner()
                                .withLocation("gmaajrm")
                                .withProperties(
                                    new AvailableWorkloadProfileProperties()
                                        .withCategory("wzrlovmclwhij")
                                        .withApplicability(Applicability.CUSTOM)
                                        .withCores(1491222167)
                                        .withMemoryGiB(1583993126)
                                        .withDisplayName("aqsqsycbkbfk")),
                            new AvailableWorkloadProfileInner()
                                .withLocation("jpgd")
                                .withProperties(
                                    new AvailableWorkloadProfileProperties()
                                        .withCategory("c")
                                        .withApplicability(Applicability.LOCATION_DEFAULT)
                                        .withCores(1303757459)
                                        .withMemoryGiB(193768750)
                                        .withDisplayName("uexhdzx")),
                            new AvailableWorkloadProfileInner()
                                .withLocation("t")
                                .withProperties(
                                    new AvailableWorkloadProfileProperties()
                                        .withCategory("kw")
                                        .withApplicability(Applicability.CUSTOM)
                                        .withCores(1516038621)
                                        .withMemoryGiB(775876395)
                                        .withDisplayName("ciwqvhk")),
                            new AvailableWorkloadProfileInner()
                                .withLocation("vdfgiotk")
                                .withProperties(
                                    new AvailableWorkloadProfileProperties()
                                        .withCategory("tqxln")
                                        .withApplicability(Applicability.CUSTOM)
                                        .withCores(1542158785)
                                        .withMemoryGiB(719588208)
                                        .withDisplayName("nxkrx"))));
        model = BinaryData.fromObject(model).toObject(AvailableWorkloadProfilesCollection.class);
        Assertions.assertEquals("gmaajrm", model.value().get(0).location());
        Assertions.assertEquals("wzrlovmclwhij", model.value().get(0).properties().category());
        Assertions.assertEquals(Applicability.CUSTOM, model.value().get(0).properties().applicability());
        Assertions.assertEquals(1491222167, model.value().get(0).properties().cores());
        Assertions.assertEquals(1583993126, model.value().get(0).properties().memoryGiB());
        Assertions.assertEquals("aqsqsycbkbfk", model.value().get(0).properties().displayName());
    }
}
