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

package com.azure.resourcemanager.recoveryservicesbackup.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.recoveryservicesbackup.models.HourlySchedule;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;

public final class HourlyScheduleTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        HourlySchedule model =
            BinaryData
                .fromString(
                    "{\"interval\":1907750437,\"scheduleWindowStartTime\":\"2021-09-04T14:52:10Z\",\"scheduleWindowDuration\":1075307971}")
                .toObject(HourlySchedule.class);
        Assertions.assertEquals(1907750437, model.interval());
        Assertions.assertEquals(OffsetDateTime.parse("2021-09-04T14:52:10Z"), model.scheduleWindowStartTime());
        Assertions.assertEquals(1075307971, model.scheduleWindowDuration());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        HourlySchedule model =
            new HourlySchedule()
                .withInterval(1907750437)
                .withScheduleWindowStartTime(OffsetDateTime.parse("2021-09-04T14:52:10Z"))
                .withScheduleWindowDuration(1075307971);
        model = BinaryData.fromObject(model).toObject(HourlySchedule.class);
        Assertions.assertEquals(1907750437, model.interval());
        Assertions.assertEquals(OffsetDateTime.parse("2021-09-04T14:52:10Z"), model.scheduleWindowStartTime());
        Assertions.assertEquals(1075307971, model.scheduleWindowDuration());
    }
}
