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

package com.azure.resourcemanager.sqlvirtualmachine.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.sqlvirtualmachine.models.AssessmentDayOfWeek;
import com.azure.resourcemanager.sqlvirtualmachine.models.AssessmentSettings;
import com.azure.resourcemanager.sqlvirtualmachine.models.Schedule;
import org.junit.jupiter.api.Assertions;

public final class AssessmentSettingsTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AssessmentSettings model =
            BinaryData
                .fromString(
                    "{\"enable\":true,\"runImmediately\":true,\"schedule\":{\"enable\":false,\"weeklyInterval\":972559338,\"monthlyOccurrence\":364064517,\"dayOfWeek\":\"Saturday\",\"startTime\":\"auu\"}}")
                .toObject(AssessmentSettings.class);
        Assertions.assertEquals(true, model.enable());
        Assertions.assertEquals(true, model.runImmediately());
        Assertions.assertEquals(false, model.schedule().enable());
        Assertions.assertEquals(972559338, model.schedule().weeklyInterval());
        Assertions.assertEquals(364064517, model.schedule().monthlyOccurrence());
        Assertions.assertEquals(AssessmentDayOfWeek.SATURDAY, model.schedule().dayOfWeek());
        Assertions.assertEquals("auu", model.schedule().startTime());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AssessmentSettings model =
            new AssessmentSettings()
                .withEnable(true)
                .withRunImmediately(true)
                .withSchedule(
                    new Schedule()
                        .withEnable(false)
                        .withWeeklyInterval(972559338)
                        .withMonthlyOccurrence(364064517)
                        .withDayOfWeek(AssessmentDayOfWeek.SATURDAY)
                        .withStartTime("auu"));
        model = BinaryData.fromObject(model).toObject(AssessmentSettings.class);
        Assertions.assertEquals(true, model.enable());
        Assertions.assertEquals(true, model.runImmediately());
        Assertions.assertEquals(false, model.schedule().enable());
        Assertions.assertEquals(972559338, model.schedule().weeklyInterval());
        Assertions.assertEquals(364064517, model.schedule().monthlyOccurrence());
        Assertions.assertEquals(AssessmentDayOfWeek.SATURDAY, model.schedule().dayOfWeek());
        Assertions.assertEquals("auu", model.schedule().startTime());
    }
}
