// 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.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 CurrentUsagesBaseInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        CurrentUsagesBaseInner model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"usages\":{\"value\":304908421,\"usagesType\":\"Individual\"},\"unit\":\"gjxpybczmehmt\",\"name\":{\"value\":\"bsphrupidgsybbe\",\"localizedValue\":\"ph\"},\"resourceType\":\"cmsxaobhdxbm\",\"quotaPeriod\":\"ioq\",\"isQuotaApplicable\":false,\"properties\":\"datatbmufpo\"},\"id\":\"noi\",\"name\":\"hwlrx\",\"type\":\"bqsoqijg\"}")
                .toObject(CurrentUsagesBaseInner.class);
        Assertions.assertEquals(304908421, model.properties().usages().value());
        Assertions.assertEquals(UsagesTypes.INDIVIDUAL, model.properties().usages().usagesType());
        Assertions.assertEquals("bsphrupidgsybbe", model.properties().name().value());
        Assertions.assertEquals("cmsxaobhdxbm", model.properties().resourceType());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        CurrentUsagesBaseInner model =
            new CurrentUsagesBaseInner()
                .withProperties(
                    new UsagesProperties()
                        .withUsages(new UsagesObject().withValue(304908421).withUsagesType(UsagesTypes.INDIVIDUAL))
                        .withName(new ResourceName().withValue("bsphrupidgsybbe"))
                        .withResourceType("cmsxaobhdxbm")
                        .withProperties("datatbmufpo"));
        model = BinaryData.fromObject(model).toObject(CurrentUsagesBaseInner.class);
        Assertions.assertEquals(304908421, model.properties().usages().value());
        Assertions.assertEquals(UsagesTypes.INDIVIDUAL, model.properties().usages().usagesType());
        Assertions.assertEquals("bsphrupidgsybbe", model.properties().name().value());
        Assertions.assertEquals("cmsxaobhdxbm", model.properties().resourceType());
    }
}
