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

package com.azure.resourcemanager.datamigration.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.datamigration.fluent.models.ServiceOperationInner;
import com.azure.resourcemanager.datamigration.models.ServiceOperationDisplay;
import com.azure.resourcemanager.datamigration.models.ServiceOperationList;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class ServiceOperationListTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ServiceOperationList model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"name\":\"kanyktzlcuiywg\",\"display\":{\"provider\":\"gndrvynh\",\"resource\":\"pphrcgynco\",\"operation\":\"ecfvmm\",\"description\":\"ofsx\"}}],\"nextLink\":\"evgbmqjq\"}")
                .toObject(ServiceOperationList.class);
        Assertions.assertEquals("kanyktzlcuiywg", model.value().get(0).name());
        Assertions.assertEquals("gndrvynh", model.value().get(0).display().provider());
        Assertions.assertEquals("pphrcgynco", model.value().get(0).display().resource());
        Assertions.assertEquals("ecfvmm", model.value().get(0).display().operation());
        Assertions.assertEquals("ofsx", model.value().get(0).display().description());
        Assertions.assertEquals("evgbmqjq", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ServiceOperationList model =
            new ServiceOperationList()
                .withValue(
                    Arrays
                        .asList(
                            new ServiceOperationInner()
                                .withName("kanyktzlcuiywg")
                                .withDisplay(
                                    new ServiceOperationDisplay()
                                        .withProvider("gndrvynh")
                                        .withResource("pphrcgynco")
                                        .withOperation("ecfvmm")
                                        .withDescription("ofsx"))))
                .withNextLink("evgbmqjq");
        model = BinaryData.fromObject(model).toObject(ServiceOperationList.class);
        Assertions.assertEquals("kanyktzlcuiywg", model.value().get(0).name());
        Assertions.assertEquals("gndrvynh", model.value().get(0).display().provider());
        Assertions.assertEquals("pphrcgynco", model.value().get(0).display().resource());
        Assertions.assertEquals("ecfvmm", model.value().get(0).display().operation());
        Assertions.assertEquals("ofsx", model.value().get(0).display().description());
        Assertions.assertEquals("evgbmqjq", model.nextLink());
    }
}
