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

package com.azure.resourcemanager.databoxedge.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.databoxedge.fluent.models.UpdateSummaryProperties;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;

public final class UpdateSummaryPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        UpdateSummaryProperties model =
            BinaryData
                .fromString(
                    "{\"deviceVersionNumber\":\"pvhelxprg\",\"friendlyDeviceVersionName\":\"atddc\",\"deviceLastScannedDateTime\":\"2021-09-13T16:27:08Z\",\"lastCompletedScanJobDateTime\":\"2021-12-04T18:39:42Z\",\"lastCompletedDownloadJobDateTime\":\"2021-07-29T04:12Z\",\"lastCompletedInstallJobDateTime\":\"2021-06-07T16:38:11Z\",\"totalNumberOfUpdatesAvailable\":1949252963,\"totalNumberOfUpdatesPendingDownload\":612337028,\"totalNumberOfUpdatesPendingInstall\":785036468,\"rebootBehavior\":\"RequiresReboot\",\"ongoingUpdateOperation\":\"None\",\"inProgressDownloadJobId\":\"xsdqrhzoymibmrqy\",\"inProgressInstallJobId\":\"ahwfluszdtmhrk\",\"inProgressDownloadJobStartedDateTime\":\"2021-06-28T13:04:58Z\",\"inProgressInstallJobStartedDateTime\":\"2021-08-13T05:08:08Z\",\"updateTitles\":[\"qacpiex\"],\"totalUpdateSizeInBytes\":8.60892322674246}")
                .toObject(UpdateSummaryProperties.class);
        Assertions.assertEquals("pvhelxprg", model.deviceVersionNumber());
        Assertions.assertEquals("atddc", model.friendlyDeviceVersionName());
        Assertions.assertEquals(OffsetDateTime.parse("2021-09-13T16:27:08Z"), model.deviceLastScannedDateTime());
        Assertions.assertEquals(OffsetDateTime.parse("2021-12-04T18:39:42Z"), model.lastCompletedScanJobDateTime());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        UpdateSummaryProperties model =
            new UpdateSummaryProperties()
                .withDeviceVersionNumber("pvhelxprg")
                .withFriendlyDeviceVersionName("atddc")
                .withDeviceLastScannedDateTime(OffsetDateTime.parse("2021-09-13T16:27:08Z"))
                .withLastCompletedScanJobDateTime(OffsetDateTime.parse("2021-12-04T18:39:42Z"));
        model = BinaryData.fromObject(model).toObject(UpdateSummaryProperties.class);
        Assertions.assertEquals("pvhelxprg", model.deviceVersionNumber());
        Assertions.assertEquals("atddc", model.friendlyDeviceVersionName());
        Assertions.assertEquals(OffsetDateTime.parse("2021-09-13T16:27:08Z"), model.deviceLastScannedDateTime());
        Assertions.assertEquals(OffsetDateTime.parse("2021-12-04T18:39:42Z"), model.lastCompletedScanJobDateTime());
    }
}
