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

package com.azure.resourcemanager.vmwarecloudsimple.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.vmwarecloudsimple.fluent.models.UsageInner;
import com.azure.resourcemanager.vmwarecloudsimple.models.UsageCount;
import com.azure.resourcemanager.vmwarecloudsimple.models.UsageName;
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\":1515177914,\"limit\":619068132,\"name\":{\"localizedValue\":\"qvujzraehtwdwrf\",\"value\":\"wib\"},\"unit\":\"Bytes\"}")
                .toObject(UsageInner.class);
        Assertions.assertEquals(1515177914, model.currentValue());
        Assertions.assertEquals(619068132, model.limit());
        Assertions.assertEquals("qvujzraehtwdwrf", model.name().localizedValue());
        Assertions.assertEquals("wib", model.name().value());
        Assertions.assertEquals(UsageCount.BYTES, model.unit());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        UsageInner model =
            new UsageInner()
                .withCurrentValue(1515177914)
                .withLimit(619068132)
                .withName(new UsageName().withLocalizedValue("qvujzraehtwdwrf").withValue("wib"))
                .withUnit(UsageCount.BYTES);
        model = BinaryData.fromObject(model).toObject(UsageInner.class);
        Assertions.assertEquals(1515177914, model.currentValue());
        Assertions.assertEquals(619068132, model.limit());
        Assertions.assertEquals("qvujzraehtwdwrf", model.name().localizedValue());
        Assertions.assertEquals("wib", model.name().value());
        Assertions.assertEquals(UsageCount.BYTES, model.unit());
    }
}
