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

package com.azure.resourcemanager.newrelicobservability.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.newrelicobservability.fluent.models.AppServiceInfoInner;
import com.azure.resourcemanager.newrelicobservability.models.AppServicesListResponse;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class AppServicesListResponseTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AppServicesListResponse model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"azureResourceId\":\"lbjnpgacftadehx\",\"agentVersion\":\"tyfsoppusuesn\",\"agentStatus\":\"dejbavo\"},{\"azureResourceId\":\"zdmohctbqvu\",\"agentVersion\":\"xdn\",\"agentStatus\":\"vo\"}],\"nextLink\":\"ujjugwdkcglh\"}")
                .toObject(AppServicesListResponse.class);
        Assertions.assertEquals("lbjnpgacftadehx", model.value().get(0).azureResourceId());
        Assertions.assertEquals("tyfsoppusuesn", model.value().get(0).agentVersion());
        Assertions.assertEquals("dejbavo", model.value().get(0).agentStatus());
        Assertions.assertEquals("ujjugwdkcglh", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AppServicesListResponse model =
            new AppServicesListResponse()
                .withValue(
                    Arrays
                        .asList(
                            new AppServiceInfoInner()
                                .withAzureResourceId("lbjnpgacftadehx")
                                .withAgentVersion("tyfsoppusuesn")
                                .withAgentStatus("dejbavo"),
                            new AppServiceInfoInner()
                                .withAzureResourceId("zdmohctbqvu")
                                .withAgentVersion("xdn")
                                .withAgentStatus("vo")))
                .withNextLink("ujjugwdkcglh");
        model = BinaryData.fromObject(model).toObject(AppServicesListResponse.class);
        Assertions.assertEquals("lbjnpgacftadehx", model.value().get(0).azureResourceId());
        Assertions.assertEquals("tyfsoppusuesn", model.value().get(0).agentVersion());
        Assertions.assertEquals("dejbavo", model.value().get(0).agentStatus());
        Assertions.assertEquals("ujjugwdkcglh", model.nextLink());
    }
}
