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

package com.azure.resourcemanager.kusto.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.kusto.fluent.models.OperationInner;
import com.azure.resourcemanager.kusto.models.OperationDisplay;
import com.azure.resourcemanager.kusto.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\":\"xrxxlep\",\"display\":{\"provider\":\"mxjezwlw\",\"operation\":\"xuqlcvydypat\",\"resource\":\"oa\",\"description\":\"kniod\"},\"origin\":\"oebwnujhemms\",\"properties\":\"datadkcrodt\"},{\"name\":\"nfwjlfltkacjvefk\",\"display\":{\"provider\":\"oakggkfpag\",\"operation\":\"wpu\",\"resource\":\"qblylsyxkqj\",\"description\":\"jervtia\"},\"origin\":\"sdszue\",\"properties\":\"datasbzkf\"}],\"nextLink\":\"eyvpnqicvinvkj\"}")
                .toObject(OperationListResult.class);
        Assertions.assertEquals("xrxxlep", model.value().get(0).name());
        Assertions.assertEquals("mxjezwlw", model.value().get(0).display().provider());
        Assertions.assertEquals("xuqlcvydypat", model.value().get(0).display().operation());
        Assertions.assertEquals("oa", model.value().get(0).display().resource());
        Assertions.assertEquals("kniod", model.value().get(0).display().description());
        Assertions.assertEquals("oebwnujhemms", model.value().get(0).origin());
        Assertions.assertEquals("eyvpnqicvinvkj", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OperationListResult model =
            new OperationListResult()
                .withValue(
                    Arrays
                        .asList(
                            new OperationInner()
                                .withName("xrxxlep")
                                .withDisplay(
                                    new OperationDisplay()
                                        .withProvider("mxjezwlw")
                                        .withOperation("xuqlcvydypat")
                                        .withResource("oa")
                                        .withDescription("kniod"))
                                .withOrigin("oebwnujhemms")
                                .withProperties("datadkcrodt"),
                            new OperationInner()
                                .withName("nfwjlfltkacjvefk")
                                .withDisplay(
                                    new OperationDisplay()
                                        .withProvider("oakggkfpag")
                                        .withOperation("wpu")
                                        .withResource("qblylsyxkqj")
                                        .withDescription("jervtia"))
                                .withOrigin("sdszue")
                                .withProperties("datasbzkf")))
                .withNextLink("eyvpnqicvinvkj");
        model = BinaryData.fromObject(model).toObject(OperationListResult.class);
        Assertions.assertEquals("xrxxlep", model.value().get(0).name());
        Assertions.assertEquals("mxjezwlw", model.value().get(0).display().provider());
        Assertions.assertEquals("xuqlcvydypat", model.value().get(0).display().operation());
        Assertions.assertEquals("oa", model.value().get(0).display().resource());
        Assertions.assertEquals("kniod", model.value().get(0).display().description());
        Assertions.assertEquals("oebwnujhemms", model.value().get(0).origin());
        Assertions.assertEquals("eyvpnqicvinvkj", model.nextLink());
    }
}
