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

package com.azure.resourcemanager.vmwarecloudsimple.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.vmwarecloudsimple.fluent.models.AvailableOperationInner;
import com.azure.resourcemanager.vmwarecloudsimple.models.AvailableOperationDisplay;
import com.azure.resourcemanager.vmwarecloudsimple.models.AvailableOperationsListResponse;
import com.azure.resourcemanager.vmwarecloudsimple.models.OperationOrigin;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class AvailableOperationsListResponseTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AvailableOperationsListResponse model =
            BinaryData
                .fromString(
                    "{\"nextLink\":\"mhquvgjxp\",\"value\":[{\"display\":{\"description\":\"ehmtzop\",\"operation\":\"phrupidgsybbejhp\",\"provider\":\"ycm\",\"resource\":\"ao\"},\"isDataAction\":true,\"name\":\"bmtqioq\",\"origin\":\"system\",\"properties\":{}},{\"display\":{\"description\":\"ufpo\",\"operation\":\"oizh\",\"provider\":\"rxybqsoq\",\"resource\":\"gkdmb\"},\"isDataAction\":true,\"name\":\"obcu\",\"origin\":\"user,system\",\"properties\":{}},{\"display\":{\"description\":\"t\",\"operation\":\"qjnqglhqgnufoooj\",\"provider\":\"ifsqesaagdfmg\",\"resource\":\"lhjxr\"},\"isDataAction\":false,\"name\":\"mrvktsizntoc\",\"origin\":\"system\",\"properties\":{}},{\"display\":{\"description\":\"psqucmpoyf\",\"operation\":\"fogknygjofjdde\",\"provider\":\"rd\",\"resource\":\"pewnw\"},\"isDataAction\":false,\"name\":\"jzyflu\",\"origin\":\"system\",\"properties\":{}}]}")
                .toObject(AvailableOperationsListResponse.class);
        Assertions.assertEquals("mhquvgjxp", model.nextLink());
        Assertions.assertEquals("ehmtzop", model.value().get(0).display().description());
        Assertions.assertEquals("phrupidgsybbejhp", model.value().get(0).display().operation());
        Assertions.assertEquals("ycm", model.value().get(0).display().provider());
        Assertions.assertEquals("ao", model.value().get(0).display().resource());
        Assertions.assertEquals(true, model.value().get(0).isDataAction());
        Assertions.assertEquals("bmtqioq", model.value().get(0).name());
        Assertions.assertEquals(OperationOrigin.SYSTEM, model.value().get(0).origin());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AvailableOperationsListResponse model =
            new AvailableOperationsListResponse()
                .withNextLink("mhquvgjxp")
                .withValue(
                    Arrays
                        .asList(
                            new AvailableOperationInner()
                                .withDisplay(
                                    new AvailableOperationDisplay()
                                        .withDescription("ehmtzop")
                                        .withOperation("phrupidgsybbejhp")
                                        .withProvider("ycm")
                                        .withResource("ao"))
                                .withIsDataAction(true)
                                .withName("bmtqioq")
                                .withOrigin(OperationOrigin.SYSTEM),
                            new AvailableOperationInner()
                                .withDisplay(
                                    new AvailableOperationDisplay()
                                        .withDescription("ufpo")
                                        .withOperation("oizh")
                                        .withProvider("rxybqsoq")
                                        .withResource("gkdmb"))
                                .withIsDataAction(true)
                                .withName("obcu")
                                .withOrigin(OperationOrigin.USER_SYSTEM),
                            new AvailableOperationInner()
                                .withDisplay(
                                    new AvailableOperationDisplay()
                                        .withDescription("t")
                                        .withOperation("qjnqglhqgnufoooj")
                                        .withProvider("ifsqesaagdfmg")
                                        .withResource("lhjxr"))
                                .withIsDataAction(false)
                                .withName("mrvktsizntoc")
                                .withOrigin(OperationOrigin.SYSTEM),
                            new AvailableOperationInner()
                                .withDisplay(
                                    new AvailableOperationDisplay()
                                        .withDescription("psqucmpoyf")
                                        .withOperation("fogknygjofjdde")
                                        .withProvider("rd")
                                        .withResource("pewnw"))
                                .withIsDataAction(false)
                                .withName("jzyflu")
                                .withOrigin(OperationOrigin.SYSTEM)));
        model = BinaryData.fromObject(model).toObject(AvailableOperationsListResponse.class);
        Assertions.assertEquals("mhquvgjxp", model.nextLink());
        Assertions.assertEquals("ehmtzop", model.value().get(0).display().description());
        Assertions.assertEquals("phrupidgsybbejhp", model.value().get(0).display().operation());
        Assertions.assertEquals("ycm", model.value().get(0).display().provider());
        Assertions.assertEquals("ao", model.value().get(0).display().resource());
        Assertions.assertEquals(true, model.value().get(0).isDataAction());
        Assertions.assertEquals("bmtqioq", model.value().get(0).name());
        Assertions.assertEquals(OperationOrigin.SYSTEM, model.value().get(0).origin());
    }
}
