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

package com.azure.resourcemanager.datamigration.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.datamigration.fluent.models.AvailableServiceSkuInner;
import com.azure.resourcemanager.datamigration.models.AvailableServiceSkuCapacity;
import com.azure.resourcemanager.datamigration.models.AvailableServiceSkuSku;
import com.azure.resourcemanager.datamigration.models.ServiceScalability;
import com.azure.resourcemanager.datamigration.models.ServiceSkuList;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class ServiceSkuListTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ServiceSkuList model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"resourceType\":\"klryplwck\",\"sku\":{\"name\":\"yypnddhsgcbacphe\",\"family\":\"ot\",\"size\":\"qgoulznd\",\"tier\":\"kwy\"},\"capacity\":{\"minimum\":892676084,\"maximum\":1579471908,\"default\":1173503063,\"scaleType\":\"automatic\"}}],\"nextLink\":\"akeqs\"}")
                .toObject(ServiceSkuList.class);
        Assertions.assertEquals("klryplwck", model.value().get(0).resourceType());
        Assertions.assertEquals("yypnddhsgcbacphe", model.value().get(0).sku().name());
        Assertions.assertEquals("ot", model.value().get(0).sku().family());
        Assertions.assertEquals("qgoulznd", model.value().get(0).sku().size());
        Assertions.assertEquals("kwy", model.value().get(0).sku().tier());
        Assertions.assertEquals(892676084, model.value().get(0).capacity().minimum());
        Assertions.assertEquals(1579471908, model.value().get(0).capacity().maximum());
        Assertions.assertEquals(1173503063, model.value().get(0).capacity().defaultProperty());
        Assertions.assertEquals(ServiceScalability.AUTOMATIC, model.value().get(0).capacity().scaleType());
        Assertions.assertEquals("akeqs", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ServiceSkuList model =
            new ServiceSkuList()
                .withValue(
                    Arrays
                        .asList(
                            new AvailableServiceSkuInner()
                                .withResourceType("klryplwck")
                                .withSku(
                                    new AvailableServiceSkuSku()
                                        .withName("yypnddhsgcbacphe")
                                        .withFamily("ot")
                                        .withSize("qgoulznd")
                                        .withTier("kwy"))
                                .withCapacity(
                                    new AvailableServiceSkuCapacity()
                                        .withMinimum(892676084)
                                        .withMaximum(1579471908)
                                        .withDefaultProperty(1173503063)
                                        .withScaleType(ServiceScalability.AUTOMATIC))))
                .withNextLink("akeqs");
        model = BinaryData.fromObject(model).toObject(ServiceSkuList.class);
        Assertions.assertEquals("klryplwck", model.value().get(0).resourceType());
        Assertions.assertEquals("yypnddhsgcbacphe", model.value().get(0).sku().name());
        Assertions.assertEquals("ot", model.value().get(0).sku().family());
        Assertions.assertEquals("qgoulznd", model.value().get(0).sku().size());
        Assertions.assertEquals("kwy", model.value().get(0).sku().tier());
        Assertions.assertEquals(892676084, model.value().get(0).capacity().minimum());
        Assertions.assertEquals(1579471908, model.value().get(0).capacity().maximum());
        Assertions.assertEquals(1173503063, model.value().get(0).capacity().defaultProperty());
        Assertions.assertEquals(ServiceScalability.AUTOMATIC, model.value().get(0).capacity().scaleType());
        Assertions.assertEquals("akeqs", model.nextLink());
    }
}
