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

package com.azure.resourcemanager.networkfunction.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.networkfunction.fluent.models.OperationInner;
import com.azure.resourcemanager.networkfunction.models.OperationDisplay;
import com.azure.resourcemanager.networkfunction.models.OperationListResult;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class OperationListResultTests {
    @Test
    public void testDeserialize() {
        OperationListResult model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"name\":\"quvgjxpybczme\",\"isDataAction\":true,\"display\":{\"provider\":\"pbsphrupidgs\",\"resource\":\"bejhphoycmsxa\",\"operation\":\"hdxbmtqio\",\"description\":\"zehtbmu\"},\"origin\":\"ownoizhw\"},{\"name\":\"xybqsoqij\",\"isDataAction\":true,\"display\":{\"provider\":\"pazlobcufpdz\",\"resource\":\"btcqq\",\"operation\":\"qglhq\",\"description\":\"ufo\"},\"origin\":\"jywif\"},{\"name\":\"esaagdfm\",\"isDataAction\":true,\"display\":{\"provider\":\"j\",\"resource\":\"ifkwmrvktsizntoc\",\"operation\":\"a\",\"description\":\"ajpsquc\"},\"origin\":\"o\"}],\"nextLink\":\"dkfo\"}")
                .toObject(OperationListResult.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("dkfo", model.nextLink());
    }

    @Test
    public void testSerialize() {
        OperationListResult model =
            new OperationListResult()
                .withValue(
                    Arrays
                        .asList(
                            new OperationInner()
                                .withName("quvgjxpybczme")
                                .withIsDataAction(true)
                                .withDisplay(
                                    new OperationDisplay()
                                        .withProvider("pbsphrupidgs")
                                        .withResource("bejhphoycmsxa")
                                        .withOperation("hdxbmtqio")
                                        .withDescription("zehtbmu"))
                                .withOrigin("ownoizhw"),
                            new OperationInner()
                                .withName("xybqsoqij")
                                .withIsDataAction(true)
                                .withDisplay(
                                    new OperationDisplay()
                                        .withProvider("pazlobcufpdz")
                                        .withResource("btcqq")
                                        .withOperation("qglhq")
                                        .withDescription("ufo"))
                                .withOrigin("jywif"),
                            new OperationInner()
                                .withName("esaagdfm")
                                .withIsDataAction(true)
                                .withDisplay(
                                    new OperationDisplay()
                                        .withProvider("j")
                                        .withResource("ifkwmrvktsizntoc")
                                        .withOperation("a")
                                        .withDescription("ajpsquc"))
                                .withOrigin("o")))
                .withNextLink("dkfo");
        model = BinaryData.fromObject(model).toObject(OperationListResult.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("dkfo", model.nextLink());
    }
}
