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

package com.azure.resourcemanager.reservations.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.reservations.models.QuotaProperties;
import com.azure.resourcemanager.reservations.models.ResourceName;
import com.azure.resourcemanager.reservations.models.ResourceType;
import org.junit.jupiter.api.Assertions;

public final class QuotaPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        QuotaProperties model =
            BinaryData
                .fromString(
                    "{\"limit\":671328296,\"currentValue\":1223269261,\"unit\":\"uiizynke\",\"name\":{\"value\":\"trwyhqmib\",\"localizedValue\":\"hwit\"},\"resourceType\":\"lowPriority\",\"quotaPeriod\":\"yynpcdpumnzgmwz\",\"properties\":\"dataabikns\"}")
                .toObject(QuotaProperties.class);
        Assertions.assertEquals(671328296, model.limit());
        Assertions.assertEquals("uiizynke", model.unit());
        Assertions.assertEquals("trwyhqmib", model.name().value());
        Assertions.assertEquals(ResourceType.LOW_PRIORITY, model.resourceType());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        QuotaProperties model =
            new QuotaProperties()
                .withLimit(671328296)
                .withUnit("uiizynke")
                .withName(new ResourceName().withValue("trwyhqmib"))
                .withResourceType(ResourceType.LOW_PRIORITY)
                .withProperties("dataabikns");
        model = BinaryData.fromObject(model).toObject(QuotaProperties.class);
        Assertions.assertEquals(671328296, model.limit());
        Assertions.assertEquals("uiizynke", model.unit());
        Assertions.assertEquals("trwyhqmib", model.name().value());
        Assertions.assertEquals(ResourceType.LOW_PRIORITY, model.resourceType());
    }
}
