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

package com.azure.resourcemanager.resourcehealth.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.resourcehealth.fluent.models.OperationListResultInner;
import com.azure.resourcemanager.resourcehealth.models.Operation;
import com.azure.resourcemanager.resourcehealth.models.OperationDisplay;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class OperationListResultInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        OperationListResultInner model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"name\":\"dcuf\",\"display\":{\"provider\":\"rpymzidnsez\",\"resource\":\"tbzsgfyccs\",\"operation\":\"wmdwzjeiachboo\",\"description\":\"lnrosfqp\"}},{\"name\":\"ehzzvypyqrim\",\"display\":{\"provider\":\"pvswjdkirso\",\"resource\":\"qxhcrmn\",\"operation\":\"jtckwhdso\",\"description\":\"iy\"}},{\"name\":\"jxsqwpgrjbz\",\"display\":{\"provider\":\"cjxvsnbyxqab\",\"resource\":\"ocpcy\",\"operation\":\"urzafb\",\"description\":\"j\"}}]}")
                .toObject(OperationListResultInner.class);
        Assertions.assertEquals("dcuf", model.value().get(0).name());
        Assertions.assertEquals("rpymzidnsez", model.value().get(0).display().provider());
        Assertions.assertEquals("tbzsgfyccs", model.value().get(0).display().resource());
        Assertions.assertEquals("wmdwzjeiachboo", model.value().get(0).display().operation());
        Assertions.assertEquals("lnrosfqp", model.value().get(0).display().description());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OperationListResultInner model =
            new OperationListResultInner()
                .withValue(
                    Arrays
                        .asList(
                            new Operation()
                                .withName("dcuf")
                                .withDisplay(
                                    new OperationDisplay()
                                        .withProvider("rpymzidnsez")
                                        .withResource("tbzsgfyccs")
                                        .withOperation("wmdwzjeiachboo")
                                        .withDescription("lnrosfqp")),
                            new Operation()
                                .withName("ehzzvypyqrim")
                                .withDisplay(
                                    new OperationDisplay()
                                        .withProvider("pvswjdkirso")
                                        .withResource("qxhcrmn")
                                        .withOperation("jtckwhdso")
                                        .withDescription("iy")),
                            new Operation()
                                .withName("jxsqwpgrjbz")
                                .withDisplay(
                                    new OperationDisplay()
                                        .withProvider("cjxvsnbyxqab")
                                        .withResource("ocpcy")
                                        .withOperation("urzafb")
                                        .withDescription("j"))));
        model = BinaryData.fromObject(model).toObject(OperationListResultInner.class);
        Assertions.assertEquals("dcuf", model.value().get(0).name());
        Assertions.assertEquals("rpymzidnsez", model.value().get(0).display().provider());
        Assertions.assertEquals("tbzsgfyccs", model.value().get(0).display().resource());
        Assertions.assertEquals("wmdwzjeiachboo", model.value().get(0).display().operation());
        Assertions.assertEquals("lnrosfqp", model.value().get(0).display().description());
    }
}
