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

package com.azure.resourcemanager.recoveryservices.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.recoveryservices.fluent.models.ClientDiscoveryValueForSingleApiInner;
import com.azure.resourcemanager.recoveryservices.models.ClientDiscoveryDisplay;
import com.azure.resourcemanager.recoveryservices.models.ClientDiscoveryForProperties;
import com.azure.resourcemanager.recoveryservices.models.ClientDiscoveryResponse;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class ClientDiscoveryResponseTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ClientDiscoveryResponse model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"name\":\"dcsi\",\"display\":{\"provider\":\"naamde\",\"resource\":\"eh\",\"operation\":\"qsc\",\"description\":\"ypvhezrkg\"},\"origin\":\"c\",\"properties\":{}},{\"name\":\"o\",\"display\":{\"provider\":\"kqsleyyvxy\",\"resource\":\"pkc\",\"operation\":\"tpngjcrcczsqpjh\",\"description\":\"daj\"},\"origin\":\"ysou\",\"properties\":{}},{\"name\":\"a\",\"display\":{\"provider\":\"eupfhyhltrpm\",\"resource\":\"jmcmatuokthfu\",\"operation\":\"aodsfcpkv\",\"description\":\"dpuozmyz\"},\"origin\":\"agfuaxbezyiu\",\"properties\":{}}],\"nextLink\":\"whrdxwzywqsmbsu\"}")
                .toObject(ClientDiscoveryResponse.class);
        Assertions.assertEquals("dcsi", model.value().get(0).name());
        Assertions.assertEquals("naamde", model.value().get(0).display().provider());
        Assertions.assertEquals("eh", model.value().get(0).display().resource());
        Assertions.assertEquals("qsc", model.value().get(0).display().operation());
        Assertions.assertEquals("ypvhezrkg", model.value().get(0).display().description());
        Assertions.assertEquals("c", model.value().get(0).origin());
        Assertions.assertEquals("whrdxwzywqsmbsu", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ClientDiscoveryResponse model =
            new ClientDiscoveryResponse()
                .withValue(
                    Arrays
                        .asList(
                            new ClientDiscoveryValueForSingleApiInner()
                                .withName("dcsi")
                                .withDisplay(
                                    new ClientDiscoveryDisplay()
                                        .withProvider("naamde")
                                        .withResource("eh")
                                        .withOperation("qsc")
                                        .withDescription("ypvhezrkg"))
                                .withOrigin("c")
                                .withProperties(new ClientDiscoveryForProperties()),
                            new ClientDiscoveryValueForSingleApiInner()
                                .withName("o")
                                .withDisplay(
                                    new ClientDiscoveryDisplay()
                                        .withProvider("kqsleyyvxy")
                                        .withResource("pkc")
                                        .withOperation("tpngjcrcczsqpjh")
                                        .withDescription("daj"))
                                .withOrigin("ysou")
                                .withProperties(new ClientDiscoveryForProperties()),
                            new ClientDiscoveryValueForSingleApiInner()
                                .withName("a")
                                .withDisplay(
                                    new ClientDiscoveryDisplay()
                                        .withProvider("eupfhyhltrpm")
                                        .withResource("jmcmatuokthfu")
                                        .withOperation("aodsfcpkv")
                                        .withDescription("dpuozmyz"))
                                .withOrigin("agfuaxbezyiu")
                                .withProperties(new ClientDiscoveryForProperties())))
                .withNextLink("whrdxwzywqsmbsu");
        model = BinaryData.fromObject(model).toObject(ClientDiscoveryResponse.class);
        Assertions.assertEquals("dcsi", model.value().get(0).name());
        Assertions.assertEquals("naamde", model.value().get(0).display().provider());
        Assertions.assertEquals("eh", model.value().get(0).display().resource());
        Assertions.assertEquals("qsc", model.value().get(0).display().operation());
        Assertions.assertEquals("ypvhezrkg", model.value().get(0).display().description());
        Assertions.assertEquals("c", model.value().get(0).origin());
        Assertions.assertEquals("whrdxwzywqsmbsu", model.nextLink());
    }
}
