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

package com.azure.resourcemanager.vmwarecloudsimple.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.vmwarecloudsimple.fluent.models.AvailableOperationInner;
import com.azure.resourcemanager.vmwarecloudsimple.models.AvailableOperationDisplay;
import com.azure.resourcemanager.vmwarecloudsimple.models.AvailableOperationDisplayPropertyServiceSpecificationMetricsList;
import com.azure.resourcemanager.vmwarecloudsimple.models.OperationOrigin;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class AvailableOperationInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AvailableOperationInner model =
            BinaryData
                .fromString(
                    "{\"display\":{\"description\":\"cqhsm\",\"operation\":\"rkdtmlxh\",\"provider\":\"uksjtxukcdmp\",\"resource\":\"cryuan\"},\"isDataAction\":false,\"name\":\"zdxtayrlhmwhf\",\"origin\":\"user,system\",\"properties\":{\"serviceSpecification\":{\"metricSpecifications\":[]}}}")
                .toObject(AvailableOperationInner.class);
        Assertions.assertEquals("cqhsm", model.display().description());
        Assertions.assertEquals("rkdtmlxh", model.display().operation());
        Assertions.assertEquals("uksjtxukcdmp", model.display().provider());
        Assertions.assertEquals("cryuan", model.display().resource());
        Assertions.assertEquals(false, model.isDataAction());
        Assertions.assertEquals("zdxtayrlhmwhf", model.name());
        Assertions.assertEquals(OperationOrigin.USER_SYSTEM, model.origin());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AvailableOperationInner model =
            new AvailableOperationInner()
                .withDisplay(
                    new AvailableOperationDisplay()
                        .withDescription("cqhsm")
                        .withOperation("rkdtmlxh")
                        .withProvider("uksjtxukcdmp")
                        .withResource("cryuan"))
                .withIsDataAction(false)
                .withName("zdxtayrlhmwhf")
                .withOrigin(OperationOrigin.USER_SYSTEM)
                .withServiceSpecification(
                    new AvailableOperationDisplayPropertyServiceSpecificationMetricsList()
                        .withMetricSpecifications(Arrays.asList()));
        model = BinaryData.fromObject(model).toObject(AvailableOperationInner.class);
        Assertions.assertEquals("cqhsm", model.display().description());
        Assertions.assertEquals("rkdtmlxh", model.display().operation());
        Assertions.assertEquals("uksjtxukcdmp", model.display().provider());
        Assertions.assertEquals("cryuan", model.display().resource());
        Assertions.assertEquals(false, model.isDataAction());
        Assertions.assertEquals("zdxtayrlhmwhf", model.name());
        Assertions.assertEquals(OperationOrigin.USER_SYSTEM, model.origin());
    }
}
