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

package com.azure.resourcemanager.loadtesting.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.loadtesting.fluent.models.QuotaBucketRequestProperties;
import com.azure.resourcemanager.loadtesting.models.QuotaBucketRequestPropertiesDimensions;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class QuotaBucketRequestPropertiesTests {
    @Test
    public void testDeserialize() throws Exception {
        QuotaBucketRequestProperties model =
            BinaryData
                .fromString(
                    "{\"currentUsage\":1708707643,\"currentQuota\":1146923499,\"newQuota\":409698731,\"dimensions\":{\"subscriptionId\":\"vwmf\",\"location\":\"t\"}}")
                .toObject(QuotaBucketRequestProperties.class);
        Assertions.assertEquals(1708707643, model.currentUsage());
        Assertions.assertEquals(1146923499, model.currentQuota());
        Assertions.assertEquals(409698731, model.newQuota());
        Assertions.assertEquals("vwmf", model.dimensions().subscriptionId());
        Assertions.assertEquals("t", model.dimensions().location());
    }

    @Test
    public void testSerialize() throws Exception {
        QuotaBucketRequestProperties model =
            new QuotaBucketRequestProperties()
                .withCurrentUsage(1708707643)
                .withCurrentQuota(1146923499)
                .withNewQuota(409698731)
                .withDimensions(
                    new QuotaBucketRequestPropertiesDimensions().withSubscriptionId("vwmf").withLocation("t"));
        model = BinaryData.fromObject(model).toObject(QuotaBucketRequestProperties.class);
        Assertions.assertEquals(1708707643, model.currentUsage());
        Assertions.assertEquals(1146923499, model.currentQuota());
        Assertions.assertEquals(409698731, model.newQuota());
        Assertions.assertEquals("vwmf", model.dimensions().subscriptionId());
        Assertions.assertEquals("t", model.dimensions().location());
    }
}
