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

package com.azure.resourcemanager.signalr.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.signalr.fluent.models.OperationInner;
import com.azure.resourcemanager.signalr.models.OperationDisplay;
import com.azure.resourcemanager.signalr.models.OperationProperties;
import com.azure.resourcemanager.signalr.models.ServiceSpecification;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class OperationInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        OperationInner model =
            BinaryData
                .fromString(
                    "{\"name\":\"rh\",\"isDataAction\":true,\"display\":{\"provider\":\"hs\",\"resource\":\"urkdtmlx\",\"operation\":\"kuksjtxukcdm\",\"description\":\"rcryuanzwuxzdxta\"},\"origin\":\"lhmwhfpmrqobm\",\"properties\":{\"serviceSpecification\":{\"metricSpecifications\":[],\"logSpecifications\":[]}}}")
                .toObject(OperationInner.class);
        Assertions.assertEquals("rh", model.name());
        Assertions.assertEquals(true, model.isDataAction());
        Assertions.assertEquals("hs", model.display().provider());
        Assertions.assertEquals("urkdtmlx", model.display().resource());
        Assertions.assertEquals("kuksjtxukcdm", model.display().operation());
        Assertions.assertEquals("rcryuanzwuxzdxta", model.display().description());
        Assertions.assertEquals("lhmwhfpmrqobm", model.origin());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OperationInner model =
            new OperationInner()
                .withName("rh")
                .withIsDataAction(true)
                .withDisplay(
                    new OperationDisplay()
                        .withProvider("hs")
                        .withResource("urkdtmlx")
                        .withOperation("kuksjtxukcdm")
                        .withDescription("rcryuanzwuxzdxta"))
                .withOrigin("lhmwhfpmrqobm")
                .withProperties(
                    new OperationProperties()
                        .withServiceSpecification(
                            new ServiceSpecification()
                                .withMetricSpecifications(Arrays.asList())
                                .withLogSpecifications(Arrays.asList())));
        model = BinaryData.fromObject(model).toObject(OperationInner.class);
        Assertions.assertEquals("rh", model.name());
        Assertions.assertEquals(true, model.isDataAction());
        Assertions.assertEquals("hs", model.display().provider());
        Assertions.assertEquals("urkdtmlx", model.display().resource());
        Assertions.assertEquals("kuksjtxukcdm", model.display().operation());
        Assertions.assertEquals("rcryuanzwuxzdxta", model.display().description());
        Assertions.assertEquals("lhmwhfpmrqobm", model.origin());
    }
}
