public void ValidatorShouldReturnTrueForNullArgument()
        {
            string message;
            bool   result = DisasterRecoveryFileValidator.ValidatePaths(null, out message);

            Assert.True(result);
        }
Exemple #2
0
        //[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));
        }
Exemple #3
0
        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);
        }