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

package com.azure.resourcemanager.mediaservices.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.mediaservices.fluent.models.OperationCollectionInner;
import com.azure.resourcemanager.mediaservices.models.ActionType;
import com.azure.resourcemanager.mediaservices.models.Operation;
import com.azure.resourcemanager.mediaservices.models.OperationDisplay;
import com.azure.resourcemanager.mediaservices.models.Properties;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class OperationCollectionInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        OperationCollectionInner model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"name\":\"tmlxhekuksjtx\",\"display\":{\"provider\":\"dmpa\",\"resource\":\"ryuanzwuxzdxtay\",\"operation\":\"hmwhfpmrqo\",\"description\":\"tu\"},\"origin\":\"nryrtihf\",\"properties\":{},\"isDataAction\":false,\"actionType\":\"Internal\"},{\"name\":\"vg\",\"display\":{\"provider\":\"symglzufcyz\",\"resource\":\"hdbihan\",\"operation\":\"hfcbjysa\",\"description\":\"th\"},\"origin\":\"hab\",\"properties\":{},\"isDataAction\":true,\"actionType\":\"Internal\"},{\"name\":\"czbysc\",\"display\":{\"provider\":\"x\",\"resource\":\"ivyqniwbybrkxvd\",\"operation\":\"jgrtfwvukxga\",\"description\":\"ccsnhsjc\"},\"origin\":\"ejhkry\",\"properties\":{},\"isDataAction\":false,\"actionType\":\"Internal\"},{\"name\":\"wlokjyem\",\"display\":{\"provider\":\"ni\",\"resource\":\"oxzjnchgejspod\",\"operation\":\"ilzyd\",\"description\":\"o\"},\"origin\":\"yahux\",\"properties\":{},\"isDataAction\":false,\"actionType\":\"Internal\"}]}")
                .toObject(OperationCollectionInner.class);
        Assertions.assertEquals("tmlxhekuksjtx", model.value().get(0).name());
        Assertions.assertEquals("dmpa", model.value().get(0).display().provider());
        Assertions.assertEquals("ryuanzwuxzdxtay", model.value().get(0).display().resource());
        Assertions.assertEquals("hmwhfpmrqo", model.value().get(0).display().operation());
        Assertions.assertEquals("tu", model.value().get(0).display().description());
        Assertions.assertEquals("nryrtihf", model.value().get(0).origin());
        Assertions.assertEquals(false, model.value().get(0).isDataAction());
        Assertions.assertEquals(ActionType.INTERNAL, model.value().get(0).actionType());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OperationCollectionInner model =
            new OperationCollectionInner()
                .withValue(
                    Arrays
                        .asList(
                            new Operation()
                                .withName("tmlxhekuksjtx")
                                .withDisplay(
                                    new OperationDisplay()
                                        .withProvider("dmpa")
                                        .withResource("ryuanzwuxzdxtay")
                                        .withOperation("hmwhfpmrqo")
                                        .withDescription("tu"))
                                .withOrigin("nryrtihf")
                                .withProperties(new Properties())
                                .withIsDataAction(false)
                                .withActionType(ActionType.INTERNAL),
                            new Operation()
                                .withName("vg")
                                .withDisplay(
                                    new OperationDisplay()
                                        .withProvider("symglzufcyz")
                                        .withResource("hdbihan")
                                        .withOperation("hfcbjysa")
                                        .withDescription("th"))
                                .withOrigin("hab")
                                .withProperties(new Properties())
                                .withIsDataAction(true)
                                .withActionType(ActionType.INTERNAL),
                            new Operation()
                                .withName("czbysc")
                                .withDisplay(
                                    new OperationDisplay()
                                        .withProvider("x")
                                        .withResource("ivyqniwbybrkxvd")
                                        .withOperation("jgrtfwvukxga")
                                        .withDescription("ccsnhsjc"))
                                .withOrigin("ejhkry")
                                .withProperties(new Properties())
                                .withIsDataAction(false)
                                .withActionType(ActionType.INTERNAL),
                            new Operation()
                                .withName("wlokjyem")
                                .withDisplay(
                                    new OperationDisplay()
                                        .withProvider("ni")
                                        .withResource("oxzjnchgejspod")
                                        .withOperation("ilzyd")
                                        .withDescription("o"))
                                .withOrigin("yahux")
                                .withProperties(new Properties())
                                .withIsDataAction(false)
                                .withActionType(ActionType.INTERNAL)));
        model = BinaryData.fromObject(model).toObject(OperationCollectionInner.class);
        Assertions.assertEquals("tmlxhekuksjtx", model.value().get(0).name());
        Assertions.assertEquals("dmpa", model.value().get(0).display().provider());
        Assertions.assertEquals("ryuanzwuxzdxtay", model.value().get(0).display().resource());
        Assertions.assertEquals("hmwhfpmrqo", model.value().get(0).display().operation());
        Assertions.assertEquals("tu", model.value().get(0).display().description());
        Assertions.assertEquals("nryrtihf", model.value().get(0).origin());
        Assertions.assertEquals(false, model.value().get(0).isDataAction());
        Assertions.assertEquals(ActionType.INTERNAL, model.value().get(0).actionType());
    }
}
