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

package com.azure.resourcemanager.quota.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.quota.fluent.models.OperationResponseInner;
import com.azure.resourcemanager.quota.models.OperationDisplay;
import com.azure.resourcemanager.quota.models.OperationList;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class OperationListTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        OperationList model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"name\":\"gibma\",\"display\":{\"provider\":\"keqsrxybzqqedq\",\"resource\":\"bciqfouflm\",\"operation\":\"kzsmodm\",\"description\":\"ougpbkwt\"},\"origin\":\"tduqktapspwgcuer\"},{\"name\":\"mkdo\",\"display\":{\"provider\":\"whbmd\",\"resource\":\"bjf\",\"operation\":\"gmbmbexppbh\",\"description\":\"qrolfpf\"},\"origin\":\"algbquxigjyjg\"}],\"nextLink\":\"aoyfhrtxilnerkuj\"}")
                .toObject(OperationList.class);
        Assertions.assertEquals("gibma", model.value().get(0).name());
        Assertions.assertEquals("keqsrxybzqqedq", model.value().get(0).display().provider());
        Assertions.assertEquals("bciqfouflm", model.value().get(0).display().resource());
        Assertions.assertEquals("kzsmodm", model.value().get(0).display().operation());
        Assertions.assertEquals("ougpbkwt", model.value().get(0).display().description());
        Assertions.assertEquals("tduqktapspwgcuer", model.value().get(0).origin());
        Assertions.assertEquals("aoyfhrtxilnerkuj", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OperationList model =
            new OperationList()
                .withValue(
                    Arrays
                        .asList(
                            new OperationResponseInner()
                                .withName("gibma")
                                .withDisplay(
                                    new OperationDisplay()
                                        .withProvider("keqsrxybzqqedq")
                                        .withResource("bciqfouflm")
                                        .withOperation("kzsmodm")
                                        .withDescription("ougpbkwt"))
                                .withOrigin("tduqktapspwgcuer"),
                            new OperationResponseInner()
                                .withName("mkdo")
                                .withDisplay(
                                    new OperationDisplay()
                                        .withProvider("whbmd")
                                        .withResource("bjf")
                                        .withOperation("gmbmbexppbh")
                                        .withDescription("qrolfpf"))
                                .withOrigin("algbquxigjyjg")))
                .withNextLink("aoyfhrtxilnerkuj");
        model = BinaryData.fromObject(model).toObject(OperationList.class);
        Assertions.assertEquals("gibma", model.value().get(0).name());
        Assertions.assertEquals("keqsrxybzqqedq", model.value().get(0).display().provider());
        Assertions.assertEquals("bciqfouflm", model.value().get(0).display().resource());
        Assertions.assertEquals("kzsmodm", model.value().get(0).display().operation());
        Assertions.assertEquals("ougpbkwt", model.value().get(0).display().description());
        Assertions.assertEquals("tduqktapspwgcuer", model.value().get(0).origin());
        Assertions.assertEquals("aoyfhrtxilnerkuj", model.nextLink());
    }
}
