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

package com.azure.resourcemanager.desktopvirtualization.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.desktopvirtualization.fluent.models.ResourceProviderOperationInner;
import com.azure.resourcemanager.desktopvirtualization.models.OperationProperties;
import com.azure.resourcemanager.desktopvirtualization.models.ResourceProviderOperationDisplay;
import com.azure.resourcemanager.desktopvirtualization.models.ServiceSpecification;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class ResourceProviderOperationInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ResourceProviderOperationInner model =
            BinaryData
                .fromString(
                    "{\"name\":\"jddeqsrdeupewnw\",\"display\":{\"provider\":\"tjzyflus\",\"resource\":\"hmofc\",\"operation\":\"smy\",\"description\":\"kdtmlxhekuk\"},\"isDataAction\":false,\"properties\":{\"serviceSpecification\":{\"logSpecifications\":[]}}}")
                .toObject(ResourceProviderOperationInner.class);
        Assertions.assertEquals("jddeqsrdeupewnw", model.name());
        Assertions.assertEquals("tjzyflus", model.display().provider());
        Assertions.assertEquals("hmofc", model.display().resource());
        Assertions.assertEquals("smy", model.display().operation());
        Assertions.assertEquals("kdtmlxhekuk", model.display().description());
        Assertions.assertEquals(false, model.isDataAction());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ResourceProviderOperationInner model =
            new ResourceProviderOperationInner()
                .withName("jddeqsrdeupewnw")
                .withDisplay(
                    new ResourceProviderOperationDisplay()
                        .withProvider("tjzyflus")
                        .withResource("hmofc")
                        .withOperation("smy")
                        .withDescription("kdtmlxhekuk"))
                .withIsDataAction(false)
                .withProperties(
                    new OperationProperties()
                        .withServiceSpecification(new ServiceSpecification().withLogSpecifications(Arrays.asList())));
        model = BinaryData.fromObject(model).toObject(ResourceProviderOperationInner.class);
        Assertions.assertEquals("jddeqsrdeupewnw", model.name());
        Assertions.assertEquals("tjzyflus", model.display().provider());
        Assertions.assertEquals("hmofc", model.display().resource());
        Assertions.assertEquals("smy", model.display().operation());
        Assertions.assertEquals("kdtmlxhekuk", model.display().description());
        Assertions.assertEquals(false, model.isDataAction());
    }
}
