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

package com.azure.resourcemanager.machinelearning.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.machinelearning.fluent.models.SkuResourceInner;
import com.azure.resourcemanager.machinelearning.models.SkuCapacity;
import com.azure.resourcemanager.machinelearning.models.SkuResourceArmPaginatedResult;
import com.azure.resourcemanager.machinelearning.models.SkuScaleType;
import com.azure.resourcemanager.machinelearning.models.SkuSetting;
import com.azure.resourcemanager.machinelearning.models.SkuTier;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class SkuResourceArmPaginatedResultTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        SkuResourceArmPaginatedResult model =
            BinaryData
                .fromString(
                    "{\"nextLink\":\"rmcaykgg\",\"value\":[{\"capacity\":{\"default\":167940342,\"maximum\":1720310055,\"minimum\":150393165,\"scaleType\":\"Manual\"},\"resourceType\":\"d\",\"sku\":{\"name\":\"pfnznthjtwkj\",\"tier\":\"Standard\"}}]}")
                .toObject(SkuResourceArmPaginatedResult.class);
        Assertions.assertEquals("rmcaykgg", model.nextLink());
        Assertions.assertEquals(167940342, model.value().get(0).capacity().defaultProperty());
        Assertions.assertEquals(1720310055, model.value().get(0).capacity().maximum());
        Assertions.assertEquals(150393165, model.value().get(0).capacity().minimum());
        Assertions.assertEquals(SkuScaleType.MANUAL, model.value().get(0).capacity().scaleType());
        Assertions.assertEquals("pfnznthjtwkj", model.value().get(0).sku().name());
        Assertions.assertEquals(SkuTier.STANDARD, model.value().get(0).sku().tier());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        SkuResourceArmPaginatedResult model =
            new SkuResourceArmPaginatedResult()
                .withNextLink("rmcaykgg")
                .withValue(
                    Arrays
                        .asList(
                            new SkuResourceInner()
                                .withCapacity(
                                    new SkuCapacity()
                                        .withDefaultProperty(167940342)
                                        .withMaximum(1720310055)
                                        .withMinimum(150393165)
                                        .withScaleType(SkuScaleType.MANUAL))
                                .withSku(new SkuSetting().withName("pfnznthjtwkj").withTier(SkuTier.STANDARD))));
        model = BinaryData.fromObject(model).toObject(SkuResourceArmPaginatedResult.class);
        Assertions.assertEquals("rmcaykgg", model.nextLink());
        Assertions.assertEquals(167940342, model.value().get(0).capacity().defaultProperty());
        Assertions.assertEquals(1720310055, model.value().get(0).capacity().maximum());
        Assertions.assertEquals(150393165, model.value().get(0).capacity().minimum());
        Assertions.assertEquals(SkuScaleType.MANUAL, model.value().get(0).capacity().scaleType());
        Assertions.assertEquals("pfnznthjtwkj", model.value().get(0).sku().name());
        Assertions.assertEquals(SkuTier.STANDARD, model.value().get(0).sku().tier());
    }
}
