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

package com.azure.resourcemanager.datamigration.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.datamigration.models.DatabaseFileInfo;
import com.azure.resourcemanager.datamigration.models.DatabaseFileType;
import org.junit.jupiter.api.Assertions;

public final class DatabaseFileInfoTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        DatabaseFileInfo model =
            BinaryData
                .fromString(
                    "{\"databaseName\":\"nxknalaulp\",\"id\":\"gdtpnapnyiro\",\"logicalName\":\"hpigv\",\"physicalFullName\":\"ylgqgitxmedjvcsl\",\"restoreFullName\":\"qwwncw\",\"fileType\":\"NotSupported\",\"sizeMB\":83.47632545519323}")
                .toObject(DatabaseFileInfo.class);
        Assertions.assertEquals("nxknalaulp", model.databaseName());
        Assertions.assertEquals("gdtpnapnyiro", model.id());
        Assertions.assertEquals("hpigv", model.logicalName());
        Assertions.assertEquals("ylgqgitxmedjvcsl", model.physicalFullName());
        Assertions.assertEquals("qwwncw", model.restoreFullName());
        Assertions.assertEquals(DatabaseFileType.NOT_SUPPORTED, model.fileType());
        Assertions.assertEquals(83.47632545519323D, model.sizeMB());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        DatabaseFileInfo model =
            new DatabaseFileInfo()
                .withDatabaseName("nxknalaulp")
                .withId("gdtpnapnyiro")
                .withLogicalName("hpigv")
                .withPhysicalFullName("ylgqgitxmedjvcsl")
                .withRestoreFullName("qwwncw")
                .withFileType(DatabaseFileType.NOT_SUPPORTED)
                .withSizeMB(83.47632545519323D);
        model = BinaryData.fromObject(model).toObject(DatabaseFileInfo.class);
        Assertions.assertEquals("nxknalaulp", model.databaseName());
        Assertions.assertEquals("gdtpnapnyiro", model.id());
        Assertions.assertEquals("hpigv", model.logicalName());
        Assertions.assertEquals("ylgqgitxmedjvcsl", model.physicalFullName());
        Assertions.assertEquals("qwwncw", model.restoreFullName());
        Assertions.assertEquals(DatabaseFileType.NOT_SUPPORTED, model.fileType());
        Assertions.assertEquals(83.47632545519323D, model.sizeMB());
    }
}
