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

package com.azure.resourcemanager.hdinsight.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.hdinsight.models.AutoscaleSchedule;
import com.azure.resourcemanager.hdinsight.models.AutoscaleTimeAndCapacity;
import com.azure.resourcemanager.hdinsight.models.DaysOfWeek;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class AutoscaleScheduleTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AutoscaleSchedule model =
            BinaryData
                .fromString(
                    "{\"days\":[\"Monday\",\"Thursday\",\"Tuesday\",\"Sunday\"],\"timeAndCapacity\":{\"time\":\"czsqpjhvm\",\"minInstanceCount\":330627677,\"maxInstanceCount\":1964386727}}")
                .toObject(AutoscaleSchedule.class);
        Assertions.assertEquals(DaysOfWeek.MONDAY, model.days().get(0));
        Assertions.assertEquals("czsqpjhvm", model.timeAndCapacity().time());
        Assertions.assertEquals(330627677, model.timeAndCapacity().minInstanceCount());
        Assertions.assertEquals(1964386727, model.timeAndCapacity().maxInstanceCount());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AutoscaleSchedule model =
            new AutoscaleSchedule()
                .withDays(Arrays.asList(DaysOfWeek.MONDAY, DaysOfWeek.THURSDAY, DaysOfWeek.TUESDAY, DaysOfWeek.SUNDAY))
                .withTimeAndCapacity(
                    new AutoscaleTimeAndCapacity()
                        .withTime("czsqpjhvm")
                        .withMinInstanceCount(330627677)
                        .withMaxInstanceCount(1964386727));
        model = BinaryData.fromObject(model).toObject(AutoscaleSchedule.class);
        Assertions.assertEquals(DaysOfWeek.MONDAY, model.days().get(0));
        Assertions.assertEquals("czsqpjhvm", model.timeAndCapacity().time());
        Assertions.assertEquals(330627677, model.timeAndCapacity().minInstanceCount());
        Assertions.assertEquals(1964386727, model.timeAndCapacity().maxInstanceCount());
    }
}
