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

package com.azure.resourcemanager.kubernetesconfiguration.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.kubernetesconfiguration.fluent.models.ResourceProviderOperationInner;
import com.azure.resourcemanager.kubernetesconfiguration.models.ResourceProviderOperationDisplay;
import com.azure.resourcemanager.kubernetesconfiguration.models.ResourceProviderOperationList;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class ResourceProviderOperationListTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ResourceProviderOperationList model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"name\":\"ukgri\",\"display\":{\"provider\":\"zlfbxzpuzycispnq\",\"resource\":\"hmgkbrpyy\",\"operation\":\"ibnuqqkpik\",\"description\":\"rgvtqag\"},\"isDataAction\":false,\"origin\":\"nhijggmebfsi\"},{\"name\":\"butr\",\"display\":{\"provider\":\"na\",\"resource\":\"mhjrunmpxttdbhr\",\"operation\":\"l\",\"description\":\"kx\"},\"isDataAction\":true,\"origin\":\"pbh\"}],\"nextLink\":\"btkcxywnytnrsyn\"}")
                .toObject(ResourceProviderOperationList.class);
        Assertions.assertEquals("ukgri", model.value().get(0).name());
        Assertions.assertEquals("zlfbxzpuzycispnq", model.value().get(0).display().provider());
        Assertions.assertEquals("hmgkbrpyy", model.value().get(0).display().resource());
        Assertions.assertEquals("ibnuqqkpik", model.value().get(0).display().operation());
        Assertions.assertEquals("rgvtqag", model.value().get(0).display().description());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ResourceProviderOperationList model =
            new ResourceProviderOperationList()
                .withValue(
                    Arrays
                        .asList(
                            new ResourceProviderOperationInner()
                                .withName("ukgri")
                                .withDisplay(
                                    new ResourceProviderOperationDisplay()
                                        .withProvider("zlfbxzpuzycispnq")
                                        .withResource("hmgkbrpyy")
                                        .withOperation("ibnuqqkpik")
                                        .withDescription("rgvtqag")),
                            new ResourceProviderOperationInner()
                                .withName("butr")
                                .withDisplay(
                                    new ResourceProviderOperationDisplay()
                                        .withProvider("na")
                                        .withResource("mhjrunmpxttdbhr")
                                        .withOperation("l")
                                        .withDescription("kx"))));
        model = BinaryData.fromObject(model).toObject(ResourceProviderOperationList.class);
        Assertions.assertEquals("ukgri", model.value().get(0).name());
        Assertions.assertEquals("zlfbxzpuzycispnq", model.value().get(0).display().provider());
        Assertions.assertEquals("hmgkbrpyy", model.value().get(0).display().resource());
        Assertions.assertEquals("ibnuqqkpik", model.value().get(0).display().operation());
        Assertions.assertEquals("rgvtqag", model.value().get(0).display().description());
    }
}
