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

package com.azure.resourcemanager.datadog.generated;

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

public final class OperationListResultTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        OperationListResult model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"name\":\"uouq\",\"display\":{\"provider\":\"wzwbnguitn\",\"resource\":\"izgazxu\",\"operation\":\"zuckyfi\",\"description\":\"fidfvzw\"},\"isDataAction\":false},{\"name\":\"tymw\",\"display\":{\"provider\":\"kfthwxmntei\",\"resource\":\"opvkmijcm\",\"operation\":\"dcuf\",\"description\":\"srp\"},\"isDataAction\":true},{\"name\":\"dnsezcxtbzs\",\"display\":{\"provider\":\"c\",\"resource\":\"newmdwzjeiachbo\",\"operation\":\"flnrosfqpteehzz\",\"description\":\"pyqr\"},\"isDataAction\":false},{\"name\":\"npvswjdkirso\",\"display\":{\"provider\":\"xhcr\",\"resource\":\"ohjtckw\",\"operation\":\"soifiyipjxsqw\",\"description\":\"rjb\"},\"isDataAction\":true}],\"nextLink\":\"cjxvsnbyxqab\"}")
                .toObject(OperationListResult.class);
        Assertions.assertEquals("uouq", model.value().get(0).name());
        Assertions.assertEquals("wzwbnguitn", model.value().get(0).display().provider());
        Assertions.assertEquals("izgazxu", model.value().get(0).display().resource());
        Assertions.assertEquals("zuckyfi", model.value().get(0).display().operation());
        Assertions.assertEquals("fidfvzw", model.value().get(0).display().description());
        Assertions.assertEquals(false, model.value().get(0).isDataAction());
        Assertions.assertEquals("cjxvsnbyxqab", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OperationListResult model =
            new OperationListResult()
                .withValue(
                    Arrays
                        .asList(
                            new OperationResultInner()
                                .withName("uouq")
                                .withDisplay(
                                    new OperationDisplay()
                                        .withProvider("wzwbnguitn")
                                        .withResource("izgazxu")
                                        .withOperation("zuckyfi")
                                        .withDescription("fidfvzw"))
                                .withIsDataAction(false),
                            new OperationResultInner()
                                .withName("tymw")
                                .withDisplay(
                                    new OperationDisplay()
                                        .withProvider("kfthwxmntei")
                                        .withResource("opvkmijcm")
                                        .withOperation("dcuf")
                                        .withDescription("srp"))
                                .withIsDataAction(true),
                            new OperationResultInner()
                                .withName("dnsezcxtbzs")
                                .withDisplay(
                                    new OperationDisplay()
                                        .withProvider("c")
                                        .withResource("newmdwzjeiachbo")
                                        .withOperation("flnrosfqpteehzz")
                                        .withDescription("pyqr"))
                                .withIsDataAction(false),
                            new OperationResultInner()
                                .withName("npvswjdkirso")
                                .withDisplay(
                                    new OperationDisplay()
                                        .withProvider("xhcr")
                                        .withResource("ohjtckw")
                                        .withOperation("soifiyipjxsqw")
                                        .withDescription("rjb"))
                                .withIsDataAction(true)))
                .withNextLink("cjxvsnbyxqab");
        model = BinaryData.fromObject(model).toObject(OperationListResult.class);
        Assertions.assertEquals("uouq", model.value().get(0).name());
        Assertions.assertEquals("wzwbnguitn", model.value().get(0).display().provider());
        Assertions.assertEquals("izgazxu", model.value().get(0).display().resource());
        Assertions.assertEquals("zuckyfi", model.value().get(0).display().operation());
        Assertions.assertEquals("fidfvzw", model.value().get(0).display().description());
        Assertions.assertEquals(false, model.value().get(0).isDataAction());
        Assertions.assertEquals("cjxvsnbyxqab", model.nextLink());
    }
}
