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

package com.azure.resourcemanager.devspaces.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.devspaces.fluent.models.ResourceProviderOperationDefinitionInner;
import com.azure.resourcemanager.devspaces.models.ResourceProviderOperationDisplay;
import com.azure.resourcemanager.devspaces.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\":\"idgsybbe\",\"display\":{\"provider\":\"hoycm\",\"resource\":\"ao\",\"operation\":\"dxbmtqioq\",\"description\":\"ehtbm\"}}],\"nextLink\":\"p\"}")
                .toObject(ResourceProviderOperationList.class);
        Assertions.assertEquals("idgsybbe", model.value().get(0).name());
        Assertions.assertEquals("hoycm", model.value().get(0).display().provider());
        Assertions.assertEquals("ao", model.value().get(0).display().resource());
        Assertions.assertEquals("dxbmtqioq", model.value().get(0).display().operation());
        Assertions.assertEquals("ehtbm", model.value().get(0).display().description());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ResourceProviderOperationList model =
            new ResourceProviderOperationList()
                .withValue(
                    Arrays
                        .asList(
                            new ResourceProviderOperationDefinitionInner()
                                .withName("idgsybbe")
                                .withDisplay(
                                    new ResourceProviderOperationDisplay()
                                        .withProvider("hoycm")
                                        .withResource("ao")
                                        .withOperation("dxbmtqioq")
                                        .withDescription("ehtbm"))));
        model = BinaryData.fromObject(model).toObject(ResourceProviderOperationList.class);
        Assertions.assertEquals("idgsybbe", model.value().get(0).name());
        Assertions.assertEquals("hoycm", model.value().get(0).display().provider());
        Assertions.assertEquals("ao", model.value().get(0).display().resource());
        Assertions.assertEquals("dxbmtqioq", model.value().get(0).display().operation());
        Assertions.assertEquals("ehtbm", model.value().get(0).display().description());
    }
}
