Adding more features to restore operation (#420)

* Adding more features to restore operations and added tests
This commit is contained in:
Leila Lali
2017-07-24 09:41:32 -07:00
committed by GitHub
parent 354d702d6f
commit e1395cbd7d
34 changed files with 5861 additions and 269 deletions

View File

@@ -0,0 +1,53 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlTools.ServiceLayer.DisasterRecovery.Contracts;
using Microsoft.SqlTools.ServiceLayer.DisasterRecovery.RestoreOperation;
using Xunit;
namespace Microsoft.SqlTools.ServiceLayer.UnitTests.DisasterRecovery
{
public class DatabaseFileInfoTests
{
[Fact]
public void DatabaseFileInfoConstructorShouldThrowExceptionGivenNull()
{
Assert.Throws<ArgumentNullException>(() => new DatabaseFileInfo(null));
}
[Fact]
public void DatabaseFileInfoShouldReturnNullGivenEmptyProperties()
{
LocalizedPropertyInfo[] properties = new LocalizedPropertyInfo[] { };
var fileInfo = new DatabaseFileInfo(properties);
Assert.True(string.IsNullOrEmpty(fileInfo.Id));
Assert.True(string.IsNullOrEmpty(fileInfo.GetPropertyValueAsString(BackupSetInfo.BackupComponentPropertyName)));
}
[Fact]
public void DatabaseFileInfoShouldReturnValuesGivenValidProperties()
{
LocalizedPropertyInfo[] properties = new LocalizedPropertyInfo[] {
new LocalizedPropertyInfo
{
PropertyName = "name",
PropertyValue = 1
},
new LocalizedPropertyInfo
{
PropertyName = DatabaseFileInfo.IdPropertyName,
PropertyValue = "id"
}
};
var fileInfo = new DatabaseFileInfo(properties);
Assert.Equal(fileInfo.Id, "id");
Assert.Equal(fileInfo.GetPropertyValueAsString("name"), "1");
}
}
}