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

package com.azure.resourcemanager.storagecache.generated;

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

public final class CacheUpgradeSettingsTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        CacheUpgradeSettings model =
            BinaryData
                .fromString("{\"upgradeScheduleEnabled\":true,\"scheduledTime\":\"2021-03-14T02:00:51Z\"}")
                .toObject(CacheUpgradeSettings.class);
        Assertions.assertEquals(true, model.upgradeScheduleEnabled());
        Assertions.assertEquals(OffsetDateTime.parse("2021-03-14T02:00:51Z"), model.scheduledTime());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        CacheUpgradeSettings model =
            new CacheUpgradeSettings()
                .withUpgradeScheduleEnabled(true)
                .withScheduledTime(OffsetDateTime.parse("2021-03-14T02:00:51Z"));
        model = BinaryData.fromObject(model).toObject(CacheUpgradeSettings.class);
        Assertions.assertEquals(true, model.upgradeScheduleEnabled());
        Assertions.assertEquals(OffsetDateTime.parse("2021-03-14T02:00:51Z"), model.scheduledTime());
    }
}
