// 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.models.Dimension;
import com.azure.resourcemanager.signalr.models.MetricSpecification;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class MetricSpecificationTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        MetricSpecification model =
            BinaryData
                .fromString(
                    "{\"name\":\"fpdvhpfxxypi\",\"displayName\":\"nmayhuybb\",\"displayDescription\":\"odepoogin\",\"unit\":\"amiheognarxz\",\"aggregationType\":\"heotusiv\",\"fillGapWithZero\":\"v\",\"category\":\"iqihn\",\"dimensions\":[{\"name\":\"bwjzr\",\"displayName\":\"ygxgispemvtz\",\"internalName\":\"ufubl\",\"toBeExportedForShoebox\":false},{\"name\":\"qeof\",\"displayName\":\"e\",\"internalName\":\"hqjbasvmsmj\",\"toBeExportedForShoebox\":true}]}")
                .toObject(MetricSpecification.class);
        Assertions.assertEquals("fpdvhpfxxypi", model.name());
        Assertions.assertEquals("nmayhuybb", model.displayName());
        Assertions.assertEquals("odepoogin", model.displayDescription());
        Assertions.assertEquals("amiheognarxz", model.unit());
        Assertions.assertEquals("heotusiv", model.aggregationType());
        Assertions.assertEquals("v", model.fillGapWithZero());
        Assertions.assertEquals("iqihn", model.category());
        Assertions.assertEquals("bwjzr", model.dimensions().get(0).name());
        Assertions.assertEquals("ygxgispemvtz", model.dimensions().get(0).displayName());
        Assertions.assertEquals("ufubl", model.dimensions().get(0).internalName());
        Assertions.assertEquals(false, model.dimensions().get(0).toBeExportedForShoebox());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        MetricSpecification model =
            new MetricSpecification()
                .withName("fpdvhpfxxypi")
                .withDisplayName("nmayhuybb")
                .withDisplayDescription("odepoogin")
                .withUnit("amiheognarxz")
                .withAggregationType("heotusiv")
                .withFillGapWithZero("v")
                .withCategory("iqihn")
                .withDimensions(
                    Arrays
                        .asList(
                            new Dimension()
                                .withName("bwjzr")
                                .withDisplayName("ygxgispemvtz")
                                .withInternalName("ufubl")
                                .withToBeExportedForShoebox(false),
                            new Dimension()
                                .withName("qeof")
                                .withDisplayName("e")
                                .withInternalName("hqjbasvmsmj")
                                .withToBeExportedForShoebox(true)));
        model = BinaryData.fromObject(model).toObject(MetricSpecification.class);
        Assertions.assertEquals("fpdvhpfxxypi", model.name());
        Assertions.assertEquals("nmayhuybb", model.displayName());
        Assertions.assertEquals("odepoogin", model.displayDescription());
        Assertions.assertEquals("amiheognarxz", model.unit());
        Assertions.assertEquals("heotusiv", model.aggregationType());
        Assertions.assertEquals("v", model.fillGapWithZero());
        Assertions.assertEquals("iqihn", model.category());
        Assertions.assertEquals("bwjzr", model.dimensions().get(0).name());
        Assertions.assertEquals("ygxgispemvtz", model.dimensions().get(0).displayName());
        Assertions.assertEquals("ufubl", model.dimensions().get(0).internalName());
        Assertions.assertEquals(false, model.dimensions().get(0).toBeExportedForShoebox());
    }
}
