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

package com.azure.resourcemanager.signalr.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.signalr.fluent.models.SignalRUsageInner;
import com.azure.resourcemanager.signalr.models.SignalRUsageName;
import org.junit.jupiter.api.Assertions;

public final class SignalRUsageInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        SignalRUsageInner model =
            BinaryData
                .fromString(
                    "{\"id\":\"qktapspwgcuert\",\"currentValue\":7020809285560485144,\"limit\":6338655194328976084,\"name\":{\"value\":\"hbmdgbbjfdd\",\"localizedValue\":\"bmbexppbhtqqro\"},\"unit\":\"p\"}")
                .toObject(SignalRUsageInner.class);
        Assertions.assertEquals("qktapspwgcuert", model.id());
        Assertions.assertEquals(7020809285560485144L, model.currentValue());
        Assertions.assertEquals(6338655194328976084L, model.limit());
        Assertions.assertEquals("hbmdgbbjfdd", model.name().value());
        Assertions.assertEquals("bmbexppbhtqqro", model.name().localizedValue());
        Assertions.assertEquals("p", model.unit());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        SignalRUsageInner model =
            new SignalRUsageInner()
                .withId("qktapspwgcuert")
                .withCurrentValue(7020809285560485144L)
                .withLimit(6338655194328976084L)
                .withName(new SignalRUsageName().withValue("hbmdgbbjfdd").withLocalizedValue("bmbexppbhtqqro"))
                .withUnit("p");
        model = BinaryData.fromObject(model).toObject(SignalRUsageInner.class);
        Assertions.assertEquals("qktapspwgcuert", model.id());
        Assertions.assertEquals(7020809285560485144L, model.currentValue());
        Assertions.assertEquals(6338655194328976084L, model.limit());
        Assertions.assertEquals("hbmdgbbjfdd", model.name().value());
        Assertions.assertEquals("bmbexppbhtqqro", model.name().localizedValue());
        Assertions.assertEquals("p", model.unit());
    }
}
