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

package com.azure.resourcemanager.servicefabric.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.servicefabric.models.ServiceLoadMetricDescription;
import com.azure.resourcemanager.servicefabric.models.ServiceLoadMetricWeight;
import org.junit.jupiter.api.Assertions;

public final class ServiceLoadMetricDescriptionTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ServiceLoadMetricDescription model =
            BinaryData
                .fromString(
                    "{\"name\":\"yzvqt\",\"weight\":\"Zero\",\"primaryDefaultLoad\":1500004458,\"secondaryDefaultLoad\":908407782,\"defaultLoad\":1989438546}")
                .toObject(ServiceLoadMetricDescription.class);
        Assertions.assertEquals("yzvqt", model.name());
        Assertions.assertEquals(ServiceLoadMetricWeight.ZERO, model.weight());
        Assertions.assertEquals(1500004458, model.primaryDefaultLoad());
        Assertions.assertEquals(908407782, model.secondaryDefaultLoad());
        Assertions.assertEquals(1989438546, model.defaultLoad());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ServiceLoadMetricDescription model =
            new ServiceLoadMetricDescription()
                .withName("yzvqt")
                .withWeight(ServiceLoadMetricWeight.ZERO)
                .withPrimaryDefaultLoad(1500004458)
                .withSecondaryDefaultLoad(908407782)
                .withDefaultLoad(1989438546);
        model = BinaryData.fromObject(model).toObject(ServiceLoadMetricDescription.class);
        Assertions.assertEquals("yzvqt", model.name());
        Assertions.assertEquals(ServiceLoadMetricWeight.ZERO, model.weight());
        Assertions.assertEquals(1500004458, model.primaryDefaultLoad());
        Assertions.assertEquals(908407782, model.secondaryDefaultLoad());
        Assertions.assertEquals(1989438546, model.defaultLoad());
    }
}
