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

package com.azure.resourcemanager.azurestack.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.azurestack.fluent.models.CustomerSubscriptionInner;
import com.azure.resourcemanager.azurestack.models.CustomerSubscriptionList;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class CustomerSubscriptionListTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        CustomerSubscriptionList model =
            BinaryData
                .fromString(
                    "{\"nextLink\":\"ccsnhsjc\",\"value\":[{\"properties\":{\"tenantId\":\"kryhtnapczwlokj\"},\"etag\":\"mkkvnip\",\"id\":\"oxzjnchgejspod\",\"name\":\"ailzydehojwyahu\",\"type\":\"inpm\"},{\"properties\":{\"tenantId\":\"aqwi\"},\"etag\":\"sprozvcput\",\"id\":\"gjvw\",\"name\":\"fdatsc\",\"type\":\"dvpjhulsuuvmk\"}]}")
                .toObject(CustomerSubscriptionList.class);
        Assertions.assertEquals("ccsnhsjc", model.nextLink());
        Assertions.assertEquals("mkkvnip", model.value().get(0).etag());
        Assertions.assertEquals("kryhtnapczwlokj", model.value().get(0).tenantId());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        CustomerSubscriptionList model =
            new CustomerSubscriptionList()
                .withNextLink("ccsnhsjc")
                .withValue(
                    Arrays
                        .asList(
                            new CustomerSubscriptionInner().withEtag("mkkvnip").withTenantId("kryhtnapczwlokj"),
                            new CustomerSubscriptionInner().withEtag("sprozvcput").withTenantId("aqwi")));
        model = BinaryData.fromObject(model).toObject(CustomerSubscriptionList.class);
        Assertions.assertEquals("ccsnhsjc", model.nextLink());
        Assertions.assertEquals("mkkvnip", model.value().get(0).etag());
        Assertions.assertEquals("kryhtnapczwlokj", model.value().get(0).tenantId());
    }
}
