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

package com.azure.resourcemanager.datadog.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.datadog.fluent.models.OperationResultInner;
import com.azure.resourcemanager.datadog.models.OperationDisplay;
import org.junit.jupiter.api.Assertions;

public final class OperationResultInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        OperationResultInner model =
            BinaryData
                .fromString(
                    "{\"name\":\"ocpcy\",\"display\":{\"provider\":\"rzafbljjgpbtoqcj\",\"resource\":\"ljavbqid\",\"operation\":\"ajzyul\",\"description\":\"u\"},\"isDataAction\":true}")
                .toObject(OperationResultInner.class);
        Assertions.assertEquals("ocpcy", model.name());
        Assertions.assertEquals("rzafbljjgpbtoqcj", model.display().provider());
        Assertions.assertEquals("ljavbqid", model.display().resource());
        Assertions.assertEquals("ajzyul", model.display().operation());
        Assertions.assertEquals("u", model.display().description());
        Assertions.assertEquals(true, model.isDataAction());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OperationResultInner model =
            new OperationResultInner()
                .withName("ocpcy")
                .withDisplay(
                    new OperationDisplay()
                        .withProvider("rzafbljjgpbtoqcj")
                        .withResource("ljavbqid")
                        .withOperation("ajzyul")
                        .withDescription("u"))
                .withIsDataAction(true);
        model = BinaryData.fromObject(model).toObject(OperationResultInner.class);
        Assertions.assertEquals("ocpcy", model.name());
        Assertions.assertEquals("rzafbljjgpbtoqcj", model.display().provider());
        Assertions.assertEquals("ljavbqid", model.display().resource());
        Assertions.assertEquals("ajzyul", model.display().operation());
        Assertions.assertEquals("u", model.display().description());
        Assertions.assertEquals(true, model.isDataAction());
    }
}
