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

package com.azure.resourcemanager.devcenter.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.devcenter.fluent.models.UsageInner;
import com.azure.resourcemanager.devcenter.models.UsageName;
import com.azure.resourcemanager.devcenter.models.UsageUnit;
import org.junit.jupiter.api.Assertions;

public final class UsageInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        UsageInner model =
            BinaryData
                .fromString(
                    "{\"currentValue\":15326288363695104,\"limit\":6522332661969979090,\"unit\":\"Count\",\"name\":{\"localizedValue\":\"pmutwuo\",\"value\":\"rpkhjwn\"}}")
                .toObject(UsageInner.class);
        Assertions.assertEquals(15326288363695104L, model.currentValue());
        Assertions.assertEquals(6522332661969979090L, model.limit());
        Assertions.assertEquals(UsageUnit.COUNT, model.unit());
        Assertions.assertEquals("pmutwuo", model.name().localizedValue());
        Assertions.assertEquals("rpkhjwn", model.name().value());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        UsageInner model =
            new UsageInner()
                .withCurrentValue(15326288363695104L)
                .withLimit(6522332661969979090L)
                .withUnit(UsageUnit.COUNT)
                .withName(new UsageName().withLocalizedValue("pmutwuo").withValue("rpkhjwn"));
        model = BinaryData.fromObject(model).toObject(UsageInner.class);
        Assertions.assertEquals(15326288363695104L, model.currentValue());
        Assertions.assertEquals(6522332661969979090L, model.limit());
        Assertions.assertEquals(UsageUnit.COUNT, model.unit());
        Assertions.assertEquals("pmutwuo", model.name().localizedValue());
        Assertions.assertEquals("rpkhjwn", model.name().value());
    }
}
