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

package com.azure.resourcemanager.servicefabric.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.servicefabric.fluent.models.OperationResultInner;
import com.azure.resourcemanager.servicefabric.models.AvailableOperationDisplay;
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\":\"bdxkqpxokaj\",\"isDataAction\":false,\"display\":{\"provider\":\"mexgstxgcp\",\"resource\":\"gmaajrm\",\"operation\":\"jwzrl\",\"description\":\"mcl\"},\"origin\":\"ijcoejctb\",\"nextLink\":\"qsqsy\"}")
                .toObject(OperationResultInner.class);
        Assertions.assertEquals("bdxkqpxokaj", model.name());
        Assertions.assertEquals(false, model.isDataAction());
        Assertions.assertEquals("mexgstxgcp", model.display().provider());
        Assertions.assertEquals("gmaajrm", model.display().resource());
        Assertions.assertEquals("jwzrl", model.display().operation());
        Assertions.assertEquals("mcl", model.display().description());
        Assertions.assertEquals("ijcoejctb", model.origin());
        Assertions.assertEquals("qsqsy", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OperationResultInner model =
            new OperationResultInner()
                .withName("bdxkqpxokaj")
                .withIsDataAction(false)
                .withDisplay(
                    new AvailableOperationDisplay()
                        .withProvider("mexgstxgcp")
                        .withResource("gmaajrm")
                        .withOperation("jwzrl")
                        .withDescription("mcl"))
                .withOrigin("ijcoejctb")
                .withNextLink("qsqsy");
        model = BinaryData.fromObject(model).toObject(OperationResultInner.class);
        Assertions.assertEquals("bdxkqpxokaj", model.name());
        Assertions.assertEquals(false, model.isDataAction());
        Assertions.assertEquals("mexgstxgcp", model.display().provider());
        Assertions.assertEquals("gmaajrm", model.display().resource());
        Assertions.assertEquals("jwzrl", model.display().operation());
        Assertions.assertEquals("mcl", model.display().description());
        Assertions.assertEquals("ijcoejctb", model.origin());
        Assertions.assertEquals("qsqsy", model.nextLink());
    }
}
