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

package com.azure.resourcemanager.reservations.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.reservations.fluent.models.OperationResponseInner;
import com.azure.resourcemanager.reservations.models.OperationDisplay;
import com.azure.resourcemanager.reservations.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\":\"osvmk\",\"isDataAction\":false,\"display\":{\"provider\":\"ukkfplgmgs\",\"resource\":\"kjz\",\"operation\":\"es\",\"description\":\"vlopwiyighx\"},\"origin\":\"dwzbaiue\",\"properties\":\"dataa\"}],\"nextLink\":\"nyqupedeojnabck\"}")
                .toObject(OperationList.class);
        Assertions.assertEquals("osvmk", model.value().get(0).name());
        Assertions.assertEquals(false, model.value().get(0).isDataAction());
        Assertions.assertEquals("ukkfplgmgs", model.value().get(0).display().provider());
        Assertions.assertEquals("kjz", model.value().get(0).display().resource());
        Assertions.assertEquals("es", model.value().get(0).display().operation());
        Assertions.assertEquals("vlopwiyighx", model.value().get(0).display().description());
        Assertions.assertEquals("dwzbaiue", model.value().get(0).origin());
        Assertions.assertEquals("nyqupedeojnabck", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OperationList model =
            new OperationList()
                .withValue(
                    Arrays
                        .asList(
                            new OperationResponseInner()
                                .withName("osvmk")
                                .withIsDataAction(false)
                                .withDisplay(
                                    new OperationDisplay()
                                        .withProvider("ukkfplgmgs")
                                        .withResource("kjz")
                                        .withOperation("es")
                                        .withDescription("vlopwiyighx"))
                                .withOrigin("dwzbaiue")
                                .withProperties("dataa")))
                .withNextLink("nyqupedeojnabck");
        model = BinaryData.fromObject(model).toObject(OperationList.class);
        Assertions.assertEquals("osvmk", model.value().get(0).name());
        Assertions.assertEquals(false, model.value().get(0).isDataAction());
        Assertions.assertEquals("ukkfplgmgs", model.value().get(0).display().provider());
        Assertions.assertEquals("kjz", model.value().get(0).display().resource());
        Assertions.assertEquals("es", model.value().get(0).display().operation());
        Assertions.assertEquals("vlopwiyighx", model.value().get(0).display().description());
        Assertions.assertEquals("dwzbaiue", model.value().get(0).origin());
        Assertions.assertEquals("nyqupedeojnabck", model.nextLink());
    }
}
