Index: Core/Common/test/Core.Common.Gui.Test/Core.Common.Gui.Test.csproj
===================================================================
diff -u -r08e8d26a0715f0f3db57c1d3e86256aa06934db4 -rfb31ac40136f4d87142db78fd20854849bc11885
--- Core/Common/test/Core.Common.Gui.Test/Core.Common.Gui.Test.csproj (.../Core.Common.Gui.Test.csproj) (revision 08e8d26a0715f0f3db57c1d3e86256aa06934db4)
+++ Core/Common/test/Core.Common.Gui.Test/Core.Common.Gui.Test.csproj (.../Core.Common.Gui.Test.csproj) (revision fb31ac40136f4d87142db78fd20854849bc11885)
@@ -21,6 +21,7 @@
+
Index: Core/Common/test/Core.Common.Gui.Test/ExceptionDialogTest.cs
===================================================================
diff -u -re75ff273f0e261eb9f7534d56b6f6a642b01ff9e -rfb31ac40136f4d87142db78fd20854849bc11885
--- Core/Common/test/Core.Common.Gui.Test/ExceptionDialogTest.cs (.../ExceptionDialogTest.cs) (revision e75ff273f0e261eb9f7534d56b6f6a642b01ff9e)
+++ Core/Common/test/Core.Common.Gui.Test/ExceptionDialogTest.cs (.../ExceptionDialogTest.cs) (revision fb31ac40136f4d87142db78fd20854849bc11885)
@@ -24,6 +24,7 @@
using System.Windows.Forms;
using Core.Common.Gui.ClipBoard;
using Core.Common.Gui.Commands;
+using Core.Common.Gui.TestUtil.Clipboard;
using NUnit.Extensions.Forms;
using NUnit.Framework;
using Rhino.Mocks;
@@ -238,6 +239,7 @@
{
// Setup
var exception = new Exception("Test");
+ using (new ClipboardConfig())
using (var dialog = new ExceptionDialog(new UserControl(), null, exception))
{
dialog.Show();
Index: Core/Common/test/Core.Common.Gui.Test/Forms/MessageWindow/MessageWindowTest.cs
===================================================================
diff -u -re75ff273f0e261eb9f7534d56b6f6a642b01ff9e -rfb31ac40136f4d87142db78fd20854849bc11885
--- Core/Common/test/Core.Common.Gui.Test/Forms/MessageWindow/MessageWindowTest.cs (.../MessageWindowTest.cs) (revision e75ff273f0e261eb9f7534d56b6f6a642b01ff9e)
+++ Core/Common/test/Core.Common.Gui.Test/Forms/MessageWindow/MessageWindowTest.cs (.../MessageWindowTest.cs) (revision fb31ac40136f4d87142db78fd20854849bc11885)
@@ -24,6 +24,7 @@
using System.Threading;
using System.Windows.Forms;
using Core.Common.Gui.ClipBoard;
+using Core.Common.Gui.TestUtil.Clipboard;
using log4net.Core;
using NUnit.Extensions.Forms;
using NUnit.Framework;
@@ -442,6 +443,7 @@
{
// Setup
using (var form = new Form())
+ using (new ClipboardConfig())
using (GuiFormsMessageWindow.MessageWindow messageWindow = ShowMessageWindow(null))
{
form.Controls.Add(messageWindow);
Fisheye: Tag fb31ac40136f4d87142db78fd20854849bc11885 refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.TestUtil/Clipboard/AssemblyToolCalculatorFactoryConfig.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Core/Common/test/Core.Common.Gui.TestUtil/Clipboard/ClipboardConfig.cs
===================================================================
diff -u
--- Core/Common/test/Core.Common.Gui.TestUtil/Clipboard/ClipboardConfig.cs (revision 0)
+++ Core/Common/test/Core.Common.Gui.TestUtil/Clipboard/ClipboardConfig.cs (revision fb31ac40136f4d87142db78fd20854849bc11885)
@@ -0,0 +1,89 @@
+// Copyright (C) Stichting Deltares 2019. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using Core.Common.Gui.ClipBoard;
+
+namespace Core.Common.Gui.TestUtil.Clipboard
+{
+ ///
+ /// This class can be used to set a temporary for while
+ /// testing. Disposing an instance of this class will revert the to its
+ /// original state.
+ ///
+ ///
+ /// The following is an example for how to use this class:
+ ///
+ /// using(new ClipboardConfig())
+ /// {
+ /// IClipboard clipboard = ClipboardProvider.Clipboard;
+ ///
+ /// // Perform tests with clipboard
+ /// }
+ ///
+ ///
+ public class ClipboardConfig : IDisposable
+ {
+ private readonly IClipboard previousClipboard;
+
+ ///
+ /// Creates a new instance of . Sets a test implementation of to
+ /// .
+ ///
+ public ClipboardConfig()
+ {
+ previousClipboard = ClipboardProvider.Clipboard;
+ ClipboardProvider.Clipboard = new TestClipboard();
+ }
+
+ ///
+ /// Reverts to its original state.
+ ///
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ ClipboardProvider.Clipboard = previousClipboard;
+ }
+ }
+
+ private class TestClipboard : IClipboard
+ {
+ private string clipBoardContent;
+
+ public void SetDataObject(object data, bool copy = false)
+ {
+ clipBoardContent = data.ToString();
+ }
+
+ public string GetText()
+ {
+ return clipBoardContent;
+ }
+ }
+ }
+}
\ No newline at end of file