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

package com.azure.resourcemanager.cognitiveservices.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.cognitiveservices.fluent.models.AccountSkuListResultInner;
import com.azure.resourcemanager.cognitiveservices.models.AccountSku;
import com.azure.resourcemanager.cognitiveservices.models.Sku;
import com.azure.resourcemanager.cognitiveservices.models.SkuTier;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class AccountSkuListResultInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AccountSkuListResultInner model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"resourceType\":\"utqxlngx\",\"sku\":{\"name\":\"fgugnxkrxdqmid\",\"tier\":\"Basic\",\"size\":\"rvqdra\",\"family\":\"jybige\",\"capacity\":1279126864}},{\"resourceType\":\"bowsk\",\"sku\":{\"name\":\"yktz\",\"tier\":\"Basic\",\"size\":\"y\",\"family\":\"qyw\",\"capacity\":1211142115}},{\"resourceType\":\"vynhzgpphrcg\",\"sku\":{\"name\":\"cocpecfvmmcoofsx\",\"tier\":\"Enterprise\",\"size\":\"gbmqjqabcypmiv\",\"family\":\"lzu\",\"capacity\":211064208}},{\"resourceType\":\"wnfnbacf\",\"sku\":{\"name\":\"nlebxetqgtzxd\",\"tier\":\"Enterprise\",\"size\":\"qqwx\",\"family\":\"feallnwsu\",\"capacity\":141642169}}]}")
                .toObject(AccountSkuListResultInner.class);
        Assertions.assertEquals("utqxlngx", model.value().get(0).resourceType());
        Assertions.assertEquals("fgugnxkrxdqmid", model.value().get(0).sku().name());
        Assertions.assertEquals(SkuTier.BASIC, model.value().get(0).sku().tier());
        Assertions.assertEquals("rvqdra", model.value().get(0).sku().size());
        Assertions.assertEquals("jybige", model.value().get(0).sku().family());
        Assertions.assertEquals(1279126864, model.value().get(0).sku().capacity());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AccountSkuListResultInner model =
            new AccountSkuListResultInner()
                .withValue(
                    Arrays
                        .asList(
                            new AccountSku()
                                .withResourceType("utqxlngx")
                                .withSku(
                                    new Sku()
                                        .withName("fgugnxkrxdqmid")
                                        .withTier(SkuTier.BASIC)
                                        .withSize("rvqdra")
                                        .withFamily("jybige")
                                        .withCapacity(1279126864)),
                            new AccountSku()
                                .withResourceType("bowsk")
                                .withSku(
                                    new Sku()
                                        .withName("yktz")
                                        .withTier(SkuTier.BASIC)
                                        .withSize("y")
                                        .withFamily("qyw")
                                        .withCapacity(1211142115)),
                            new AccountSku()
                                .withResourceType("vynhzgpphrcg")
                                .withSku(
                                    new Sku()
                                        .withName("cocpecfvmmcoofsx")
                                        .withTier(SkuTier.ENTERPRISE)
                                        .withSize("gbmqjqabcypmiv")
                                        .withFamily("lzu")
                                        .withCapacity(211064208)),
                            new AccountSku()
                                .withResourceType("wnfnbacf")
                                .withSku(
                                    new Sku()
                                        .withName("nlebxetqgtzxd")
                                        .withTier(SkuTier.ENTERPRISE)
                                        .withSize("qqwx")
                                        .withFamily("feallnwsu")
                                        .withCapacity(141642169))));
        model = BinaryData.fromObject(model).toObject(AccountSkuListResultInner.class);
        Assertions.assertEquals("utqxlngx", model.value().get(0).resourceType());
        Assertions.assertEquals("fgugnxkrxdqmid", model.value().get(0).sku().name());
        Assertions.assertEquals(SkuTier.BASIC, model.value().get(0).sku().tier());
        Assertions.assertEquals("rvqdra", model.value().get(0).sku().size());
        Assertions.assertEquals("jybige", model.value().get(0).sku().family());
        Assertions.assertEquals(1279126864, model.value().get(0).sku().capacity());
    }
}
