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

package com.azure.resourcemanager.costmanagement.generated;

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

public final class ReportConfigTimePeriodTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ReportConfigTimePeriod model =
            BinaryData
                .fromString("{\"from\":\"2020-12-23T01:20:43Z\",\"to\":\"2021-08-05T18:12:20Z\"}")
                .toObject(ReportConfigTimePeriod.class);
        Assertions.assertEquals(OffsetDateTime.parse("2020-12-23T01:20:43Z"), model.from());
        Assertions.assertEquals(OffsetDateTime.parse("2021-08-05T18:12:20Z"), model.to());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ReportConfigTimePeriod model =
            new ReportConfigTimePeriod()
                .withFrom(OffsetDateTime.parse("2020-12-23T01:20:43Z"))
                .withTo(OffsetDateTime.parse("2021-08-05T18:12:20Z"));
        model = BinaryData.fromObject(model).toObject(ReportConfigTimePeriod.class);
        Assertions.assertEquals(OffsetDateTime.parse("2020-12-23T01:20:43Z"), model.from());
        Assertions.assertEquals(OffsetDateTime.parse("2021-08-05T18:12:20Z"), model.to());
    }
}
