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

package com.azure.resourcemanager.maintenance.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.maintenance.fluent.models.OperationInner;
import com.azure.resourcemanager.maintenance.models.OperationInfo;
import com.azure.resourcemanager.maintenance.models.OperationsListResult;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class OperationsListResultTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        OperationsListResult model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"name\":\"spwgcuertumkdosv\",\"display\":{\"provider\":\"bmdg\",\"resource\":\"jfddgmbmbe\",\"operation\":\"pbhtqqrolfpfpsa\",\"description\":\"bquxigjy\"},\"origin\":\"zjaoyfhrtxil\",\"properties\":\"datarkujy\",\"isDataAction\":false}]}")
                .toObject(OperationsListResult.class);
        Assertions.assertEquals("spwgcuertumkdosv", model.value().get(0).name());
        Assertions.assertEquals("bmdg", model.value().get(0).display().provider());
        Assertions.assertEquals("jfddgmbmbe", model.value().get(0).display().resource());
        Assertions.assertEquals("pbhtqqrolfpfpsa", model.value().get(0).display().operation());
        Assertions.assertEquals("bquxigjy", model.value().get(0).display().description());
        Assertions.assertEquals("zjaoyfhrtxil", model.value().get(0).origin());
        Assertions.assertEquals(false, model.value().get(0).isDataAction());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        OperationsListResult model =
            new OperationsListResult()
                .withValue(
                    Arrays
                        .asList(
                            new OperationInner()
                                .withName("spwgcuertumkdosv")
                                .withDisplay(
                                    new OperationInfo()
                                        .withProvider("bmdg")
                                        .withResource("jfddgmbmbe")
                                        .withOperation("pbhtqqrolfpfpsa")
                                        .withDescription("bquxigjy"))
                                .withOrigin("zjaoyfhrtxil")
                                .withProperties("datarkujy")
                                .withIsDataAction(false)));
        model = BinaryData.fromObject(model).toObject(OperationsListResult.class);
        Assertions.assertEquals("spwgcuertumkdosv", model.value().get(0).name());
        Assertions.assertEquals("bmdg", model.value().get(0).display().provider());
        Assertions.assertEquals("jfddgmbmbe", model.value().get(0).display().resource());
        Assertions.assertEquals("pbhtqqrolfpfpsa", model.value().get(0).display().operation());
        Assertions.assertEquals("bquxigjy", model.value().get(0).display().description());
        Assertions.assertEquals("zjaoyfhrtxil", model.value().get(0).origin());
        Assertions.assertEquals(false, model.value().get(0).isDataAction());
    }
}
