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

package com.azure.resourcemanager.quota.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.quota.fluent.models.CurrentUsagesBaseInner;
import com.azure.resourcemanager.quota.models.UsagesLimits;
import com.azure.resourcemanager.quota.models.UsagesProperties;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class UsagesLimitsTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        UsagesLimits model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"unit\":\"qucmpo\",\"resourceType\":\"kfo\",\"quotaPeriod\":\"nygj\",\"isQuotaApplicable\":true,\"properties\":\"datadeqsrdeupewn\"},\"id\":\"reitjzyflusar\",\"name\":\"mofcq\",\"type\":\"smy\"},{\"properties\":{\"unit\":\"tmlxhekuksjtx\",\"resourceType\":\"dmpa\",\"quotaPeriod\":\"ryuanzwuxzdxtay\",\"isQuotaApplicable\":true,\"properties\":\"datawhfpmrqobmtu\"},\"id\":\"knryrtihfxtij\",\"name\":\"pzvgnwzsymglzufc\",\"type\":\"zk\"}],\"nextLink\":\"dbihanufhfcbj\"}")
                .toObject(UsagesLimits.class);
        Assertions.assertEquals("kfo", model.value().get(0).properties().resourceType());
        Assertions.assertEquals("dbihanufhfcbj", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        UsagesLimits model =
            new UsagesLimits()
                .withValue(
                    Arrays
                        .asList(
                            new CurrentUsagesBaseInner()
                                .withProperties(
                                    new UsagesProperties().withResourceType("kfo").withProperties("datadeqsrdeupewn")),
                            new CurrentUsagesBaseInner()
                                .withProperties(
                                    new UsagesProperties()
                                        .withResourceType("dmpa")
                                        .withProperties("datawhfpmrqobmtu"))))
                .withNextLink("dbihanufhfcbj");
        model = BinaryData.fromObject(model).toObject(UsagesLimits.class);
        Assertions.assertEquals("kfo", model.value().get(0).properties().resourceType());
        Assertions.assertEquals("dbihanufhfcbj", model.nextLink());
    }
}
