// 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.BackupEngineExtendedInfo;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;

public final class BackupEngineExtendedInfoTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        BackupEngineExtendedInfo model =
            BinaryData
                .fromString(
                    "{\"databaseName\":\"ljxywsu\",\"protectedItemsCount\":678747249,\"protectedServersCount\":188945883,\"diskCount\":371488938,\"usedDiskSpace\":83.93898415898154,\"availableDiskSpace\":66.38788234362916,\"refreshedAt\":\"2021-10-23T00:50:26Z\",\"azureProtectedInstances\":1114834303}")
                .toObject(BackupEngineExtendedInfo.class);
        Assertions.assertEquals("ljxywsu", model.databaseName());
        Assertions.assertEquals(678747249, model.protectedItemsCount());
        Assertions.assertEquals(188945883, model.protectedServersCount());
        Assertions.assertEquals(371488938, model.diskCount());
        Assertions.assertEquals(83.93898415898154D, model.usedDiskSpace());
        Assertions.assertEquals(66.38788234362916D, model.availableDiskSpace());
        Assertions.assertEquals(OffsetDateTime.parse("2021-10-23T00:50:26Z"), model.refreshedAt());
        Assertions.assertEquals(1114834303, model.azureProtectedInstances());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        BackupEngineExtendedInfo model =
            new BackupEngineExtendedInfo()
                .withDatabaseName("ljxywsu")
                .withProtectedItemsCount(678747249)
                .withProtectedServersCount(188945883)
                .withDiskCount(371488938)
                .withUsedDiskSpace(83.93898415898154D)
                .withAvailableDiskSpace(66.38788234362916D)
                .withRefreshedAt(OffsetDateTime.parse("2021-10-23T00:50:26Z"))
                .withAzureProtectedInstances(1114834303);
        model = BinaryData.fromObject(model).toObject(BackupEngineExtendedInfo.class);
        Assertions.assertEquals("ljxywsu", model.databaseName());
        Assertions.assertEquals(678747249, model.protectedItemsCount());
        Assertions.assertEquals(188945883, model.protectedServersCount());
        Assertions.assertEquals(371488938, model.diskCount());
        Assertions.assertEquals(83.93898415898154D, model.usedDiskSpace());
        Assertions.assertEquals(66.38788234362916D, model.availableDiskSpace());
        Assertions.assertEquals(OffsetDateTime.parse("2021-10-23T00:50:26Z"), model.refreshedAt());
        Assertions.assertEquals(1114834303, model.azureProtectedInstances());
    }
}
