예제 #1
0
        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"));
        }
예제 #2
0
        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"));
        }
예제 #3
0
        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"));
        }
예제 #4
0
        public void TestOnBackupFailedJScript()
        {
            hMailServer.Application application = SingletonProvider <Utilities> .Instance.GetApp();

            hMailServer.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;

            Utilities.WriteFile(file, script);
            scripting.Enabled = true;
            scripting.Reload();

            BackupRestore back = new BackupRestore();

            back.InitializeBackupSettings();
            back.SetBackupDir(@"C:\some-non-existant-directory");
            Assert.IsFalse(back.Execute());

            Utilities.AssertReportedError();
            string eventLogText = Utilities.ReadExistingTextFile(Utilities.GetEventLogFileName());

            Assert.IsTrue(eventLogText.Contains("The specified backup directory is not accessible"));
        }
예제 #5
0
        public void TestOnBackupFailedVBScript()
        {
            hMailServer.Application application = SingletonProvider<Utilities>.Instance.GetApp();

             // First set up a script
             string script = @"Sub OnBackupFailed(reason)
                               EventLog.Write(""Failed: "" & reason)
                           End Sub";

             hMailServer.Scripting scripting = _settings.Scripting;
             string file = scripting.CurrentScriptFile;
             Utilities.WriteFile(file, script);
             scripting.Enabled = true;
             scripting.Reload();

             BackupRestore back = new BackupRestore();
             back.InitializeBackupSettings();
             back.SetBackupDir(@"C:\some-non-existant-directory");
             Assert.IsFalse(back.Execute());

             Utilities.AssertReportedError();
             string eventLogText = Utilities.ReadExistingTextFile(Utilities.GetEventLogFileName());
             Assert.IsTrue(eventLogText.Contains("The specified backup directory is not accessible"));
        }