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

package com.azure.resourcemanager.signalr.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.signalr.fluent.models.OperationInner;
import com.azure.resourcemanager.signalr.models.OperationDisplay;
import com.azure.resourcemanager.signalr.models.OperationList;
import com.azure.resourcemanager.signalr.models.OperationProperties;
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\":\"quvgjxpybczme\",\"isDataAction\":true,\"display\":{\"provider\":\"pbsphrupidgs\",\"resource\":\"bejhphoycmsxa\",\"operation\":\"hdxbmtqio\",\"description\":\"zehtbmu\"},\"origin\":\"ownoizhw\",\"properties\":{}},{\"name\":\"bqsoqijg\",\"isDataAction\":true,\"display\":{\"provider\":\"azlobcufpdznrbt\",\"resource\":\"qjnqglhqgnufoooj\",\"operation\":\"ifsqesaagdfmg\",\"description\":\"lhjxr\"},\"origin\":\"kwm\",\"properties\":{}},{\"name\":\"siznto\",\"isDataAction\":false,\"display\":{\"provider\":\"uajpsquc\",\"resource\":\"o\",\"operation\":\"dkfo\",\"description\":\"nygj\"},\"origin\":\"jddeqsrdeupewnw\",\"properties\":{}}],\"nextLink\":\"jzyflu\"}")
                .toObject(OperationList.class);
        Assertions.assertEquals("quvgjxpybczme", model.value().get(0).name());
        Assertions.assertEquals(true, model.value().get(0).isDataAction());
        Assertions.assertEquals("pbsphrupidgs", model.value().get(0).display().provider());
        Assertions.assertEquals("bejhphoycmsxa", model.value().get(0).display().resource());
        Assertions.assertEquals("hdxbmtqio", model.value().get(0).display().operation());
        Assertions.assertEquals("zehtbmu", model.value().get(0).display().description());
        Assertions.assertEquals("ownoizhw", model.value().get(0).origin());
        Assertions.assertEquals("jzyflu", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OperationList model =
            new OperationList()
                .withValue(
                    Arrays
                        .asList(
                            new OperationInner()
                                .withName("quvgjxpybczme")
                                .withIsDataAction(true)
                                .withDisplay(
                                    new OperationDisplay()
                                        .withProvider("pbsphrupidgs")
                                        .withResource("bejhphoycmsxa")
                                        .withOperation("hdxbmtqio")
                                        .withDescription("zehtbmu"))
                                .withOrigin("ownoizhw")
                                .withProperties(new OperationProperties()),
                            new OperationInner()
                                .withName("bqsoqijg")
                                .withIsDataAction(true)
                                .withDisplay(
                                    new OperationDisplay()
                                        .withProvider("azlobcufpdznrbt")
                                        .withResource("qjnqglhqgnufoooj")
                                        .withOperation("ifsqesaagdfmg")
                                        .withDescription("lhjxr"))
                                .withOrigin("kwm")
                                .withProperties(new OperationProperties()),
                            new OperationInner()
                                .withName("siznto")
                                .withIsDataAction(false)
                                .withDisplay(
                                    new OperationDisplay()
                                        .withProvider("uajpsquc")
                                        .withResource("o")
                                        .withOperation("dkfo")
                                        .withDescription("nygj"))
                                .withOrigin("jddeqsrdeupewnw")
                                .withProperties(new OperationProperties())))
                .withNextLink("jzyflu");
        model = BinaryData.fromObject(model).toObject(OperationList.class);
        Assertions.assertEquals("quvgjxpybczme", model.value().get(0).name());
        Assertions.assertEquals(true, model.value().get(0).isDataAction());
        Assertions.assertEquals("pbsphrupidgs", model.value().get(0).display().provider());
        Assertions.assertEquals("bejhphoycmsxa", model.value().get(0).display().resource());
        Assertions.assertEquals("hdxbmtqio", model.value().get(0).display().operation());
        Assertions.assertEquals("zehtbmu", model.value().get(0).display().description());
        Assertions.assertEquals("ownoizhw", model.value().get(0).origin());
        Assertions.assertEquals("jzyflu", model.nextLink());
    }
}
