// 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.models.ResourceName;
import com.azure.resourcemanager.quota.models.UsagesObject;
import com.azure.resourcemanager.quota.models.UsagesProperties;
import com.azure.resourcemanager.quota.models.UsagesTypes;
import org.junit.jupiter.api.Assertions;

public final class UsagesPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        UsagesProperties model =
            BinaryData
                .fromString(
                    "{\"usages\":{\"value\":1715873571,\"usagesType\":\"Combined\"},\"unit\":\"zlobcufpd\",\"name\":{\"value\":\"btcqq\",\"localizedValue\":\"qglhq\"},\"resourceType\":\"ufo\",\"quotaPeriod\":\"jywif\",\"isQuotaApplicable\":false,\"properties\":\"dataaagdfmg\"}")
                .toObject(UsagesProperties.class);
        Assertions.assertEquals(1715873571, model.usages().value());
        Assertions.assertEquals(UsagesTypes.COMBINED, model.usages().usagesType());
        Assertions.assertEquals("btcqq", model.name().value());
        Assertions.assertEquals("ufo", model.resourceType());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        UsagesProperties model =
            new UsagesProperties()
                .withUsages(new UsagesObject().withValue(1715873571).withUsagesType(UsagesTypes.COMBINED))
                .withName(new ResourceName().withValue("btcqq"))
                .withResourceType("ufo")
                .withProperties("dataaagdfmg");
        model = BinaryData.fromObject(model).toObject(UsagesProperties.class);
        Assertions.assertEquals(1715873571, model.usages().value());
        Assertions.assertEquals(UsagesTypes.COMBINED, model.usages().usagesType());
        Assertions.assertEquals("btcqq", model.name().value());
        Assertions.assertEquals("ufo", model.resourceType());
    }
}
