public void GetMachineNameForNamedServer() { string testMachineName = "testmachine"; string machineName = DisasterRecoveryFileValidator.GetMachineName(string.Format("{0}\\testserver", testMachineName)); Assert.True(testMachineName == machineName); }
public void ValidatorShouldReturnTrueForNullArgument() { string message; bool result = DisasterRecoveryFileValidator.ValidatePaths(null, out message); Assert.True(result); }
public void ValidateDefaultBackupFolderPath() { var liveConnection = LiveConnectionHelper.InitLiveConnectionInfo("master"); DatabaseTaskHelper helper = AdminService.CreateDatabaseTaskHelper(liveConnection.ConnectionInfo, databaseExists: true); SqlConnection sqlConn = ConnectionService.OpenSqlConnection(liveConnection.ConnectionInfo); string backupPath = GetDefaultBackupFolderPath(helper.DataContainer, sqlConn); bool isFolder; bool result = DisasterRecoveryFileValidator.IsPathExisting(sqlConn, backupPath, out isFolder); Assert.True(isFolder); Assert.True(result); }
//[Fact] public void ValidatorShouldReturnFalseForInvalidPath() { var liveConnection = LiveConnectionHelper.InitLiveConnectionInfo("master"); DatabaseTaskHelper helper = AdminService.CreateDatabaseTaskHelper(liveConnection.ConnectionInfo, databaseExists: true); string message; bool result = DisasterRecoveryFileValidator.ValidatePaths(new FileBrowserValidateEventArgs { ServiceType = FileValidationServiceConstants.Backup, OwnerUri = liveConnection.ConnectionInfo.OwnerUri, FilePaths = new string[] { Guid.NewGuid().ToString() } }, out message); Assert.False(result); Assert.True(!string.IsNullOrEmpty(message)); }
public void ValidateDefaultBackupFullFilePath() { var liveConnection = LiveConnectionHelper.InitLiveConnectionInfo("master"); DatabaseTaskHelper helper = AdminService.CreateDatabaseTaskHelper(liveConnection.ConnectionInfo, databaseExists: true); SqlConnection sqlConn = ConnectionService.OpenSqlConnection(liveConnection.ConnectionInfo); string backupPath = Path.Combine(GetDefaultBackupFolderPath(helper.DataContainer, sqlConn), "master.bak"); string message; bool result = DisasterRecoveryFileValidator.ValidatePaths(new FileBrowserValidateEventArgs { ServiceType = FileValidationServiceConstants.Backup, OwnerUri = liveConnection.ConnectionInfo.OwnerUri, FilePaths = new string[] { backupPath } }, out message); Assert.True(result); Assert.Empty(message); }
public void GetMachineNameForLocalServer() { string machineName = DisasterRecoveryFileValidator.GetMachineName(DisasterRecoveryFileValidator.LocalSqlServer); Assert.True(System.Environment.MachineName == machineName); }