Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Appenders/RiskeerUserDataFolderConverterTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Attributes/DynamicPropertyOrderAttributeTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Attributes/DynamicPropertyOrderEvaluationMethodAttributeTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Attributes/DynamicReadOnlyAttributeTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Attributes/DynamicReadOnlyValidationMethodAttributeTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Attributes/DynamicVisibleAttributeTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Attributes/DynamicVisibleValidationMethodAttributeTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Attributes/PropertyOrderAttributeTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Attributes/TestCaseClasses/DynamicPropertyOrderTestCases.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Attributes/TestCaseClasses/DynamicReadOnlyTestCases.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Attributes/TestCaseClasses/DynamicVisibilityTestCases.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Clipboard/ClipboardProviderTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Commands/ApplicationFeatureCommandHandlerTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Commands/GuiExportHandlerTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Commands/GuiImportHandlerTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Commands/GuiUpdateHandlerTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Commands/StorageCommandHandlerTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Commands/ViewCommandHandlerTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/ContextMenu/ContextMenuBuilderExceptionTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/ContextMenu/ContextMenuBuilderTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/ContextMenu/GuiContextMenuItemFactoryTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/ContextMenu/StrictContextMenuItemTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/ContextMenu/TreeViewContextMenuItemFactoryTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Converters/ColorTypeConverterTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Converters/ExpandableArrayConverterTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Converters/ExpandableReadOnlyArrayConverterTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Converters/KeyValueAsRoundedDoubleWithoutTrailingZeroesElementAttributeTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Converters/KeyValueElementAttributeTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Converters/KeyValueExpandableArrayConverterTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Converters/PngToIconConverterTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Core.Common.Gui.Test.csproj'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/ExceptionDialogTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Forms/MainWindow/MainWindowTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Forms/MessageWindow/MessageWindowDialogTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Forms/MessageWindow/MessageWindowLogAppenderTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Forms/MessageWindow/MessageWindowTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Forms/ProgressDialog/ActivityProgressDialogTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Forms/ProjectExplorer/ProjectExplorerTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Forms/PropertyGridView/PropertyGridViewTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Forms/PropertyGridView/PropertyResolverTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Forms/RichTextFileTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Forms/RichTextViewTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Forms/SelectItemDialogTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Forms/SelectViewDialogTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Forms/SplashScreen/SplashScreenTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Forms/ViewHost/AvalonDockViewHostTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Forms/ViewHost/DocumentViewControllerTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Forms/ViewHost/TestView.Designer.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Forms/ViewHost/TestView.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Forms/ViewHost/TestView.resx'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Forms/ViewHost/ViewChangeEventArgsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/GuiCoreTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Helpers/DialogBasedInquiryHelperTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Helpers/ExportHelperTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/OpenProjectActivityTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Plugin/ExportInfoTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Plugin/ImportInfoTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Plugin/PluginBaseTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Plugin/PropertyInfoTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Plugin/UpdateInfoTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Plugin/ViewInfoTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Properties/AssemblyInfo.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Properties/Resources.Designer.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/Properties/Resources.resx'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/PropertyBag/DynamicPropertyBagTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/PropertyBag/ObjectPropertiesTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/PropertyBag/PropertySpecDescriptorTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/PropertyBag/PropertySpecTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/PropertyBag/ReadOnlyPropertyDescriptorDecoratorTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Core/Common/test/Core.Common.Gui.Test/Resources/abacus.png
===================================================================
diff -u -rce50b65f662bcccb1849444e4d51549731131234 -r781a97409ffc49e5b666a7856f633f46178056df
Binary files differ
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/SaveProjectActivityTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/UITypeEditors/ColorEditorTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/UITypeEditors/SelectionEditorTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.Test/ViewPropertyEditorTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.TestUtil/Clipboard/ClipboardConfig.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.TestUtil/ContextMenu/CustomItemsOnlyContextMenuBuilder.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.TestUtil/Core.Common.Gui.TestUtil.csproj'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.TestUtil/PluginTestHelper.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Gui.TestUtil/Properties/AssemblyInfo.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Integration.Test/Core.Common.Integration.Test.csproj'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Integration.Test/Properties/AssemblyInfo.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 781a97409ffc49e5b666a7856f633f46178056df refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Integration.Test/Riskeer/Application.Riskeer/GuiCoreIntegrationTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Core/Gui/test/Core.Gui.Test/Appenders/RiskeerUserDataFolderConverterTest.cs
===================================================================
diff -u
--- Core/Gui/test/Core.Gui.Test/Appenders/RiskeerUserDataFolderConverterTest.cs (revision 0)
+++ Core/Gui/test/Core.Gui.Test/Appenders/RiskeerUserDataFolderConverterTest.cs (revision 781a97409ffc49e5b666a7856f633f46178056df)
@@ -0,0 +1,73 @@
+// Copyright (C) Stichting Deltares 2021. 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.IO;
+using Core.Common.Util.Settings;
+using Core.Gui.Appenders;
+using log4net.Util;
+using NUnit.Framework;
+using Rhino.Mocks;
+
+namespace Core.Gui.Test.Appenders
+{
+ [TestFixture]
+ public class RiskeerUserDataFolderConverterTest
+ {
+ [Test]
+ public void DefaultConstructor_ExpectedValues()
+ {
+ // Call
+ var converter = new RiskeerUserDataFolderConverter();
+
+ // Assert
+ Assert.IsInstanceOf(converter.FormattingInfo);
+ Assert.IsNull(converter.Next);
+ Assert.IsNull(converter.Option);
+ Assert.IsNull(converter.Properties);
+ }
+
+ [Test]
+ [TestCase("")]
+ [TestCase(" ")]
+ [TestCase("some string")]
+ public void Convert_Always_WriteLocalUserDataDirectory(string infix)
+ {
+ // Setup
+ string settingsDirectory = SettingsHelper.Instance.GetApplicationLocalUserSettingsDirectory(infix);
+
+ var mocks = new MockRepository();
+ var textWriter = mocks.StrictMock();
+ textWriter.Expect(w => w.Write(settingsDirectory));
+ mocks.ReplayAll();
+
+ var converter = new RiskeerUserDataFolderConverter
+ {
+ Option = infix
+ };
+
+ // Call
+ converter.Format(textWriter, null);
+
+ // Assert
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Index: Core/Gui/test/Core.Gui.Test/Attributes/DynamicPropertyOrderAttributeTest.cs
===================================================================
diff -u
--- Core/Gui/test/Core.Gui.Test/Attributes/DynamicPropertyOrderAttributeTest.cs (revision 0)
+++ Core/Gui/test/Core.Gui.Test/Attributes/DynamicPropertyOrderAttributeTest.cs (revision 781a97409ffc49e5b666a7856f633f46178056df)
@@ -0,0 +1,172 @@
+// Copyright (C) Stichting Deltares 2021. 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.Gui.Attributes;
+using Core.Gui.Test.Attributes.TestCaseClasses;
+using NUnit.Framework;
+
+namespace Core.Gui.Test.Attributes
+{
+ [TestFixture]
+ public class DynamicPropertyOrderAttributeTest
+ {
+ [Test]
+ public void DefaultConstructor_ExpectedValues()
+ {
+ // Call
+ var attribute = new DynamicPropertyOrderAttribute();
+
+ // Assert
+ Assert.IsInstanceOf(attribute);
+ }
+
+ [Test]
+ [TestCase("")]
+ [TestCase(null)]
+ public void PropertyOrder_NoPropertyName_ReturnZero(string propertyName)
+ {
+ // Call
+ int propertyOrder = DynamicPropertyOrderAttribute.PropertyOrder(new object(), propertyName);
+
+ // Assert
+ Assert.AreEqual(0.0, propertyOrder);
+ }
+
+ [Test]
+ public void PropertyOrder_GivenPropertyNameDoesNotExistOnObject_ThrowMissingMemberException()
+ {
+ // Setup
+ var o = new object();
+
+ // Call
+ TestDelegate call = () => DynamicPropertyOrderAttribute.PropertyOrder(o, "NotExistingProperty");
+
+ // Assert
+ string exceptionMessage = Assert.Throws(call).Message;
+ Assert.AreEqual($"Kon eigenschap NotExistingProperty van type {o.GetType()} niet vinden.", exceptionMessage);
+ }
+
+ [Test]
+ public void PropertyOrder_GivenPropertyDoesNotHaveDynamicPropertyOrderAttribute_ReturnZero()
+ {
+ // Setup
+ var o = new ClassWithPropertyWithoutDynamicPropertyOrderAttribute();
+
+ // Call
+ int propertyOrder = DynamicPropertyOrderAttribute.PropertyOrder(o, "Property");
+
+ // Assert
+ Assert.AreEqual(0, propertyOrder);
+ }
+
+ [Test]
+ public void PropertyOrder_ClassLacksDynamicPropertyOrderValidationMethod_ThrowsMissingMethodException()
+ {
+ // Setup
+ var o = new InvalidClassWithDynamicPropertyOrderPropertyButNoEvaluationMethod();
+
+ // Call
+ TestDelegate call = () => DynamicPropertyOrderAttribute.PropertyOrder(o, "Property");
+
+ // Assert
+ string exceptionMessage = Assert.Throws(call).Message;
+ string expectedMessage = $"DynamicPropertyOrderEvaluationMethod niet gevonden (of geen 'public' toegankelijkheid). Klasse: {o.GetType()}.";
+ Assert.AreEqual(expectedMessage, exceptionMessage);
+ }
+
+ [Test]
+ public void PropertyOrder_ClassHasMultipleDynamicPropertyOrderEvaluationMethods_ThrowsMissingMethodException()
+ {
+ // Setup
+ var o = new InvalidClassWithDynamicPropertyOrderPropertyAndMultipleEvaluationMethods();
+
+ // Call
+ TestDelegate call = () => DynamicPropertyOrderAttribute.PropertyOrder(o, "Property");
+
+ // Assert
+ string exceptionMessage = Assert.Throws(call).Message;
+ string expectedMessage = $"Slechts één DynamicPropertyOrderEvaluationMethod toegestaan per klasse: {o.GetType()}.";
+ Assert.AreEqual(expectedMessage, exceptionMessage);
+ }
+
+ [Test]
+ public void PropertyOrder_ClassHasDynamicPropertyOrderEvaluationMethodWithNonIntReturnType_ThrowsMissingMethodException()
+ {
+ // Setup
+ var o = new InvalidClassWithDynamicPropertyOrderPropertyButEvaluationMethodReturnsIncorrectValueType();
+
+ // Call
+ TestDelegate call = () => DynamicPropertyOrderAttribute.PropertyOrder(o, "Property");
+
+ // Assert
+ string exceptionMessage = Assert.Throws(call).Message;
+ string expectedMessage = $"DynamicPropertyOrderEvaluationMethod moet 'int' als 'return type' hebben. Klasse: {o.GetType()}.";
+ Assert.AreEqual(expectedMessage, exceptionMessage);
+ }
+
+ [Test]
+ public void PropertyOrder_ClassHasDynamicPropertyOrderEvaluationMethodWithIncorrectArgumentCount_ThrowsMissingMethodException()
+ {
+ // Setup
+ var o = new InvalidClassWithDynamicPropertyOrderPropertyButEvaluationMethodNotOneArgument();
+
+ // Call
+ TestDelegate call = () => DynamicPropertyOrderAttribute.PropertyOrder(o, "Property");
+
+ // Assert
+ string exceptionMessage = Assert.Throws(call).Message;
+ string expectedMessage = $"DynamicPropertyOrderEvaluationMethod heeft een incorrect aantal argumenten. Zou er één moeten zijn. Klasse: {o.GetType()}.";
+ Assert.AreEqual(expectedMessage, exceptionMessage);
+ }
+
+ [Test]
+ public void PropertyOrder_ClassHasDynamicPropertyOrderEvaluationMethodWithIncorrectArgumentType_ThrowsMissingMethodException()
+ {
+ // Setup
+ var o = new InvalidClassWithDynamicPropertyOrderPropertyButEvaluationMethodArgumentNotString();
+
+ // Call
+ TestDelegate call = () => DynamicPropertyOrderAttribute.PropertyOrder(o, "Property");
+
+ // Assert
+ string exceptionMessage = Assert.Throws(call).Message;
+ string expectedMessage = $"Argument van DynamicPropertyOrderEvaluationMethod moet van het type 'string' zijn. Klasse: {o.GetType()}.";
+ Assert.AreEqual(expectedMessage, exceptionMessage);
+ }
+
+ [Test]
+ [TestCase(1)]
+ [TestCase(2)]
+ [TestCase(10)]
+ public void PropertyOrder_ClassWithDynamicPropertyOrderProperty_ReturnResultFromEvaluationMethod(int propertyOrder)
+ {
+ // Setup
+ var o = new ClassWithDynamicPropertyOrderProperty(propertyOrder);
+
+ // Call
+ int result = DynamicPropertyOrderAttribute.PropertyOrder(o, "Property");
+
+ // Assert
+ Assert.AreEqual(propertyOrder, result);
+ }
+ }
+}
\ No newline at end of file
Index: Core/Gui/test/Core.Gui.Test/Attributes/DynamicPropertyOrderEvaluationMethodAttributeTest.cs
===================================================================
diff -u
--- Core/Gui/test/Core.Gui.Test/Attributes/DynamicPropertyOrderEvaluationMethodAttributeTest.cs (revision 0)
+++ Core/Gui/test/Core.Gui.Test/Attributes/DynamicPropertyOrderEvaluationMethodAttributeTest.cs (revision 781a97409ffc49e5b666a7856f633f46178056df)
@@ -0,0 +1,123 @@
+// Copyright (C) Stichting Deltares 2021. 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.Gui.Attributes;
+using Core.Gui.Test.Attributes.TestCaseClasses;
+using NUnit.Framework;
+
+namespace Core.Gui.Test.Attributes
+{
+ [TestFixture]
+ public class DynamicPropertyOrderEvaluationMethodAttributeTest
+ {
+ [Test]
+ public void CreatePropertyOrderMethod_ClassLacksDynamicPropertyOrderEvaluationMethod_ThrowsMissingMethodException()
+ {
+ // Setup
+ var o = new InvalidClassWithDynamicPropertyOrderPropertyButNoEvaluationMethod();
+
+ // Call
+ TestDelegate call = () => DynamicPropertyOrderEvaluationMethodAttribute.CreatePropertyOrderMethod(o);
+
+ // Assert
+ string exceptionMessage = Assert.Throws(call).Message;
+ string expectedMessage = $"DynamicPropertyOrderEvaluationMethod niet gevonden (of geen 'public' toegankelijkheid). Klasse: {o.GetType()}.";
+ Assert.AreEqual(expectedMessage, exceptionMessage);
+ }
+
+ [Test]
+ public void CreatePropertyOrderMethod_ClassHasMultipleDynamicPropertyOrderEvaluationMethods_ThrowsMissingMethodException()
+ {
+ // Setup
+ var o = new InvalidClassWithDynamicPropertyOrderPropertyAndMultipleEvaluationMethods();
+
+ // Call
+ TestDelegate call = () => DynamicPropertyOrderEvaluationMethodAttribute.CreatePropertyOrderMethod(o);
+
+ // Assert
+ string exceptionMessage = Assert.Throws(call).Message;
+ string expectedMessage = $"Slechts één DynamicPropertyOrderEvaluationMethod toegestaan per klasse: {o.GetType()}.";
+ Assert.AreEqual(expectedMessage, exceptionMessage);
+ }
+
+ [Test]
+ public void CreatePropertyOrderMethod_ClassHasDynamicPropertyOrderEvaluationMethodWithNonIntReturnType_ThrowsMissingMethodException()
+ {
+ // Setup
+ var o = new InvalidClassWithDynamicPropertyOrderPropertyButEvaluationMethodReturnsIncorrectValueType();
+
+ // Call
+ TestDelegate call = () => DynamicPropertyOrderEvaluationMethodAttribute.CreatePropertyOrderMethod(o);
+
+ // Assert
+ string exceptionMessage = Assert.Throws(call).Message;
+ string expectedMessage = $"DynamicPropertyOrderEvaluationMethod moet 'int' als 'return type' hebben. Klasse: {o.GetType()}.";
+ Assert.AreEqual(expectedMessage, exceptionMessage);
+ }
+
+ [Test]
+ public void CreatePropertyOrderMethod_ClassHasDynamicPropertyOrderEvaluationMethodWithIncorrectArgumentCount_ThrowsMissingMethodException()
+ {
+ // Setup
+ var o = new InvalidClassWithDynamicPropertyOrderPropertyButEvaluationMethodNotOneArgument();
+
+ // Call
+ TestDelegate call = () => DynamicPropertyOrderEvaluationMethodAttribute.CreatePropertyOrderMethod(o);
+
+ // Assert
+ string exceptionMessage = Assert.Throws(call).Message;
+ string expectedMessage = $"DynamicPropertyOrderEvaluationMethod heeft een incorrect aantal argumenten. Zou er één moeten zijn. Klasse: {o.GetType()}.";
+ Assert.AreEqual(expectedMessage, exceptionMessage);
+ }
+
+ [Test]
+ public void CreatePropertyOrderMethod_ClassHasDynamicPropertyOrderEvaluationMethodWithIncorrectArgumentType_ThrowsMissingMethodException()
+ {
+ // Setup
+ var o = new InvalidClassWithDynamicPropertyOrderPropertyButEvaluationMethodArgumentNotString();
+
+ // Call
+ TestDelegate call = () => DynamicPropertyOrderEvaluationMethodAttribute.CreatePropertyOrderMethod(o);
+
+ // Assert
+ string exceptionMessage = Assert.Throws(call).Message;
+ string expectedMessage = $"Argument van DynamicPropertyOrderEvaluationMethod moet van het type 'string' zijn. Klasse: {o.GetType()}.";
+ Assert.AreEqual(expectedMessage, exceptionMessage);
+ }
+
+ [Test]
+ [TestCase(1)]
+ [TestCase(2)]
+ [TestCase(10)]
+ public void CreatePropertyOrderMethod_ClassWithDynamicPropertyOrderProperty_ReturnResultFromEvaluationMethod(int propertyOrder)
+ {
+ // Setup
+ var o = new ClassWithDynamicPropertyOrderProperty(propertyOrder);
+
+ // Call
+ DynamicPropertyOrderEvaluationMethodAttribute.PropertyOrder result = DynamicPropertyOrderEvaluationMethodAttribute.CreatePropertyOrderMethod(o);
+
+ // Assert
+ Assert.AreEqual(propertyOrder, result("Property"));
+ }
+ }
+}
\ No newline at end of file
Index: Core/Gui/test/Core.Gui.Test/Attributes/DynamicReadOnlyAttributeTest.cs
===================================================================
diff -u
--- Core/Gui/test/Core.Gui.Test/Attributes/DynamicReadOnlyAttributeTest.cs (revision 0)
+++ Core/Gui/test/Core.Gui.Test/Attributes/DynamicReadOnlyAttributeTest.cs (revision 781a97409ffc49e5b666a7856f633f46178056df)
@@ -0,0 +1,171 @@
+// Copyright (C) Stichting Deltares 2021. 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.Gui.Attributes;
+using Core.Gui.Test.Attributes.TestCaseClasses;
+using NUnit.Framework;
+
+namespace Core.Gui.Test.Attributes
+{
+ [TestFixture]
+ public class DynamicReadOnlyAttributeTest
+ {
+ [Test]
+ public void DefaultConstructor_ExpectedValues()
+ {
+ // Call
+ var attribute = new DynamicReadOnlyAttribute();
+
+ // Assert
+ Assert.IsInstanceOf(attribute);
+ }
+
+ [Test]
+ [TestCase("")]
+ [TestCase(null)]
+ public void IsReadOnly_NoPropertyName_ReturnFalse(string propertyName)
+ {
+ // Call
+ bool isReadOnly = DynamicReadOnlyAttribute.IsReadOnly(new object(), propertyName);
+
+ // Assert
+ Assert.IsFalse(isReadOnly);
+ }
+
+ [Test]
+ public void IsReadOnly_GivenPropertyNameDoesNotExistOnObject_ThrowMissingMemberException()
+ {
+ // Setup
+ var o = new object();
+
+ // Call
+ TestDelegate call = () => DynamicReadOnlyAttribute.IsReadOnly(o, "NotExistingProperty");
+
+ // Assert
+ string exceptionMessage = Assert.Throws(call).Message;
+ Assert.AreEqual($"Kon eigenschap NotExistingProperty van type {o.GetType()} niet vinden.", exceptionMessage);
+ }
+
+ [Test]
+ public void IsReadOnly_GivenPropertyDoesNotHaveDynamicReadOnlyAttribute_ReturnFalse()
+ {
+ // Setup
+ var o = new ClassWithPropertyWithoutDynamicReadOnlyAttribute();
+
+ // Call
+ bool isReadOnly = DynamicReadOnlyAttribute.IsReadOnly(o, "Property");
+
+ // Assert
+ Assert.IsFalse(isReadOnly);
+ }
+
+ [Test]
+ public void IsReadOnly_ClassLacksDynamicReadOnlyValidationMethod_ThrowsMissingMethodException()
+ {
+ // Setup
+ var o = new InvalidClassWithDynamicReadOnlyPropertyButNoValidationMethod();
+
+ // Call
+ TestDelegate call = () => DynamicReadOnlyAttribute.IsReadOnly(o, "Property");
+
+ // Assert
+ string exceptionMessage = Assert.Throws(call).Message;
+ string expectedMessage = $"DynamicReadOnlyValidationMethod niet gevonden (of geen 'public' toegankelijkheid). Klasse: {o.GetType()}.";
+ Assert.AreEqual(expectedMessage, exceptionMessage);
+ }
+
+ [Test]
+ public void IsReadOnly_ClassHasMultipleDynamicReadOnlyValidationMethods_ThrowsMissingMethodException()
+ {
+ // Setup
+ var o = new InvalidClassWithDynamicReadOnlyPropertyAndMultipleValidationMethods();
+
+ // Call
+ TestDelegate call = () => DynamicReadOnlyAttribute.IsReadOnly(o, "Property");
+
+ // Assert
+ string exceptionMessage = Assert.Throws(call).Message;
+ string expectedMessage = $"Slechts één DynamicReadOnlyValidationMethod toegestaan per klasse: {o.GetType()}.";
+ Assert.AreEqual(expectedMessage, exceptionMessage);
+ }
+
+ [Test]
+ public void IsReadOnly_ClassHasDynamicReadOnlyValidationMethodWithNonBoolReturnType_ThrowsMissingMethodException()
+ {
+ // Setup
+ var o = new InvalidClassWithDynamicReadOnlyPropertyButValidationMethodReturnsIncorrectValueType();
+
+ // Call
+ TestDelegate call = () => DynamicReadOnlyAttribute.IsReadOnly(o, "Property");
+
+ // Assert
+ string exceptionMessage = Assert.Throws(call).Message;
+ string expectedMessage = $"DynamicReadOnlyValidationMethod moet 'bool' als 'return type' hebben. Klasse: {o.GetType()}.";
+ Assert.AreEqual(expectedMessage, exceptionMessage);
+ }
+
+ [Test]
+ public void IsReadOnly_ClassHasDynamicReadOnlyValidationMethodWithIncorrectArgumentCount_ThrowsMissingMethodException()
+ {
+ // Setup
+ var o = new InvalidClassWithDynamicReadOnlyPropertyButValidationMethodNotOneArgument();
+
+ // Call
+ TestDelegate call = () => DynamicReadOnlyAttribute.IsReadOnly(o, "Property");
+
+ // Assert
+ string exceptionMessage = Assert.Throws(call).Message;
+ string expectedMessage = $"DynamicReadOnlyValidationMethod heeft een incorrect aantal argumenten. Zou er één moeten zijn. Klasse: {o.GetType()}.";
+ Assert.AreEqual(expectedMessage, exceptionMessage);
+ }
+
+ [Test]
+ public void IsReadOnly_ClassHasDynamicReadOnlyValidationMethodWithIncorrectArgumentType_ThrowsMissingMethodException()
+ {
+ // Setup
+ var o = new InvalidClassWithDynamicReadOnlyPropertyButValidationMethodArgumentNotString();
+
+ // Call
+ TestDelegate call = () => DynamicReadOnlyAttribute.IsReadOnly(o, "Property");
+
+ // Assert
+ string exceptionMessage = Assert.Throws(call).Message;
+ string expectedMessage = $"Argument van DynamicReadOnlyValidationMethod moet van het type 'string' zijn. Klasse: {o.GetType()}.";
+ Assert.AreEqual(expectedMessage, exceptionMessage);
+ }
+
+ [Test]
+ [TestCase(false)]
+ [TestCase(true)]
+ public void IsReadOnly_ClassWithDynamicReadOnlyProperty_ReturnResultFromValidationMethod(bool isReadOnly)
+ {
+ // Setup
+ var o = new ClassWithDynamicReadOnlyProperty(isReadOnly);
+
+ // Call
+ bool result = DynamicReadOnlyAttribute.IsReadOnly(o, "Property");
+
+ // Assert
+ Assert.AreEqual(isReadOnly, result);
+ }
+ }
+}
\ No newline at end of file
Index: Core/Gui/test/Core.Gui.Test/Attributes/DynamicReadOnlyValidationMethodAttributeTest.cs
===================================================================
diff -u
--- Core/Gui/test/Core.Gui.Test/Attributes/DynamicReadOnlyValidationMethodAttributeTest.cs (revision 0)
+++ Core/Gui/test/Core.Gui.Test/Attributes/DynamicReadOnlyValidationMethodAttributeTest.cs (revision 781a97409ffc49e5b666a7856f633f46178056df)
@@ -0,0 +1,122 @@
+// Copyright (C) Stichting Deltares 2021. 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.Gui.Attributes;
+using Core.Gui.Test.Attributes.TestCaseClasses;
+using NUnit.Framework;
+
+namespace Core.Gui.Test.Attributes
+{
+ [TestFixture]
+ public class DynamicReadOnlyValidationMethodAttributeTest
+ {
+ [Test]
+ public void CreateIsReadOnlyMethod_ClassLacksDynamicReadOnlyValidationMethod_ThrowsMissingMethodException()
+ {
+ // Setup
+ var o = new InvalidClassWithDynamicReadOnlyPropertyButNoValidationMethod();
+
+ // Call
+ TestDelegate call = () => DynamicReadOnlyValidationMethodAttribute.CreateIsReadOnlyMethod(o);
+
+ // Assert
+ string exceptionMessage = Assert.Throws(call).Message;
+ string expectedMessage = $"DynamicReadOnlyValidationMethod niet gevonden (of geen 'public' toegankelijkheid). Klasse: {o.GetType()}.";
+ Assert.AreEqual(expectedMessage, exceptionMessage);
+ }
+
+ [Test]
+ public void CreateIsReadOnlyMethod_ClassHasMultipleDynamicReadOnlyValidationMethods_ThrowsMissingMethodException()
+ {
+ // Setup
+ var o = new InvalidClassWithDynamicReadOnlyPropertyAndMultipleValidationMethods();
+
+ // Call
+ TestDelegate call = () => DynamicReadOnlyValidationMethodAttribute.CreateIsReadOnlyMethod(o);
+
+ // Assert
+ string exceptionMessage = Assert.Throws(call).Message;
+ string expectedMessage = $"Slechts één DynamicReadOnlyValidationMethod toegestaan per klasse: {o.GetType()}.";
+ Assert.AreEqual(expectedMessage, exceptionMessage);
+ }
+
+ [Test]
+ public void CreateIsReadOnlyMethod_ClassHasDynamicReadOnlyValidationMethodWithNonBoolReturnType_ThrowsMissingMethodException()
+ {
+ // Setup
+ var o = new InvalidClassWithDynamicReadOnlyPropertyButValidationMethodReturnsIncorrectValueType();
+
+ // Call
+ TestDelegate call = () => DynamicReadOnlyValidationMethodAttribute.CreateIsReadOnlyMethod(o);
+
+ // Assert
+ string exceptionMessage = Assert.Throws(call).Message;
+ string expectedMessage = $"DynamicReadOnlyValidationMethod moet 'bool' als 'return type' hebben. Klasse: {o.GetType()}.";
+ Assert.AreEqual(expectedMessage, exceptionMessage);
+ }
+
+ [Test]
+ public void CreateIsReadOnlyMethod_ClassHasDynamicReadOnlyValidationMethodWithIncorrectArgumentCount_ThrowsMissingMethodException()
+ {
+ // Setup
+ var o = new InvalidClassWithDynamicReadOnlyPropertyButValidationMethodNotOneArgument();
+
+ // Call
+ TestDelegate call = () => DynamicReadOnlyValidationMethodAttribute.CreateIsReadOnlyMethod(o);
+
+ // Assert
+ string exceptionMessage = Assert.Throws(call).Message;
+ string expectedMessage = $"DynamicReadOnlyValidationMethod heeft een incorrect aantal argumenten. Zou er één moeten zijn. Klasse: {o.GetType()}.";
+ Assert.AreEqual(expectedMessage, exceptionMessage);
+ }
+
+ [Test]
+ public void CreateIsReadOnlyMethod_ClassHasDynamicReadOnlyValidationMethodWithIncorrectArgumentType_ThrowsMissingMethodException()
+ {
+ // Setup
+ var o = new InvalidClassWithDynamicReadOnlyPropertyButValidationMethodArgumentNotString();
+
+ // Call
+ TestDelegate call = () => DynamicReadOnlyValidationMethodAttribute.CreateIsReadOnlyMethod(o);
+
+ // Assert
+ string exceptionMessage = Assert.Throws(call).Message;
+ string expectedMessage = $"Argument van DynamicReadOnlyValidationMethod moet van het type 'string' zijn. Klasse: {o.GetType()}.";
+ Assert.AreEqual(expectedMessage, exceptionMessage);
+ }
+
+ [Test]
+ [TestCase(false)]
+ [TestCase(true)]
+ public void CreateIsReadOnlyMethod_ClassWithDynamicReadOnlyProperty_ReturnResultFromValidationMethod(bool isReadOnly)
+ {
+ // Setup
+ var o = new ClassWithDynamicReadOnlyProperty(isReadOnly);
+
+ // Call
+ DynamicReadOnlyValidationMethodAttribute.IsPropertyReadOnly result = DynamicReadOnlyValidationMethodAttribute.CreateIsReadOnlyMethod(o);
+
+ // Assert
+ Assert.AreEqual(isReadOnly, result("Property"));
+ }
+ }
+}
\ No newline at end of file
Index: Core/Gui/test/Core.Gui.Test/Attributes/DynamicVisibleAttributeTest.cs
===================================================================
diff -u
--- Core/Gui/test/Core.Gui.Test/Attributes/DynamicVisibleAttributeTest.cs (revision 0)
+++ Core/Gui/test/Core.Gui.Test/Attributes/DynamicVisibleAttributeTest.cs (revision 781a97409ffc49e5b666a7856f633f46178056df)
@@ -0,0 +1,171 @@
+// Copyright (C) Stichting Deltares 2021. 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.Gui.Attributes;
+using Core.Gui.Test.Attributes.TestCaseClasses;
+using NUnit.Framework;
+
+namespace Core.Gui.Test.Attributes
+{
+ [TestFixture]
+ public class DynamicVisibleAttributeTest
+ {
+ [Test]
+ public void DefaultConstructor_ExpectedValues()
+ {
+ // Call
+ var attribute = new DynamicVisibleAttribute();
+
+ // Assert
+ Assert.IsInstanceOf(attribute);
+ }
+
+ [Test]
+ [TestCase("")]
+ [TestCase(null)]
+ public void IsVisible_NoPropertyName_ReturnTrue(string propertyName)
+ {
+ // Call
+ bool isVisible = DynamicVisibleAttribute.IsVisible(new object(), propertyName);
+
+ // Assert
+ Assert.IsTrue(isVisible);
+ }
+
+ [Test]
+ public void IsVisible_GivenPropertyNameDoesNotExistOnObject_ThrowMissingMemberException()
+ {
+ // Setup
+ var o = new object();
+
+ // Call
+ TestDelegate call = () => DynamicVisibleAttribute.IsVisible(o, "NotExistingProperty");
+
+ // Assert
+ string exceptionMessage = Assert.Throws(call).Message;
+ Assert.AreEqual($"Kon eigenschap NotExistingProperty van type {o.GetType()} niet vinden.", exceptionMessage);
+ }
+
+ [Test]
+ public void IsVisible_GivenPropertyDoesNotHaveDynamicVisibleAttribute_ReturnTrue()
+ {
+ // Setup
+ var o = new ClassWithPropertyWithoutDynamicVisibleAttribute();
+
+ // Call
+ bool isVisible = DynamicVisibleAttribute.IsVisible(o, "Property");
+
+ // Assert
+ Assert.IsTrue(isVisible);
+ }
+
+ [Test]
+ public void IsVisible_ClassLacksDynamicVisibleValidationMethod_ThrowsMissingMethodException()
+ {
+ // Setup
+ var o = new InvalidClassWithDynamicVisiblePropertyButNoValidationMethod();
+
+ // Call
+ TestDelegate call = () => DynamicVisibleAttribute.IsVisible(o, "Property");
+
+ // Assert
+ string exceptionMessage = Assert.Throws(call).Message;
+ string expectedMessage = $"DynamicVisibleValidationMethod niet gevonden (of geen 'public' toegankelijkheid). Klasse: {o.GetType()}.";
+ Assert.AreEqual(expectedMessage, exceptionMessage);
+ }
+
+ [Test]
+ public void IsVisible_ClassHasMultipleDynamicVisibleValidationMethods_ThrowsMissingMethodException()
+ {
+ // Setup
+ var o = new InvalidClassWithDynamicVisiblePropertyAndMultipleValidationMethods();
+
+ // Call
+ TestDelegate call = () => DynamicVisibleAttribute.IsVisible(o, "Property");
+
+ // Assert
+ string exceptionMessage = Assert.Throws(call).Message;
+ string expectedMessage = $"Slechts één DynamicVisibleValidationMethod toegestaan per klasse: {o.GetType()}.";
+ Assert.AreEqual(expectedMessage, exceptionMessage);
+ }
+
+ [Test]
+ public void IsVisible_ClassHasDynamicVisibleValidationMethodWithNonBoolReturnType_ThrowsMissingMethodException()
+ {
+ // Setup
+ var o = new InvalidClassWithDynamicVisiblePropertyButValidationMethodReturnsIncorrectValueType();
+
+ // Call
+ TestDelegate call = () => DynamicVisibleAttribute.IsVisible(o, "Property");
+
+ // Assert
+ string exceptionMessage = Assert.Throws(call).Message;
+ string expectedMessage = $"DynamicVisibleValidationMethod moet 'bool' als 'return type' hebben. Klasse: {o.GetType()}.";
+ Assert.AreEqual(expectedMessage, exceptionMessage);
+ }
+
+ [Test]
+ public void IsVisible_ClassHasDynamicVisibleValidationMethodWithIncorrectArgumentCount_ThrowsMissingMethodException()
+ {
+ // Setup
+ var o = new InvalidClassWithDynamicVisiblePropertyButValidationMethodNotOneArgument();
+
+ // Call
+ TestDelegate call = () => DynamicVisibleAttribute.IsVisible(o, "Property");
+
+ // Assert
+ string exceptionMessage = Assert.Throws(call).Message;
+ string expectedMessage = $"DynamicVisibleValidationMethod heeft een incorrect aantal argumenten. Zou er één moeten zijn. Klasse: {o.GetType()}.";
+ Assert.AreEqual(expectedMessage, exceptionMessage);
+ }
+
+ [Test]
+ public void IsVisible_ClassHasDynamicVisibleValidationMethodWithIncorrectArgumentType_ThrowsMissingMethodException()
+ {
+ // Setup
+ var o = new InvalidClassWithDynamicVisiblePropertyButValidationMethodArgumentNotString();
+
+ // Call
+ TestDelegate call = () => DynamicVisibleAttribute.IsVisible(o, "Property");
+
+ // Assert
+ string exceptionMessage = Assert.Throws(call).Message;
+ string expectedMessage = $"Argument van DynamicVisibleValidationMethod moet van het type 'string' zijn. Klasse: {o.GetType()}.";
+ Assert.AreEqual(expectedMessage, exceptionMessage);
+ }
+
+ [Test]
+ [TestCase(false)]
+ [TestCase(true)]
+ public void IsVisible_ClassWithDynamicVisibleProperty_ReturnResultFromValidationMethod(bool isVisible)
+ {
+ // Setup
+ var o = new ClassWithDynamicVisibleProperty(isVisible);
+
+ // Call
+ bool result = DynamicVisibleAttribute.IsVisible(o, "Property");
+
+ // Assert
+ Assert.AreEqual(isVisible, result);
+ }
+ }
+}
\ No newline at end of file
Index: Core/Gui/test/Core.Gui.Test/Attributes/DynamicVisibleValidationMethodAttributeTest.cs
===================================================================
diff -u
--- Core/Gui/test/Core.Gui.Test/Attributes/DynamicVisibleValidationMethodAttributeTest.cs (revision 0)
+++ Core/Gui/test/Core.Gui.Test/Attributes/DynamicVisibleValidationMethodAttributeTest.cs (revision 781a97409ffc49e5b666a7856f633f46178056df)
@@ -0,0 +1,122 @@
+// Copyright (C) Stichting Deltares 2021. 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.Gui.Attributes;
+using Core.Gui.Test.Attributes.TestCaseClasses;
+using NUnit.Framework;
+
+namespace Core.Gui.Test.Attributes
+{
+ [TestFixture]
+ public class DynamicVisibleValidationMethodAttributeTest
+ {
+ [Test]
+ public void CreateIsVisibleMethod_ClassLacksDynamicVisibleValidationMethod_ThrowsMissingMethodException()
+ {
+ // Setup
+ var o = new InvalidClassWithDynamicVisiblePropertyButNoValidationMethod();
+
+ // Call
+ TestDelegate call = () => DynamicVisibleValidationMethodAttribute.CreateIsVisibleMethod(o);
+
+ // Assert
+ string exceptionMessage = Assert.Throws(call).Message;
+ string expectedMessage = $"DynamicVisibleValidationMethod niet gevonden (of geen 'public' toegankelijkheid). Klasse: {o.GetType()}.";
+ Assert.AreEqual(expectedMessage, exceptionMessage);
+ }
+
+ [Test]
+ public void CreateIsVisibleMethod_ClassHasMultipleDynamicVisibleValidationMethods_ThrowsMissingMethodException()
+ {
+ // Setup
+ var o = new InvalidClassWithDynamicVisiblePropertyAndMultipleValidationMethods();
+
+ // Call
+ TestDelegate call = () => DynamicVisibleValidationMethodAttribute.CreateIsVisibleMethod(o);
+
+ // Assert
+ string exceptionMessage = Assert.Throws(call).Message;
+ string expectedMessage = $"Slechts één DynamicVisibleValidationMethod toegestaan per klasse: {o.GetType()}.";
+ Assert.AreEqual(expectedMessage, exceptionMessage);
+ }
+
+ [Test]
+ public void CreateIsVisibleMethod_ClassHasDynamicVisibleValidationMethodWithNonBoolReturnType_ThrowsMissingMethodException()
+ {
+ // Setup
+ var o = new InvalidClassWithDynamicVisiblePropertyButValidationMethodReturnsIncorrectValueType();
+
+ // Call
+ TestDelegate call = () => DynamicVisibleValidationMethodAttribute.CreateIsVisibleMethod(o);
+
+ // Assert
+ string exceptionMessage = Assert.Throws(call).Message;
+ string expectedMessage = $"DynamicVisibleValidationMethod moet 'bool' als 'return type' hebben. Klasse: {o.GetType()}.";
+ Assert.AreEqual(expectedMessage, exceptionMessage);
+ }
+
+ [Test]
+ public void CreateIsVisibleMethod_ClassHasDynamicVisibleValidationMethodWithIncorrectArgumentCount_ThrowsMissingMethodException()
+ {
+ // Setup
+ var o = new InvalidClassWithDynamicVisiblePropertyButValidationMethodNotOneArgument();
+
+ // Call
+ TestDelegate call = () => DynamicVisibleValidationMethodAttribute.CreateIsVisibleMethod(o);
+
+ // Assert
+ string exceptionMessage = Assert.Throws(call).Message;
+ string expectedMessage = $"DynamicVisibleValidationMethod heeft een incorrect aantal argumenten. Zou er één moeten zijn. Klasse: {o.GetType()}.";
+ Assert.AreEqual(expectedMessage, exceptionMessage);
+ }
+
+ [Test]
+ public void CreateIsVisibleMethod_ClassHasDynamicVisibleValidationMethodWithIncorrectArgumentType_ThrowsMissingMethodException()
+ {
+ // Setup
+ var o = new InvalidClassWithDynamicVisiblePropertyButValidationMethodArgumentNotString();
+
+ // Call
+ TestDelegate call = () => DynamicVisibleValidationMethodAttribute.CreateIsVisibleMethod(o);
+
+ // Assert
+ string exceptionMessage = Assert.Throws(call).Message;
+ string expectedMessage = $"Argument van DynamicVisibleValidationMethod moet van het type 'string' zijn. Klasse: {o.GetType()}.";
+ Assert.AreEqual(expectedMessage, exceptionMessage);
+ }
+
+ [Test]
+ [TestCase(false)]
+ [TestCase(true)]
+ public void CreateIsVisibleMethod_ClassWithDynamicVisibleProperty_ReturnResultFromValidationMethod(bool isVisible)
+ {
+ // Setup
+ var o = new ClassWithDynamicVisibleProperty(isVisible);
+
+ // Call
+ DynamicVisibleValidationMethodAttribute.IsPropertyVisible result = DynamicVisibleValidationMethodAttribute.CreateIsVisibleMethod(o);
+
+ // Assert
+ Assert.AreEqual(isVisible, result("Property"));
+ }
+ }
+}
\ No newline at end of file
Index: Core/Gui/test/Core.Gui.Test/Attributes/PropertyOrderAttributeTest.cs
===================================================================
diff -u
--- Core/Gui/test/Core.Gui.Test/Attributes/PropertyOrderAttributeTest.cs (revision 0)
+++ Core/Gui/test/Core.Gui.Test/Attributes/PropertyOrderAttributeTest.cs (revision 781a97409ffc49e5b666a7856f633f46178056df)
@@ -0,0 +1,45 @@
+// Copyright (C) Stichting Deltares 2021. 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.Gui.Attributes;
+using NUnit.Framework;
+
+namespace Core.Gui.Test.Attributes
+{
+ [TestFixture]
+ public class PropertyOrderAttributeTest
+ {
+ [Test]
+ public void ParameteredConstructor_ExpectedValues()
+ {
+ // Setup
+ int order = new Random(21).Next(int.MinValue, int.MaxValue);
+
+ // Call
+ var attribute = new PropertyOrderAttribute(order);
+
+ // Assert
+ Assert.IsInstanceOf(attribute);
+ Assert.AreEqual(order, attribute.Order);
+ }
+ }
+}
\ No newline at end of file
Index: Core/Gui/test/Core.Gui.Test/Attributes/TestCaseClasses/DynamicPropertyOrderTestCases.cs
===================================================================
diff -u
--- Core/Gui/test/Core.Gui.Test/Attributes/TestCaseClasses/DynamicPropertyOrderTestCases.cs (revision 0)
+++ Core/Gui/test/Core.Gui.Test/Attributes/TestCaseClasses/DynamicPropertyOrderTestCases.cs (revision 781a97409ffc49e5b666a7856f633f46178056df)
@@ -0,0 +1,109 @@
+// Copyright (C) Stichting Deltares 2021. 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 Core.Gui.Attributes;
+
+namespace Core.Gui.Test.Attributes.TestCaseClasses
+{
+ internal class ClassWithPropertyWithoutDynamicPropertyOrderAttribute
+ {
+ public double Property { get; set; }
+ }
+
+ internal class InvalidClassWithDynamicPropertyOrderPropertyButNoEvaluationMethod
+ {
+ [DynamicPropertyOrder]
+ public double Property { get; set; }
+ }
+
+ internal class InvalidClassWithDynamicPropertyOrderPropertyAndMultipleEvaluationMethods
+ {
+ [DynamicPropertyOrder]
+ public double Property { get; set; }
+
+ [DynamicPropertyOrderEvaluationMethod]
+ public int DynamicPropertyOrder1(string propertyName)
+ {
+ return 1;
+ }
+
+ [DynamicPropertyOrderEvaluationMethod]
+ public int DynamicPropertyOrder2(string propertyName)
+ {
+ return 2;
+ }
+ }
+
+ internal class InvalidClassWithDynamicPropertyOrderPropertyButEvaluationMethodReturnsIncorrectValueType
+ {
+ [DynamicPropertyOrder]
+ public double Property { get; set; }
+
+ [DynamicPropertyOrderEvaluationMethod]
+ public double DynamicPropertyOrder(string propertyName)
+ {
+ return 0.1;
+ }
+ }
+
+ internal class InvalidClassWithDynamicPropertyOrderPropertyButEvaluationMethodNotOneArgument
+ {
+ [DynamicPropertyOrder]
+ public double Property { get; set; }
+
+ [DynamicPropertyOrderEvaluationMethod]
+ public int DynamicPropertyOrder(object o, string propertyName)
+ {
+ return 1;
+ }
+ }
+
+ internal class InvalidClassWithDynamicPropertyOrderPropertyButEvaluationMethodArgumentNotString
+ {
+ [DynamicPropertyOrder]
+ public double Property { get; set; }
+
+ [DynamicPropertyOrderEvaluationMethod]
+ public int DynamicPropertyOrder(object o)
+ {
+ return 1;
+ }
+ }
+
+ internal class ClassWithDynamicPropertyOrderProperty
+ {
+ private readonly int order;
+
+ public ClassWithDynamicPropertyOrderProperty(int order)
+ {
+ this.order = order;
+ }
+
+ [DynamicPropertyOrder]
+ public double Property { get; set; }
+
+ [DynamicPropertyOrderEvaluationMethod]
+ public int DynamicPropertyOrder(string propertyName)
+ {
+ return order;
+ }
+ }
+}
\ No newline at end of file
Index: Core/Gui/test/Core.Gui.Test/Attributes/TestCaseClasses/DynamicReadOnlyTestCases.cs
===================================================================
diff -u
--- Core/Gui/test/Core.Gui.Test/Attributes/TestCaseClasses/DynamicReadOnlyTestCases.cs (revision 0)
+++ Core/Gui/test/Core.Gui.Test/Attributes/TestCaseClasses/DynamicReadOnlyTestCases.cs (revision 781a97409ffc49e5b666a7856f633f46178056df)
@@ -0,0 +1,109 @@
+// Copyright (C) Stichting Deltares 2021. 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 Core.Gui.Attributes;
+
+namespace Core.Gui.Test.Attributes.TestCaseClasses
+{
+ internal class ClassWithPropertyWithoutDynamicReadOnlyAttribute
+ {
+ public double Property { get; set; }
+ }
+
+ internal class InvalidClassWithDynamicReadOnlyPropertyButNoValidationMethod
+ {
+ [DynamicReadOnly]
+ public double Property { get; set; }
+ }
+
+ internal class InvalidClassWithDynamicReadOnlyPropertyAndMultipleValidationMethods
+ {
+ [DynamicReadOnly]
+ public double Property { get; set; }
+
+ [DynamicReadOnlyValidationMethod]
+ public bool IsDynamicReadOnly1(string propertyName)
+ {
+ return true;
+ }
+
+ [DynamicReadOnlyValidationMethod]
+ public bool IsDynamicReadOnly2(string propertyName)
+ {
+ return false;
+ }
+ }
+
+ internal class InvalidClassWithDynamicReadOnlyPropertyButValidationMethodReturnsIncorrectValueType
+ {
+ [DynamicReadOnly]
+ public double Property { get; set; }
+
+ [DynamicReadOnlyValidationMethod]
+ public int IsDynamicReadOnly(string propertyName)
+ {
+ return 0;
+ }
+ }
+
+ internal class InvalidClassWithDynamicReadOnlyPropertyButValidationMethodNotOneArgument
+ {
+ [DynamicReadOnly]
+ public double Property { get; set; }
+
+ [DynamicReadOnlyValidationMethod]
+ public bool IsDynamicReadOnly(object o, string propertyName)
+ {
+ return true;
+ }
+ }
+
+ internal class InvalidClassWithDynamicReadOnlyPropertyButValidationMethodArgumentNotString
+ {
+ [DynamicReadOnly]
+ public double Property { get; set; }
+
+ [DynamicReadOnlyValidationMethod]
+ public bool IsDynamicReadOnly(object o)
+ {
+ return true;
+ }
+ }
+
+ internal class ClassWithDynamicReadOnlyProperty
+ {
+ private readonly bool isReadOnly;
+
+ public ClassWithDynamicReadOnlyProperty(bool isReadOnly)
+ {
+ this.isReadOnly = isReadOnly;
+ }
+
+ [DynamicReadOnly]
+ public double Property { get; set; }
+
+ [DynamicReadOnlyValidationMethod]
+ public bool IsDynamicReadOnly(string propertyName)
+ {
+ return isReadOnly;
+ }
+ }
+}
\ No newline at end of file
Index: Core/Gui/test/Core.Gui.Test/Attributes/TestCaseClasses/DynamicVisibilityTestCases.cs
===================================================================
diff -u
--- Core/Gui/test/Core.Gui.Test/Attributes/TestCaseClasses/DynamicVisibilityTestCases.cs (revision 0)
+++ Core/Gui/test/Core.Gui.Test/Attributes/TestCaseClasses/DynamicVisibilityTestCases.cs (revision 781a97409ffc49e5b666a7856f633f46178056df)
@@ -0,0 +1,109 @@
+// Copyright (C) Stichting Deltares 2021. 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 Core.Gui.Attributes;
+
+namespace Core.Gui.Test.Attributes.TestCaseClasses
+{
+ internal class ClassWithPropertyWithoutDynamicVisibleAttribute
+ {
+ public double Property { get; set; }
+ }
+
+ internal class InvalidClassWithDynamicVisiblePropertyButNoValidationMethod
+ {
+ [DynamicVisible]
+ public double Property { get; set; }
+ }
+
+ internal class InvalidClassWithDynamicVisiblePropertyAndMultipleValidationMethods
+ {
+ [DynamicVisible]
+ public double Property { get; set; }
+
+ [DynamicVisibleValidationMethod]
+ public bool IsDynamicVisible1(string propertyName)
+ {
+ return true;
+ }
+
+ [DynamicVisibleValidationMethod]
+ public bool IsDynamicVisible2(string propertyName)
+ {
+ return false;
+ }
+ }
+
+ internal class InvalidClassWithDynamicVisiblePropertyButValidationMethodReturnsIncorrectValueType
+ {
+ [DynamicVisible]
+ public double Property { get; set; }
+
+ [DynamicVisibleValidationMethod]
+ public int IsDynamicVisible(string propertyName)
+ {
+ return 0;
+ }
+ }
+
+ internal class InvalidClassWithDynamicVisiblePropertyButValidationMethodNotOneArgument
+ {
+ [DynamicVisible]
+ public double Property { get; set; }
+
+ [DynamicVisibleValidationMethod]
+ public bool IsDynamicVisible(object o, string propertyName)
+ {
+ return true;
+ }
+ }
+
+ internal class InvalidClassWithDynamicVisiblePropertyButValidationMethodArgumentNotString
+ {
+ [DynamicVisible]
+ public double Property { get; set; }
+
+ [DynamicVisibleValidationMethod]
+ public bool IsDynamicVisible(object o)
+ {
+ return true;
+ }
+ }
+
+ internal class ClassWithDynamicVisibleProperty
+ {
+ private readonly bool isVisible;
+
+ public ClassWithDynamicVisibleProperty(bool isVisible)
+ {
+ this.isVisible = isVisible;
+ }
+
+ [DynamicVisible]
+ public double Property { get; set; }
+
+ [DynamicVisibleValidationMethod]
+ public bool IsDynamicVisible(string propertyName)
+ {
+ return isVisible;
+ }
+ }
+}
\ No newline at end of file
Index: Core/Gui/test/Core.Gui.Test/Clipboard/ClipboardProviderTest.cs
===================================================================
diff -u
--- Core/Gui/test/Core.Gui.Test/Clipboard/ClipboardProviderTest.cs (revision 0)
+++ Core/Gui/test/Core.Gui.Test/Clipboard/ClipboardProviderTest.cs (revision 781a97409ffc49e5b666a7856f633f46178056df)
@@ -0,0 +1,36 @@
+// Copyright (C) Stichting Deltares 2021. 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 Core.Gui.Clipboard;
+using NUnit.Framework;
+
+namespace Core.Gui.Test.Clipboard
+{
+ [TestFixture]
+ public class ClipboardProviderTest
+ {
+ [Test]
+ public void Clipboard_InitializedCorrectly()
+ {
+ Assert.IsInstanceOf(ClipboardProvider.Clipboard);
+ }
+ }
+}
\ No newline at end of file
Index: Core/Gui/test/Core.Gui.Test/Commands/ApplicationFeatureCommandHandlerTest.cs
===================================================================
diff -u
--- Core/Gui/test/Core.Gui.Test/Commands/ApplicationFeatureCommandHandlerTest.cs (revision 0)
+++ Core/Gui/test/Core.Gui.Test/Commands/ApplicationFeatureCommandHandlerTest.cs (revision 781a97409ffc49e5b666a7856f633f46178056df)
@@ -0,0 +1,99 @@
+// Copyright (C) Stichting Deltares 2021. 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 Core.Gui.Commands;
+using Core.Gui.Forms.MainWindow;
+using Core.Gui.Forms.PropertyGridView;
+using Core.Gui.PropertyBag;
+using NUnit.Framework;
+using Rhino.Mocks;
+
+namespace Core.Gui.Test.Commands
+{
+ [TestFixture]
+ public class ApplicationFeatureCommandHandlerTest
+ {
+ [Test]
+ public void ShowPropertiesFor_InitializeAndShowPropertyGrid()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var propertyResolver = mocks.Stub();
+ var mainWindow = mocks.Stub();
+ mainWindow.Expect(w => w.InitPropertiesWindowOrBringToFront());
+ mocks.ReplayAll();
+
+ var commandHandler = new ApplicationFeatureCommandHandler(propertyResolver, mainWindow);
+
+ // Call
+ commandHandler.ShowPropertiesForSelection();
+
+ // Assert
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CanShowPropertiesFor_ObjectHasProperties_ReturnTrue()
+ {
+ // Setup
+ var target = new object();
+
+ var mocks = new MockRepository();
+ var propertyResolver = mocks.Stub();
+ propertyResolver.Expect(r => r.GetObjectProperties(target))
+ .Return(mocks.Stub());
+ var mainWindow = mocks.Stub();
+ mocks.ReplayAll();
+
+ var commandHandler = new ApplicationFeatureCommandHandler(propertyResolver, mainWindow);
+
+ // Call
+ bool result = commandHandler.CanShowPropertiesFor(target);
+
+ // Assert
+ Assert.IsTrue(result);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CanShowPropertiesFor_ObjectDoesNotHaveProperties_ReturnFalse()
+ {
+ // Setup
+ var target = new object();
+
+ var mocks = new MockRepository();
+ var propertyResolver = mocks.Stub();
+ propertyResolver.Expect(r => r.GetObjectProperties(target))
+ .Return(null);
+ var mainWindow = mocks.Stub();
+ mocks.ReplayAll();
+
+ var commandHandler = new ApplicationFeatureCommandHandler(propertyResolver, mainWindow);
+
+ // Call
+ bool result = commandHandler.CanShowPropertiesFor(target);
+
+ // Assert
+ Assert.IsFalse(result);
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Index: Core/Gui/test/Core.Gui.Test/Commands/GuiExportHandlerTest.cs
===================================================================
diff -u
--- Core/Gui/test/Core.Gui.Test/Commands/GuiExportHandlerTest.cs (revision 0)
+++ Core/Gui/test/Core.Gui.Test/Commands/GuiExportHandlerTest.cs (revision 781a97409ffc49e5b666a7856f633f46178056df)
@@ -0,0 +1,428 @@
+// Copyright (C) Stichting Deltares 2021. 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 System.Collections.Generic;
+using System.Drawing;
+using System.IO;
+using System.Linq;
+using System.Threading;
+using System.Windows.Forms;
+using Core.Common.Base.IO;
+using Core.Common.TestUtil;
+using Core.Common.Util.Reflection;
+using Core.Gui.Commands;
+using Core.Gui.Forms.MainWindow;
+using Core.Gui.Plugin;
+using Core.Gui.Properties;
+using NUnit.Extensions.Forms;
+using NUnit.Framework;
+using Rhino.Mocks;
+
+namespace Core.Gui.Test.Commands
+{
+ [TestFixture]
+ public class GuiExportHandlerTest : NUnitFormTest
+ {
+ [Test]
+ [TestCase(1234)]
+ [TestCase(null)]
+ public void ExportFrom_NoExporterAvailable_GivesMessageBoxAndLogsMessage(object source)
+ {
+ // Setup
+ var mockRepository = new MockRepository();
+ var mainWindow = mockRepository.Stub();
+ mockRepository.ReplayAll();
+
+ string messageBoxText = null;
+ string messageBoxTitle = null;
+
+ DialogBoxHandler = (name, wnd) =>
+ {
+ var messageBox = new MessageBoxTester(wnd);
+
+ messageBoxText = messageBox.Text;
+ messageBoxTitle = messageBox.Title;
+
+ messageBox.ClickOk();
+ };
+
+ var exportHandler = new GuiExportHandler(mainWindow, new List());
+
+ // Call
+ Action call = () => exportHandler.ExportFrom(source);
+
+ // Assert
+ string sourceTypeName = source == null ? "null" : source.GetType().FullName;
+ TestHelper.AssertLogMessageIsGenerated(call, $"Riskeer kan de huidige selectie ({sourceTypeName}) niet exporteren.");
+ Assert.AreEqual("Fout", messageBoxTitle);
+ Assert.AreEqual("Riskeer kan de huidige selectie niet exporteren.", messageBoxText);
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ [TestCase(1234)]
+ [TestCase(null)]
+ public void ExportFrom_NoSupportedExporterAvailable_GivesMessageBoxAndLogsMessage(object source)
+ {
+ // Setup
+ var mockRepository = new MockRepository();
+ var mainWindow = mockRepository.Stub();
+ mockRepository.ReplayAll();
+
+ string messageBoxText = null;
+ string messageBoxTitle = null;
+
+ DialogBoxHandler = (name, wnd) =>
+ {
+ var messageBox = new MessageBoxTester(wnd);
+
+ messageBoxText = messageBox.Text;
+ messageBoxTitle = messageBox.Title;
+
+ messageBox.ClickOk();
+ };
+
+ var exportHandler = new GuiExportHandler(mainWindow, new List
+ {
+ new ExportInfo()
+ });
+
+ // Call
+ Action call = () => exportHandler.ExportFrom(source);
+
+ // Assert
+ string sourceTypeName = source == null ? "null" : source.GetType().FullName;
+ TestHelper.AssertLogMessageIsGenerated(call, $"Riskeer kan de huidige selectie ({sourceTypeName}) niet exporteren.");
+ Assert.AreEqual("Fout", messageBoxTitle);
+ Assert.AreEqual("Riskeer kan de huidige selectie niet exporteren.", messageBoxText);
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ [Apartment(ApartmentState.STA)]
+ public void ExportFrom_SupportedExporterAvailableNoFilePathGiven_AbortsExport()
+ {
+ // Setup
+ var mockRepository = new MockRepository();
+ var mainWindow = mockRepository.Stub();
+ var exporter = mockRepository.StrictMock();
+ mockRepository.ReplayAll();
+
+ var exportHandler = new GuiExportHandler(mainWindow, new List
+ {
+ new ExportInfo
+ {
+ CreateFileExporter = (o, s) => exporter,
+ GetExportPath = () => null
+ }
+ });
+
+ // Call
+ exportHandler.ExportFrom(1234);
+
+ // Assert
+ mockRepository.VerifyAll(); // Expect no calls on exporter mock
+ }
+
+ [Test]
+ [Apartment(ApartmentState.STA)]
+ public void ExportFrom_SupportedExporterAvailableAndFilePathGivenAndExporterRunsSuccessful_CallsExportAndLogsMessages()
+ {
+ // Setup
+ var mockRepository = new MockRepository();
+ var mainWindow = mockRepository.Stub();
+ var exporter = mockRepository.StrictMock();
+ exporter.Stub(e => e.Export()).Return(true);
+ mockRepository.ReplayAll();
+
+ const int expectedData = 1234;
+ string targetExportFileName = Path.GetFullPath("exportFile.txt");
+
+ const string exportInfoName = "Random data";
+ var exportHandler = new GuiExportHandler(mainWindow, new List
+ {
+ new ExportInfo
+ {
+ Name = exportInfoName,
+ CreateFileExporter = (data, filePath) =>
+ {
+ Assert.AreEqual(expectedData, data);
+ Assert.AreEqual(targetExportFileName, filePath);
+ return exporter;
+ },
+ GetExportPath = () => targetExportFileName
+ }
+ });
+
+ // Call
+ Action call = () => exportHandler.ExportFrom(expectedData);
+
+ // Assert
+ TestHelper.AssertLogMessagesAreGenerated(call, new[]
+ {
+ $"Exporteren van '{exportInfoName}' is gestart.",
+ $"Gegevens zijn geëxporteerd naar bestand '{targetExportFileName}'.",
+ $"Exporteren van '{exportInfoName}' is gelukt."
+ });
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ [Apartment(ApartmentState.STA)]
+ public void ExportFrom_SupportedExporterAvailableAndFilePathGivenAndExporterFails_CallsExportAndLogsMessages()
+ {
+ // Setup
+ var mockRepository = new MockRepository();
+ var mainWindow = mockRepository.Stub();
+ var exporter = mockRepository.StrictMock();
+ exporter.Stub(e => e.Export()).Return(false);
+ mockRepository.ReplayAll();
+
+ string targetExportFileName = Path.GetFullPath("exportFile.txt");
+
+ const string exportInfoName = "Random data";
+ var exportHandler = new GuiExportHandler(mainWindow, new List
+ {
+ new ExportInfo
+ {
+ Name = exportInfoName,
+ CreateFileExporter = (data, filePath) => exporter,
+ GetExportPath = () => targetExportFileName
+ }
+ });
+
+ // Call
+ Action call = () => exportHandler.ExportFrom(1234);
+
+ // Assert
+ TestHelper.AssertLogMessagesAreGenerated(call, new[]
+ {
+ $"Exporteren van '{exportInfoName}' is gestart.",
+ $"Exporteren van '{exportInfoName}' is mislukt."
+ });
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ [Apartment(ApartmentState.STA)]
+ public void ExportFrom_MultipleSupportedExportersAvailableWithDefaultSelectionDialogStyling_GivesExpectedSelectionDialog()
+ {
+ // Setup
+ var mockRepository = new MockRepository();
+ var mainWindow = mockRepository.Stub();
+ mockRepository.ReplayAll();
+
+ var dialogText = "";
+ TestListViewItem[] listViewItems = null;
+
+ ModalFormHandler = (name, wnd, form) =>
+ {
+ var dialog = new FormTester(name);
+ var imageList = TypeUtils.GetField(dialog.TheObject, "imageList");
+ var listView = (ListView) new ControlTester("listViewItemTypes").TheObject;
+
+ dialogText = dialog.Text;
+ listViewItems = listView.Items
+ .OfType()
+ .Select(lvi => new TestListViewItem(lvi.Name, lvi.Group.Name, imageList.Images[lvi.ImageIndex]))
+ .ToArray();
+
+ dialog.Close();
+ };
+
+ var exportHandler = new GuiExportHandler(mainWindow, new List
+ {
+ new ExportInfo(),
+ new ExportInfo()
+ });
+
+ // Call
+ exportHandler.ExportFrom(1234);
+
+ // Assert
+ Assert.AreEqual("Kies wat u wilt exporteren", dialogText);
+
+ Assert.AreEqual(2, listViewItems.Length);
+ Assert.AreEqual("", listViewItems[0].Name);
+ Assert.AreEqual("Algemeen", listViewItems[0].Group);
+ Assert.AreEqual("", listViewItems[1].Name);
+ Assert.AreEqual("Algemeen", listViewItems[1].Group);
+
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void CanExportFrom_HasNoFileExportersForTarget_ReturnFalse()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var dialogParent = mocks.Stub();
+ mocks.ReplayAll();
+
+ var commandHandler = new GuiExportHandler(dialogParent, new List
+ {
+ new ExportInfo(), // Wrong object type
+ new ExportInfo