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

package com.azure.resourcemanager.datadog.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.datadog.fluent.models.MonitoredResourceInner;
import com.azure.resourcemanager.datadog.models.MonitoredResourceListResponse;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class MonitoredResourceListResponseTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        MonitoredResourceListResponse model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"id\":\"qqedqytbciqfou\",\"sendingMetrics\":true,\"reasonForMetricsStatus\":\"nkzsmodmglou\",\"sendingLogs\":false,\"reasonForLogsStatus\":\"wtmutduq\"},{\"id\":\"ap\",\"sendingMetrics\":false,\"reasonForMetricsStatus\":\"cuertu\",\"sendingLogs\":true,\"reasonForLogsStatus\":\"svqwhbmdgbbjfd\"},{\"id\":\"mbmbexppbh\",\"sendingMetrics\":false,\"reasonForMetricsStatus\":\"ol\",\"sendingLogs\":true,\"reasonForLogsStatus\":\"s\"},{\"id\":\"gbquxigj\",\"sendingMetrics\":true,\"reasonForMetricsStatus\":\"jaoyfhrtx\",\"sendingLogs\":false,\"reasonForLogsStatus\":\"rkujy\"}],\"nextLink\":\"l\"}")
                .toObject(MonitoredResourceListResponse.class);
        Assertions.assertEquals("qqedqytbciqfou", model.value().get(0).id());
        Assertions.assertEquals(true, model.value().get(0).sendingMetrics());
        Assertions.assertEquals("nkzsmodmglou", model.value().get(0).reasonForMetricsStatus());
        Assertions.assertEquals(false, model.value().get(0).sendingLogs());
        Assertions.assertEquals("wtmutduq", model.value().get(0).reasonForLogsStatus());
        Assertions.assertEquals("l", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        MonitoredResourceListResponse model =
            new MonitoredResourceListResponse()
                .withValue(
                    Arrays
                        .asList(
                            new MonitoredResourceInner()
                                .withId("qqedqytbciqfou")
                                .withSendingMetrics(true)
                                .withReasonForMetricsStatus("nkzsmodmglou")
                                .withSendingLogs(false)
                                .withReasonForLogsStatus("wtmutduq"),
                            new MonitoredResourceInner()
                                .withId("ap")
                                .withSendingMetrics(false)
                                .withReasonForMetricsStatus("cuertu")
                                .withSendingLogs(true)
                                .withReasonForLogsStatus("svqwhbmdgbbjfd"),
                            new MonitoredResourceInner()
                                .withId("mbmbexppbh")
                                .withSendingMetrics(false)
                                .withReasonForMetricsStatus("ol")
                                .withSendingLogs(true)
                                .withReasonForLogsStatus("s"),
                            new MonitoredResourceInner()
                                .withId("gbquxigj")
                                .withSendingMetrics(true)
                                .withReasonForMetricsStatus("jaoyfhrtx")
                                .withSendingLogs(false)
                                .withReasonForLogsStatus("rkujy")))
                .withNextLink("l");
        model = BinaryData.fromObject(model).toObject(MonitoredResourceListResponse.class);
        Assertions.assertEquals("qqedqytbciqfou", model.value().get(0).id());
        Assertions.assertEquals(true, model.value().get(0).sendingMetrics());
        Assertions.assertEquals("nkzsmodmglou", model.value().get(0).reasonForMetricsStatus());
        Assertions.assertEquals(false, model.value().get(0).sendingLogs());
        Assertions.assertEquals("wtmutduq", model.value().get(0).reasonForLogsStatus());
        Assertions.assertEquals("l", model.nextLink());
    }
}
