Index: Core/Common/src/Core.Common.Controls/Dialogs/ExceptionDialog.cs
===================================================================
diff -u -reed91377feb2abaf70e41f5826d9ae95b2ff008b -ra356a3154eb7d0267485cd4efa7798bb19de0abe
--- Core/Common/src/Core.Common.Controls/Dialogs/ExceptionDialog.cs (.../ExceptionDialog.cs) (revision eed91377feb2abaf70e41f5826d9ae95b2ff008b)
+++ Core/Common/src/Core.Common.Controls/Dialogs/ExceptionDialog.cs (.../ExceptionDialog.cs) (revision a356a3154eb7d0267485cd4efa7798bb19de0abe)
@@ -29,14 +29,14 @@
{
InitializeComponent();
- buttonOpenLog.Visible = false;
+ buttonOpenLog.Enabled = false;
exceptionTextBox.Text = exception == null ? "" : exception.ToString();
}
///
/// Gets or sets the action that should be performed after clicking the log button.
///
- /// The log button is only visible when this action is set.
+ /// The log button is only enabled when this action is set.
public Action OpenLogClicked
{
private get
@@ -47,7 +47,7 @@
{
openLogClicked = value;
- buttonOpenLog.Visible = openLogClicked != null;
+ buttonOpenLog.Enabled = openLogClicked != null;
}
}
Index: Core/Common/test/Core.Common.Controls.Test/Dialogs/ExceptionDialogTest.cs
===================================================================
diff -u -reed91377feb2abaf70e41f5826d9ae95b2ff008b -ra356a3154eb7d0267485cd4efa7798bb19de0abe
--- Core/Common/test/Core.Common.Controls.Test/Dialogs/ExceptionDialogTest.cs (.../ExceptionDialogTest.cs) (revision eed91377feb2abaf70e41f5826d9ae95b2ff008b)
+++ Core/Common/test/Core.Common.Controls.Test/Dialogs/ExceptionDialogTest.cs (.../ExceptionDialogTest.cs) (revision a356a3154eb7d0267485cd4efa7798bb19de0abe)
@@ -46,7 +46,6 @@
};
var exception = new Exception("Test", new Exception("Test inner"));
-
var dialog = new ExceptionDialog(null, exception);
// Call
@@ -80,5 +79,126 @@
// Assert
Assert.AreEqual("", exceptionText);
}
+
+ [Test]
+ public void ShowDialog_ExceptionDialogWithoutOpenLogAction_OpenLogButtonNotEnabled()
+ {
+ // Setup
+ Button buttonOpenLog = null;
+
+ DialogBoxHandler = (name, wnd) =>
+ {
+ var openedDialog = new FormTester(name);
+ var button = new ButtonTester("buttonOpenLog");
+
+ buttonOpenLog = (Button) button.TheObject;
+
+ openedDialog.Close();
+ };
+
+ var dialog = new ExceptionDialog(null, null);
+
+ // Call
+ dialog.ShowDialog();
+
+ // Assert
+ Assert.IsFalse(buttonOpenLog.Enabled);
+ }
+
+ [Test]
+ public void ShowDialog_ExceptionDialogWithOpenLogAction_OpenLogButtonEnabled()
+ {
+ // Setup
+ Button buttonOpenLog = null;
+
+ DialogBoxHandler = (name, wnd) =>
+ {
+ var openedDialog = new FormTester(name);
+ var button = new ButtonTester("buttonOpenLog");
+
+ buttonOpenLog = (Button) button.TheObject;
+
+ openedDialog.Close();
+ };
+
+ var dialog = new ExceptionDialog(null, null)
+ {
+ OpenLogClicked = () => { }
+ };
+
+ // Call
+ dialog.ShowDialog();
+
+ // Assert
+ Assert.IsTrue(buttonOpenLog.Enabled);
+ }
+
+ [Test]
+ public void ShowDialog_ExceptionDialog_RestartButtonClickResultsInDialogResultOk()
+ {
+ // Setup
+ DialogBoxHandler = (name, wnd) =>
+ {
+ var button = new ButtonTester("buttonRestart");
+
+ button.Click();
+ };
+
+ var dialog = new ExceptionDialog(null, null);
+
+ // Call
+ dialog.ShowDialog();
+
+ // Assert
+ Assert.AreEqual(DialogResult.OK, dialog.DialogResult);
+ }
+
+ [Test]
+ public void ShowDialog_ExceptionDialog_ExitButtonClickResultsInDialogResultCancel()
+ {
+ // Setup
+ DialogBoxHandler = (name, wnd) =>
+ {
+ var button = new ButtonTester("buttonExit");
+
+ button.Click();
+ };
+
+ var dialog = new ExceptionDialog(null, null);
+
+ // Call
+ dialog.ShowDialog();
+
+ // Assert
+ Assert.AreEqual(DialogResult.Cancel, dialog.DialogResult);
+ }
+
+ [Test]
+ public void ShowDialog_ExceptionDialog_OpenLogButtonClickPerformsOpenLogClickedAction()
+ {
+ // Setup
+ var counter = 0;
+
+ DialogBoxHandler = (name, wnd) =>
+ {
+ var openedDialog = new FormTester(name);
+ var button = new ButtonTester("buttonOpenLog");
+
+ button.Click();
+
+ openedDialog.Close();
+ };
+
+ var dialog = new ExceptionDialog(null, null)
+ {
+ OpenLogClicked = () => counter++
+ };
+
+ // Call
+ dialog.ShowDialog();
+
+ // Assert
+ Assert.AreEqual(1, counter);
+ }
}
}