public void TestOnBackupFailedVBScript() { Application application = SingletonProvider<TestSetup>.Instance.GetApp(); // First set up a script string script = @"Sub OnBackupFailed(reason) EventLog.Write(""Failed: "" & reason) End Sub"; Scripting scripting = _settings.Scripting; string file = scripting.CurrentScriptFile; TestSetup.WriteFile(file, script); scripting.Enabled = true; scripting.Reload(); var back = new BackupRestore(); back.InitializeBackupSettings(); back.SetBackupDir(@"C:\some-non-existant-directory"); CustomAssert.IsFalse(back.Execute()); TestSetup.AssertReportedError(); string eventLogText = TestSetup.ReadExistingTextFile(TestSetup.GetEventLogFileName()); CustomAssert.IsTrue(eventLogText.Contains("The specified backup directory is not accessible")); }
public void TestOnBackupFailedVBScript() { // First set up a script string script = @"Sub OnBackupFailed(reason) EventLog.Write(""Failed: "" & reason) End Sub"; Scripting scripting = _settings.Scripting; string file = scripting.CurrentScriptFile; File.WriteAllText(file, script); scripting.Enabled = true; scripting.Reload(); var back = new BackupRestore(); back.InitializeBackupSettings(); back.SetBackupDir(@"C:\some-non-existant-directory"); Assert.IsFalse(back.Execute()); CustomAsserts.AssertReportedError("BACKUP ERROR: The specified backup directory is not accessible:"); string eventLogText = TestSetup.ReadExistingTextFile(LogHandler.GetEventLogFileName()); Assert.IsTrue(eventLogText.Contains("The specified backup directory is not accessible")); }
public void TestOnBackupFailedJScript() { Application application = SingletonProvider<TestSetup>.Instance.GetApp(); Scripting scripting = _settings.Scripting; scripting.Language = "JScript"; // First set up a script string script = @"function OnBackupFailed(reason) { EventLog.Write('Failed: ' + reason) }"; string file = scripting.CurrentScriptFile; File.WriteAllText(file, script); scripting.Enabled = true; scripting.Reload(); var back = new BackupRestore(); back.InitializeBackupSettings(); back.SetBackupDir(@"C:\some-non-existant-directory"); Assert.IsFalse(back.Execute()); CustomAsserts.AssertReportedError("BACKUP ERROR: The specified backup directory is not accessible:"); string eventLogText = TestSetup.ReadExistingTextFile(LogHandler.GetEventLogFileName()); Assert.IsTrue(eventLogText.Contains("The specified backup directory is not accessible")); }