// 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.ResourceSkuInner;
import com.azure.resourcemanager.cognitiveservices.models.ResourceSkuListResult;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class ResourceSkuListResultTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ResourceSkuListResult model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"resourceType\":\"wmdwzjeiachboo\",\"name\":\"lnrosfqp\",\"tier\":\"ehzzvypyqrim\",\"kind\":\"npvswjdkirso\",\"locations\":[\"xhcr\",\"nohjt\"],\"restrictions\":[]},{\"resourceType\":\"dsoifiyipj\",\"name\":\"qwpgrjbzn\",\"tier\":\"cjxvsnbyxqab\",\"kind\":\"ocpcy\",\"locations\":[\"rzafbljjgpbtoqcj\",\"klj\"],\"restrictions\":[]},{\"resourceType\":\"idtqajzyu\",\"name\":\"kudjkrlkhb\",\"tier\":\"fepgzgq\",\"kind\":\"zloc\",\"locations\":[\"paierh\"],\"restrictions\":[]},{\"resourceType\":\"glu\",\"name\":\"a\",\"tier\":\"j\",\"kind\":\"dxob\",\"locations\":[\"xkqpxo\",\"ajionpimexgstxg\"],\"restrictions\":[]}],\"nextLink\":\"gmaajrm\"}")
                .toObject(ResourceSkuListResult.class);
        Assertions.assertEquals("wmdwzjeiachboo", model.value().get(0).resourceType());
        Assertions.assertEquals("lnrosfqp", model.value().get(0).name());
        Assertions.assertEquals("ehzzvypyqrim", model.value().get(0).tier());
        Assertions.assertEquals("npvswjdkirso", model.value().get(0).kind());
        Assertions.assertEquals("xhcr", model.value().get(0).locations().get(0));
        Assertions.assertEquals("gmaajrm", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ResourceSkuListResult model =
            new ResourceSkuListResult()
                .withValue(
                    Arrays
                        .asList(
                            new ResourceSkuInner()
                                .withResourceType("wmdwzjeiachboo")
                                .withName("lnrosfqp")
                                .withTier("ehzzvypyqrim")
                                .withKind("npvswjdkirso")
                                .withLocations(Arrays.asList("xhcr", "nohjt"))
                                .withRestrictions(Arrays.asList()),
                            new ResourceSkuInner()
                                .withResourceType("dsoifiyipj")
                                .withName("qwpgrjbzn")
                                .withTier("cjxvsnbyxqab")
                                .withKind("ocpcy")
                                .withLocations(Arrays.asList("rzafbljjgpbtoqcj", "klj"))
                                .withRestrictions(Arrays.asList()),
                            new ResourceSkuInner()
                                .withResourceType("idtqajzyu")
                                .withName("kudjkrlkhb")
                                .withTier("fepgzgq")
                                .withKind("zloc")
                                .withLocations(Arrays.asList("paierh"))
                                .withRestrictions(Arrays.asList()),
                            new ResourceSkuInner()
                                .withResourceType("glu")
                                .withName("a")
                                .withTier("j")
                                .withKind("dxob")
                                .withLocations(Arrays.asList("xkqpxo", "ajionpimexgstxg"))
                                .withRestrictions(Arrays.asList())))
                .withNextLink("gmaajrm");
        model = BinaryData.fromObject(model).toObject(ResourceSkuListResult.class);
        Assertions.assertEquals("wmdwzjeiachboo", model.value().get(0).resourceType());
        Assertions.assertEquals("lnrosfqp", model.value().get(0).name());
        Assertions.assertEquals("ehzzvypyqrim", model.value().get(0).tier());
        Assertions.assertEquals("npvswjdkirso", model.value().get(0).kind());
        Assertions.assertEquals("xhcr", model.value().get(0).locations().get(0));
        Assertions.assertEquals("gmaajrm", model.nextLink());
    }
}
