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

package com.azure.resourcemanager.datamigration.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.datamigration.fluent.models.ServiceOperationInner;
import com.azure.resourcemanager.datamigration.models.ServiceOperationDisplay;
import org.junit.jupiter.api.Assertions;

public final class ServiceOperationInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ServiceOperationInner model =
            BinaryData
                .fromString(
                    "{\"name\":\"c\",\"display\":{\"provider\":\"ivkwlzuvccfwnfnb\",\"resource\":\"fionl\",\"operation\":\"x\",\"description\":\"qgtz\"}}")
                .toObject(ServiceOperationInner.class);
        Assertions.assertEquals("c", model.name());
        Assertions.assertEquals("ivkwlzuvccfwnfnb", model.display().provider());
        Assertions.assertEquals("fionl", model.display().resource());
        Assertions.assertEquals("x", model.display().operation());
        Assertions.assertEquals("qgtz", model.display().description());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ServiceOperationInner model =
            new ServiceOperationInner()
                .withName("c")
                .withDisplay(
                    new ServiceOperationDisplay()
                        .withProvider("ivkwlzuvccfwnfnb")
                        .withResource("fionl")
                        .withOperation("x")
                        .withDescription("qgtz"));
        model = BinaryData.fromObject(model).toObject(ServiceOperationInner.class);
        Assertions.assertEquals("c", model.name());
        Assertions.assertEquals("ivkwlzuvccfwnfnb", model.display().provider());
        Assertions.assertEquals("fionl", model.display().resource());
        Assertions.assertEquals("x", model.display().operation());
        Assertions.assertEquals("qgtz", model.display().description());
    }
}
