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

package com.azure.resourcemanager.subscription.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.subscription.fluent.models.OperationListResultInner;
import com.azure.resourcemanager.subscription.models.Operation;
import com.azure.resourcemanager.subscription.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\":\"gibma\",\"display\":{\"provider\":\"keqsrxybzqqedq\",\"resource\":\"bciqfouflm\",\"operation\":\"kzsmodm\"}},{\"name\":\"ougpbkwt\",\"display\":{\"provider\":\"duqkt\",\"resource\":\"spwgcuertumkdosv\",\"operation\":\"hbmdgbbjfdd\"}}],\"nextLink\":\"bmbexppbhtqqro\"}")
                .toObject(OperationListResultInner.class);
        Assertions.assertEquals("gibma", model.value().get(0).name());
        Assertions.assertEquals("keqsrxybzqqedq", model.value().get(0).display().provider());
        Assertions.assertEquals("bciqfouflm", model.value().get(0).display().resource());
        Assertions.assertEquals("kzsmodm", model.value().get(0).display().operation());
        Assertions.assertEquals("bmbexppbhtqqro", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OperationListResultInner model =
            new OperationListResultInner()
                .withValue(
                    Arrays
                        .asList(
                            new Operation()
                                .withName("gibma")
                                .withDisplay(
                                    new OperationDisplay()
                                        .withProvider("keqsrxybzqqedq")
                                        .withResource("bciqfouflm")
                                        .withOperation("kzsmodm")),
                            new Operation()
                                .withName("ougpbkwt")
                                .withDisplay(
                                    new OperationDisplay()
                                        .withProvider("duqkt")
                                        .withResource("spwgcuertumkdosv")
                                        .withOperation("hbmdgbbjfdd"))))
                .withNextLink("bmbexppbhtqqro");
        model = BinaryData.fromObject(model).toObject(OperationListResultInner.class);
        Assertions.assertEquals("gibma", model.value().get(0).name());
        Assertions.assertEquals("keqsrxybzqqedq", model.value().get(0).display().provider());
        Assertions.assertEquals("bciqfouflm", model.value().get(0).display().resource());
        Assertions.assertEquals("kzsmodm", model.value().get(0).display().operation());
        Assertions.assertEquals("bmbexppbhtqqro", model.nextLink());
    }
}
