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

package com.azure.resourcemanager.logz.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.logz.fluent.models.MonitoredResourceInner;
import com.azure.resourcemanager.logz.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\":\"quvgjxpybczme\",\"sendingMetrics\":true,\"reasonForMetricsStatus\":\"opb\",\"sendingLogs\":false,\"reasonForLogsStatus\":\"pidgsybbejhphoyc\"},{\"id\":\"xaobhdxbmtqioqjz\",\"sendingMetrics\":false,\"reasonForMetricsStatus\":\"muf\",\"sendingLogs\":false,\"reasonForLogsStatus\":\"izhwlrxy\"},{\"id\":\"soqijg\",\"sendingMetrics\":true,\"reasonForMetricsStatus\":\"pazlobcufpdz\",\"sendingLogs\":false,\"reasonForLogsStatus\":\"qqjnqgl\"}],\"nextLink\":\"gnufoooj\"}")
                .toObject(MonitoredResourceListResponse.class);
        Assertions.assertEquals("quvgjxpybczme", model.value().get(0).id());
        Assertions.assertEquals(true, model.value().get(0).sendingMetrics());
        Assertions.assertEquals("opb", model.value().get(0).reasonForMetricsStatus());
        Assertions.assertEquals(false, model.value().get(0).sendingLogs());
        Assertions.assertEquals("pidgsybbejhphoyc", model.value().get(0).reasonForLogsStatus());
        Assertions.assertEquals("gnufoooj", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        MonitoredResourceListResponse model =
            new MonitoredResourceListResponse()
                .withValue(
                    Arrays
                        .asList(
                            new MonitoredResourceInner()
                                .withId("quvgjxpybczme")
                                .withSendingMetrics(true)
                                .withReasonForMetricsStatus("opb")
                                .withSendingLogs(false)
                                .withReasonForLogsStatus("pidgsybbejhphoyc"),
                            new MonitoredResourceInner()
                                .withId("xaobhdxbmtqioqjz")
                                .withSendingMetrics(false)
                                .withReasonForMetricsStatus("muf")
                                .withSendingLogs(false)
                                .withReasonForLogsStatus("izhwlrxy"),
                            new MonitoredResourceInner()
                                .withId("soqijg")
                                .withSendingMetrics(true)
                                .withReasonForMetricsStatus("pazlobcufpdz")
                                .withSendingLogs(false)
                                .withReasonForLogsStatus("qqjnqgl")))
                .withNextLink("gnufoooj");
        model = BinaryData.fromObject(model).toObject(MonitoredResourceListResponse.class);
        Assertions.assertEquals("quvgjxpybczme", model.value().get(0).id());
        Assertions.assertEquals(true, model.value().get(0).sendingMetrics());
        Assertions.assertEquals("opb", model.value().get(0).reasonForMetricsStatus());
        Assertions.assertEquals(false, model.value().get(0).sendingLogs());
        Assertions.assertEquals("pidgsybbejhphoyc", model.value().get(0).reasonForLogsStatus());
        Assertions.assertEquals("gnufoooj", model.nextLink());
    }
}
