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

package com.azure.resourcemanager.logz.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.logz.fluent.models.OperationResultInner;
import com.azure.resourcemanager.logz.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\":\"ijbpzvgnwzsymgl\",\"isDataAction\":true,\"display\":{\"provider\":\"zk\",\"resource\":\"dbihanufhfcbj\",\"operation\":\"a\",\"description\":\"th\"},\"origin\":\"hab\"}")
                .toObject(OperationResultInner.class);
        Assertions.assertEquals("ijbpzvgnwzsymgl", model.name());
        Assertions.assertEquals(true, model.isDataAction());
        Assertions.assertEquals("zk", model.display().provider());
        Assertions.assertEquals("dbihanufhfcbj", model.display().resource());
        Assertions.assertEquals("a", model.display().operation());
        Assertions.assertEquals("th", model.display().description());
        Assertions.assertEquals("hab", model.origin());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OperationResultInner model =
            new OperationResultInner()
                .withName("ijbpzvgnwzsymgl")
                .withIsDataAction(true)
                .withDisplay(
                    new OperationDisplay()
                        .withProvider("zk")
                        .withResource("dbihanufhfcbj")
                        .withOperation("a")
                        .withDescription("th"))
                .withOrigin("hab");
        model = BinaryData.fromObject(model).toObject(OperationResultInner.class);
        Assertions.assertEquals("ijbpzvgnwzsymgl", model.name());
        Assertions.assertEquals(true, model.isDataAction());
        Assertions.assertEquals("zk", model.display().provider());
        Assertions.assertEquals("dbihanufhfcbj", model.display().resource());
        Assertions.assertEquals("a", model.display().operation());
        Assertions.assertEquals("th", model.display().description());
        Assertions.assertEquals("hab", model.origin());
    }
}
