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

package com.azure.resourcemanager.storagepool.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.storagepool.fluent.models.StoragePoolRPOperationInner;
import com.azure.resourcemanager.storagepool.models.StoragePoolOperationDisplay;
import com.azure.resourcemanager.storagepool.models.StoragePoolOperationListResult;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class StoragePoolOperationListResultTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        StoragePoolOperationListResult model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"name\":\"mhquvgjxp\",\"isDataAction\":false,\"actionType\":\"zm\",\"display\":{\"provider\":\"hmtzopbsphrup\",\"resource\":\"dgs\",\"operation\":\"bb\",\"description\":\"jhphoyc\"},\"origin\":\"xaobhdxbmtqioqjz\"},{\"name\":\"htbmuf\",\"isDataAction\":false,\"actionType\":\"noi\",\"display\":{\"provider\":\"hwlrx\",\"resource\":\"bqsoqijg\",\"operation\":\"dmbpazlobcufpdz\",\"description\":\"rbt\"},\"origin\":\"qjnqglhqgnufoooj\"},{\"name\":\"wifsq\",\"isDataAction\":false,\"actionType\":\"agdfmglzlh\",\"display\":{\"provider\":\"xrifkwmrvkts\",\"resource\":\"zntocipaouajps\",\"operation\":\"ucmpoyfd\",\"description\":\"fogknygjofjdde\"},\"origin\":\"rd\"}],\"nextLink\":\"pewnw\"}")
                .toObject(StoragePoolOperationListResult.class);
        Assertions.assertEquals("mhquvgjxp", model.value().get(0).name());
        Assertions.assertEquals(false, model.value().get(0).isDataAction());
        Assertions.assertEquals("zm", model.value().get(0).actionType());
        Assertions.assertEquals("hmtzopbsphrup", model.value().get(0).display().provider());
        Assertions.assertEquals("dgs", model.value().get(0).display().resource());
        Assertions.assertEquals("bb", model.value().get(0).display().operation());
        Assertions.assertEquals("jhphoyc", model.value().get(0).display().description());
        Assertions.assertEquals("xaobhdxbmtqioqjz", model.value().get(0).origin());
        Assertions.assertEquals("pewnw", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        StoragePoolOperationListResult model =
            new StoragePoolOperationListResult()
                .withValue(
                    Arrays
                        .asList(
                            new StoragePoolRPOperationInner()
                                .withName("mhquvgjxp")
                                .withIsDataAction(false)
                                .withActionType("zm")
                                .withDisplay(
                                    new StoragePoolOperationDisplay()
                                        .withProvider("hmtzopbsphrup")
                                        .withResource("dgs")
                                        .withOperation("bb")
                                        .withDescription("jhphoyc"))
                                .withOrigin("xaobhdxbmtqioqjz"),
                            new StoragePoolRPOperationInner()
                                .withName("htbmuf")
                                .withIsDataAction(false)
                                .withActionType("noi")
                                .withDisplay(
                                    new StoragePoolOperationDisplay()
                                        .withProvider("hwlrx")
                                        .withResource("bqsoqijg")
                                        .withOperation("dmbpazlobcufpdz")
                                        .withDescription("rbt"))
                                .withOrigin("qjnqglhqgnufoooj"),
                            new StoragePoolRPOperationInner()
                                .withName("wifsq")
                                .withIsDataAction(false)
                                .withActionType("agdfmglzlh")
                                .withDisplay(
                                    new StoragePoolOperationDisplay()
                                        .withProvider("xrifkwmrvkts")
                                        .withResource("zntocipaouajps")
                                        .withOperation("ucmpoyfd")
                                        .withDescription("fogknygjofjdde"))
                                .withOrigin("rd")))
                .withNextLink("pewnw");
        model = BinaryData.fromObject(model).toObject(StoragePoolOperationListResult.class);
        Assertions.assertEquals("mhquvgjxp", model.value().get(0).name());
        Assertions.assertEquals(false, model.value().get(0).isDataAction());
        Assertions.assertEquals("zm", model.value().get(0).actionType());
        Assertions.assertEquals("hmtzopbsphrup", model.value().get(0).display().provider());
        Assertions.assertEquals("dgs", model.value().get(0).display().resource());
        Assertions.assertEquals("bb", model.value().get(0).display().operation());
        Assertions.assertEquals("jhphoyc", model.value().get(0).display().description());
        Assertions.assertEquals("xaobhdxbmtqioqjz", model.value().get(0).origin());
        Assertions.assertEquals("pewnw", model.nextLink());
    }
}
