Index: Core/Common/src/Core.Common.Controls.Charting/Series/AreaChartSeries.cs =================================================================== diff -u -r3bfa4dc5fb5ea3560752479de86cb843419f8fe3 -r1a6f65407809a58d25b871af1fc77d6323c6c83a --- Core/Common/src/Core.Common.Controls.Charting/Series/AreaChartSeries.cs (.../AreaChartSeries.cs) (revision 3bfa4dc5fb5ea3560752479de86cb843419f8fe3) +++ Core/Common/src/Core.Common.Controls.Charting/Series/AreaChartSeries.cs (.../AreaChartSeries.cs) (revision 1a6f65407809a58d25b871af1fc77d6323c6c83a) @@ -2,6 +2,8 @@ using System.Drawing; using System.Drawing.Drawing2D; using Core.Common.Utils; +using Core.Common.Utils.Extensions; + using Steema.TeeChart.Styles; namespace Core.Common.Controls.Charting.Series @@ -120,7 +122,7 @@ } set { - areaSeries.LinePen.Width = MathUtils.ClipValue(value, MinimumAllowedSize, MaximumAllowedSize); + areaSeries.LinePen.Width = value.ClipValue(MinimumAllowedSize, MaximumAllowedSize); } } @@ -168,8 +170,8 @@ } set { - areaSeries.Pointer.VertSize = MathUtils.ClipValue(value, MinimumAllowedSize, MaximumAllowedSize); - areaSeries.Pointer.HorizSize = MathUtils.ClipValue(value, MinimumAllowedSize, MaximumAllowedSize); + areaSeries.Pointer.VertSize = value.ClipValue(MinimumAllowedSize, MaximumAllowedSize); + areaSeries.Pointer.HorizSize = value.ClipValue(MinimumAllowedSize, MaximumAllowedSize); } } Index: Core/Common/src/Core.Common.Controls.Charting/Series/BarSeries.cs =================================================================== diff -u -r3bfa4dc5fb5ea3560752479de86cb843419f8fe3 -r1a6f65407809a58d25b871af1fc77d6323c6c83a --- Core/Common/src/Core.Common.Controls.Charting/Series/BarSeries.cs (.../BarSeries.cs) (revision 3bfa4dc5fb5ea3560752479de86cb843419f8fe3) +++ Core/Common/src/Core.Common.Controls.Charting/Series/BarSeries.cs (.../BarSeries.cs) (revision 1a6f65407809a58d25b871af1fc77d6323c6c83a) @@ -1,6 +1,8 @@ using System.Drawing; using System.Drawing.Drawing2D; using Core.Common.Utils; +using Core.Common.Utils.Extensions; + using Steema.TeeChart.Styles; namespace Core.Common.Controls.Charting.Series @@ -67,7 +69,7 @@ } set { - barSeries.Pen.Width = MathUtils.ClipValue(value, MinimumAllowedSize, MaximumAllowedSize); + barSeries.Pen.Width = value.ClipValue(MinimumAllowedSize, MaximumAllowedSize); } } Index: Core/Common/src/Core.Common.Controls.Charting/Series/LineChartSeries.cs =================================================================== diff -u -r3bfa4dc5fb5ea3560752479de86cb843419f8fe3 -r1a6f65407809a58d25b871af1fc77d6323c6c83a --- Core/Common/src/Core.Common.Controls.Charting/Series/LineChartSeries.cs (.../LineChartSeries.cs) (revision 3bfa4dc5fb5ea3560752479de86cb843419f8fe3) +++ Core/Common/src/Core.Common.Controls.Charting/Series/LineChartSeries.cs (.../LineChartSeries.cs) (revision 1a6f65407809a58d25b871af1fc77d6323c6c83a) @@ -2,6 +2,8 @@ using System.Drawing; using System.Drawing.Drawing2D; using Core.Common.Utils; +using Core.Common.Utils.Extensions; + using Steema.TeeChart.Styles; namespace Core.Common.Controls.Charting.Series @@ -49,7 +51,7 @@ } set { - lineSeries.LinePen.Width = MathUtils.ClipValue(value, MinimumAllowedSize, MaximumAllowedSize); + lineSeries.LinePen.Width = value.ClipValue(MinimumAllowedSize, MaximumAllowedSize); } } @@ -110,8 +112,8 @@ set { // just keep it square at this moment. - lineSeries.Pointer.VertSize = MathUtils.ClipValue(value, MinimumAllowedSize, MaximumAllowedSize); - lineSeries.Pointer.HorizSize = MathUtils.ClipValue(value, MinimumAllowedSize, MaximumAllowedSize); + lineSeries.Pointer.VertSize = value.ClipValue(MinimumAllowedSize, MaximumAllowedSize); + lineSeries.Pointer.HorizSize = value.ClipValue(MinimumAllowedSize, MaximumAllowedSize); } } Index: Core/Common/src/Core.Common.Controls.Charting/Series/PointChartSeries.cs =================================================================== diff -u -r3bfa4dc5fb5ea3560752479de86cb843419f8fe3 -r1a6f65407809a58d25b871af1fc77d6323c6c83a --- Core/Common/src/Core.Common.Controls.Charting/Series/PointChartSeries.cs (.../PointChartSeries.cs) (revision 3bfa4dc5fb5ea3560752479de86cb843419f8fe3) +++ Core/Common/src/Core.Common.Controls.Charting/Series/PointChartSeries.cs (.../PointChartSeries.cs) (revision 1a6f65407809a58d25b871af1fc77d6323c6c83a) @@ -1,6 +1,8 @@ using System; using System.Drawing; using Core.Common.Utils; +using Core.Common.Utils.Extensions; + using Steema.TeeChart.Styles; namespace Core.Common.Controls.Charting.Series @@ -44,8 +46,8 @@ set { // just keep it square at this moment. - pointSeries.Pointer.VertSize = MathUtils.ClipValue(value, MinimumAllowedSize, MaximumAllowedSize); - pointSeries.Pointer.HorizSize = MathUtils.ClipValue(value, MinimumAllowedSize, MaximumAllowedSize); + pointSeries.Pointer.VertSize = value.ClipValue(MinimumAllowedSize, MaximumAllowedSize); + pointSeries.Pointer.HorizSize = value.ClipValue(MinimumAllowedSize, MaximumAllowedSize); } } Index: Core/Common/src/Core.Common.Controls.Charting/Series/PolygonChartSeries.cs =================================================================== diff -u -r3bfa4dc5fb5ea3560752479de86cb843419f8fe3 -r1a6f65407809a58d25b871af1fc77d6323c6c83a --- Core/Common/src/Core.Common.Controls.Charting/Series/PolygonChartSeries.cs (.../PolygonChartSeries.cs) (revision 3bfa4dc5fb5ea3560752479de86cb843419f8fe3) +++ Core/Common/src/Core.Common.Controls.Charting/Series/PolygonChartSeries.cs (.../PolygonChartSeries.cs) (revision 1a6f65407809a58d25b871af1fc77d6323c6c83a) @@ -3,6 +3,7 @@ using System.Drawing.Drawing2D; using Core.Common.Controls.Charting.Properties; using Core.Common.Utils; +using Core.Common.Utils.Extensions; namespace Core.Common.Controls.Charting.Series { @@ -59,7 +60,7 @@ } set { - polygonSeries.Pen.Width = MathUtils.ClipValue(value, MinimumAllowedSize, MaximumAllowedSize); + polygonSeries.Pen.Width = value.ClipValue(MinimumAllowedSize, MaximumAllowedSize); } } Index: Core/Common/src/Core.Common.Utils/Core.Common.Utils.csproj =================================================================== diff -u -rb81978adc73edcf368115b58fd37f34dc7fb6ab5 -r1a6f65407809a58d25b871af1fc77d6323c6c83a --- Core/Common/src/Core.Common.Utils/Core.Common.Utils.csproj (.../Core.Common.Utils.csproj) (revision b81978adc73edcf368115b58fd37f34dc7fb6ab5) +++ Core/Common/src/Core.Common.Utils/Core.Common.Utils.csproj (.../Core.Common.Utils.csproj) (revision 1a6f65407809a58d25b871af1fc77d6323c6c83a) @@ -79,9 +79,7 @@ 3.5 - - @@ -110,9 +108,7 @@ - - Index: Core/Common/src/Core.Common.Utils/Extensions/ComparableExtensions.cs =================================================================== diff -u -r2a1dc72ed9a202b720c26828e5d53cecc5a0e6c8 -r1a6f65407809a58d25b871af1fc77d6323c6c83a --- Core/Common/src/Core.Common.Utils/Extensions/ComparableExtensions.cs (.../ComparableExtensions.cs) (revision 2a1dc72ed9a202b720c26828e5d53cecc5a0e6c8) +++ Core/Common/src/Core.Common.Utils/Extensions/ComparableExtensions.cs (.../ComparableExtensions.cs) (revision 1a6f65407809a58d25b871af1fc77d6323c6c83a) @@ -53,28 +53,65 @@ /// Determines where one object is within the inclusive bounds of some range. /// /// Value to be checked. - /// First range value. - /// Second range value. + /// First range value. + /// Second range value. /// True if falls within the inclusive bounds, false otherwise. /// Object type of - /// is not the same as that of or . - public static bool IsInRange(this IComparable value, IComparable limitOne, IComparable limitTwo) + /// is not the same as that of or . + public static bool IsInRange(this IComparable value, IComparable limit1, IComparable limit2) { IComparable min; IComparable max; - if (limitOne.IsSmaller(limitTwo)) + if (limit1.IsSmaller(limit2)) { - min = limitOne; - max = limitTwo; + min = limit1; + max = limit2; } else { - min = limitTwo; - max = limitOne; + min = limit2; + max = limit1; } return (min.IsSmaller(value) && max.IsBigger(value)) || min.CompareTo(value) == 0 || max.CompareTo(value) == 0; } + + /// + /// This method returns the clipped value of a value given an inclusive value range. + /// + /// A comparable object type. + /// The value to be clipped. + /// First range value. + /// Second range value. + /// The clipped value within the given validity range. + /// Object type of + /// is not the same as that of or . + public static T ClipValue(this T value, T limit1, T limit2) where T : IComparable + { + T min; + T max; + + if (limit1.IsSmaller(limit2)) + { + min = limit1; + max = limit2; + } + else + { + min = limit2; + max = limit1; + } + + if (value.IsSmaller(min)) + { + return min; + } + if (value.IsBigger(max)) + { + return max; + } + return value; + } } } \ No newline at end of file Fisheye: Tag 1a6f65407809a58d25b871af1fc77d6323c6c83a refers to a dead (removed) revision in file `Core/Common/src/Core.Common.Utils/MathUtils.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1a6f65407809a58d25b871af1fc77d6323c6c83a refers to a dead (removed) revision in file `Core/Common/src/Core.Common.Utils/TypeConverter.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Common/test/Core.Common.TestUtil.Test/Core.Common.TestUtil.Test.csproj =================================================================== diff -u -r00c8bc7fed580b4a9820a7d85b3b6d2346599f65 -r1a6f65407809a58d25b871af1fc77d6323c6c83a --- Core/Common/test/Core.Common.TestUtil.Test/Core.Common.TestUtil.Test.csproj (.../Core.Common.TestUtil.Test.csproj) (revision 00c8bc7fed580b4a9820a7d85b3b6d2346599f65) +++ Core/Common/test/Core.Common.TestUtil.Test/Core.Common.TestUtil.Test.csproj (.../Core.Common.TestUtil.Test.csproj) (revision 1a6f65407809a58d25b871af1fc77d6323c6c83a) @@ -38,14 +38,24 @@ pdbonly + + ..\..\..\..\packages\log4net.2.0.4\lib\net40-full\log4net.dll + True + ..\..\..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll + + + True + True + Resources.resx + @@ -59,6 +69,18 @@ Core.Common.TestUtil + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\abacus.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\acorn.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file Index: Core/Common/test/Core.Common.TestUtil.Test/Resources/abacus.png =================================================================== diff -u Binary files differ Index: Core/Common/test/Core.Common.TestUtil.Test/Resources/acorn.png =================================================================== diff -u Binary files differ Index: Core/Common/test/Core.Common.TestUtil.Test/TestHelperTest.cs =================================================================== diff -u -r7612d0b14bca5e0686b654dc0ffb96fcc0ff0a2b -r1a6f65407809a58d25b871af1fc77d6323c6c83a --- Core/Common/test/Core.Common.TestUtil.Test/TestHelperTest.cs (.../TestHelperTest.cs) (revision 7612d0b14bca5e0686b654dc0ffb96fcc0ff0a2b) +++ Core/Common/test/Core.Common.TestUtil.Test/TestHelperTest.cs (.../TestHelperTest.cs) (revision 1a6f65407809a58d25b871af1fc77d6323c6c83a) @@ -1,11 +1,21 @@ -using System.IO; +using System; +using System.Drawing; +using System.IO; +using System.Windows.Forms; + +using Core.Common.TestUtil.Test.Properties; + +using log4net; + using NUnit.Framework; namespace Core.Common.TestUtil.Test { [TestFixture] public class TestHelperTest { + private static readonly ILog log = LogManager.GetLogger(typeof(TestHelperTest)); + [Test] public void CanOpenFileForWrite_InvalidPath_DoesNotThrowAnyExceptions() { @@ -50,5 +60,361 @@ Assert.IsTrue(File.Exists(validPath)); File.Delete(validPath); } + + [Test] + public void TestDataDirectory() + { + var dir = TestHelper.TestDataDirectory; + Assert.IsTrue(Directory.Exists(dir)); + } + + [Test] + public void GetFullPathForTestFile() + { + Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "..")); + string fullPath = TestHelper.GetTestFilePath("Test.txt"); + Assert.IsTrue(File.Exists(fullPath)); + } + + [Test] + public void GetTestDataPath_Always_VerifiedTestPaths() + { + // Core Common Base + var path = TestHelper.GetTestDataPath(TestDataPath.Core.Common.Base); + Assert.IsTrue(Directory.Exists(path)); + + // Core Common Utils + path = TestHelper.GetTestDataPath(TestDataPath.Core.Common.Utils); + Assert.IsTrue(Directory.Exists(path)); + + // Ringtoets Piping IO + path = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Piping.IO); + Assert.IsTrue(Directory.Exists(path)); + } + + [Test] + public void TestSolutionRoot() + { + Assert.IsTrue(Directory.Exists(TestHelper.SolutionRoot)); + } + + [Test] + public void TestAssertLogMessage() + { + TestHelper.AssertLogMessageIsGenerated(() => log.Warn("hello"), "hello"); + TestHelper.AssertLogMessageIsGenerated(() => log.Debug("hello"), "hello"); + TestHelper.AssertLogMessageIsGenerated(() => log.Error("hello"), "hello"); + } + + [Test] + public void TestAssertLogMessagesCount() + { + TestHelper.AssertLogMessagesCount(() => log.Error("test 1"), 1); + TestHelper.AssertLogMessagesCount(() => log.Warn("test 2"), 1); + TestHelper.AssertLogMessagesCount(() => log.Info("test 3"), 1); + } + + [Test] + public void AssertImagesAreEqual_TwoIdenticalImages_NoAssertionErrors() + { + // Setup + Bitmap image = Resources.abacus; + + // Call + TestDelegate call = () => TestHelper.AssertImagesAreEqual(image, image); + + // Assert + Assert.DoesNotThrow(call); + } + + [Test] + public void AssertImagesAreEqual_TwoDifferentImages_ThrowAssertionException() + { + // Setup + Bitmap image1 = Resources.abacus; + Bitmap image2 = Resources.acorn; + + // Call + TestDelegate call = () => TestHelper.AssertImagesAreEqual(image1, image2); + + // Assert + Assert.Throws(call); + } + + [Test] + public void AssertImagesAreEqual_ExpectedIsNullButActualIsNot_ThrowAssertionException() + { + // Call + TestDelegate call = () => TestHelper.AssertImagesAreEqual(null, Resources.acorn); + + // Assert + Assert.Throws(call); + } + + [Test] + public void AssertImagesAreEqual_ActualIsNullButExpectingImage_ThrowAssertionException() + { + // Call + TestDelegate call = () => TestHelper.AssertImagesAreEqual(Resources.acorn, null); + + // Assert + Assert.Throws(call); + } + + [Test] + public void AssertContextMenuStripContainsItem_MenuNull_ThrowsAssertionException() + { + // Call + TestDelegate call = () => TestHelper.AssertContextMenuStripContainsItem(null, 0, "", "", null); + + // Assert + Assert.Throws(call); + } + + [Test] + public void AssertContextMenuStripContainsItem_NoMenuItemAtPosition_ThrowsAssertionException() + { + // Call + TestDelegate call = () => TestHelper.AssertContextMenuStripContainsItem(new ContextMenuStrip(), 0, "", "", null); + + // Assert + Assert.Throws(call); + } + + [Test] + public void AssertContextMenuStripContainsItem_MenuItemWithDifferentText_ThrowsAssertionException() + { + // Setup + var contextMenuStrip = new ContextMenuStrip(); + var testItem = CreateContextMenuItem(); + contextMenuStrip.Items.Add(testItem); + + // Call + TestDelegate call = () => { TestHelper.AssertContextMenuStripContainsItem(contextMenuStrip, 0, testItem.Text + "someThing", testItem.ToolTipText, testItem.Image); }; + + // Assert + Assert.Throws(call); + } + + [Test] + public void AssertContextMenuStripContainsItem_MenuItemWithDifferentToolTip_ThrowsAssertionException() + { + // Setup + var contextMenuStrip = new ContextMenuStrip(); + var testItem = CreateContextMenuItem(); + contextMenuStrip.Items.Add(testItem); + + // Call + TestDelegate call = () => { TestHelper.AssertContextMenuStripContainsItem(contextMenuStrip, 0, testItem.Text, testItem.ToolTipText + "someThing", testItem.Image); }; + + // Assert + Assert.Throws(call); + } + + [Test] + public void AssertContextMenuStripContainsItem_MenuItemWithDifferentImage_ThrowsAssertionException() + { + // Setup + var contextMenuStrip = new ContextMenuStrip(); + var testItem = CreateContextMenuItem(); + contextMenuStrip.Items.Add(testItem); + + // Call + TestDelegate call = () => { TestHelper.AssertContextMenuStripContainsItem(contextMenuStrip, 0, testItem.Text, testItem.ToolTipText, Resources.acorn); }; + + // Assert + Assert.Throws(call); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void AssertContextMenuStripContainsItem_MenuItemWithDifferentEnabeldState_ThrowsAssertionException(bool enabled) + { + // Setup + var contextMenuStrip = new ContextMenuStrip(); + var testItem = CreateContextMenuItem(); + testItem.Enabled = enabled; + contextMenuStrip.Items.Add(testItem); + + // Call + TestDelegate call = () => { TestHelper.AssertContextMenuStripContainsItem(contextMenuStrip, 0, testItem.Text, testItem.ToolTipText, testItem.Image, !enabled); }; + + // Assert + Assert.Throws(call); + } + + [Test] + public void AssertContextMenuStripContainsItem_SameMenuItemProperties_NoExceptions() + { + // Setup + var contextMenuStrip = new ContextMenuStrip(); + var testItem = CreateContextMenuItem(); + contextMenuStrip.Items.Add(testItem); + + // Call & Assert + TestHelper.AssertContextMenuStripContainsItem(contextMenuStrip, 0, testItem.Text, testItem.ToolTipText, testItem.Image); + } + + [Test] + public void AssertDropDownItemContainsItem_MenuNull_ThrowsAssertionException() + { + // Call + TestDelegate call = () => TestHelper.AssertDropDownItemContainsItem(null, 0, "", "", null); + + // Assert + Assert.Throws(call); + } + + [Test] + public void AssertDropDownItemContainsItem_NoMenuItemAtPosition_ThrowsAssertionException() + { + // Call + TestDelegate call = () => TestHelper.AssertDropDownItemContainsItem(new TestToolStripDropDownItem(), 0, "", "", null); + + // Assert + Assert.Throws(call); + } + + [Test] + public void AssertDropDownItemContainsItem_MenuItemWithDifferentText_ThrowsAssertionException() + { + // Setup + var dropDownItem = new TestToolStripDropDownItem(); + var testItem = CreateContextMenuItem(); + dropDownItem.DropDownItems.Add(testItem); + + // Call + TestDelegate call = () => { TestHelper.AssertDropDownItemContainsItem(dropDownItem, 0, testItem.Text + "someThing", testItem.ToolTipText, testItem.Image); }; + + // Assert + Assert.Throws(call); + } + + [Test] + public void AssertDropDownItemContainsItem_MenuItemWithDifferentToolTip_ThrowsAssertionException() + { + // Setup + var dropDownItem = new TestToolStripDropDownItem(); + var testItem = CreateContextMenuItem(); + dropDownItem.DropDownItems.Add(testItem); + + // Call + TestDelegate call = () => { TestHelper.AssertDropDownItemContainsItem(dropDownItem, 0, testItem.Text, testItem.ToolTipText + "someThing", testItem.Image); }; + + // Assert + Assert.Throws(call); + } + + [Test] + public void AssertDropDownItemContainsItem_MenuItemWithDifferentImage_ThrowsAssertionException() + { + // Setup + var dropDownItem = new TestToolStripDropDownItem(); + var testItem = CreateContextMenuItem(); + dropDownItem.DropDownItems.Add(testItem); + + // Call + TestDelegate call = () => { TestHelper.AssertDropDownItemContainsItem(dropDownItem, 0, testItem.Text, testItem.ToolTipText, Resources.acorn); }; + + // Assert + Assert.Throws(call); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void AssertDropDownItemContainsItem_MenuItemWithDifferentEnabeldState_ThrowsAssertionException(bool enabled) + { + // Setup + var dropDownItem = new TestToolStripDropDownItem(); + var testItem = CreateContextMenuItem(); + testItem.Enabled = enabled; + dropDownItem.DropDownItems.Add(testItem); + + // Call + TestDelegate call = () => { TestHelper.AssertDropDownItemContainsItem(dropDownItem, 0, testItem.Text, testItem.ToolTipText, testItem.Image, !enabled); }; + + // Assert + Assert.Throws(call); + } + + [Test] + public void AssertDropDownItemContainsItem_SameMenuItemProperties_NoExceptions() + { + // Setup + var dropDownItem = new TestToolStripDropDownItem(); + var testItem = CreateContextMenuItem(); + dropDownItem.DropDownItems.Add(testItem); + + // Call & Assert + TestHelper.AssertDropDownItemContainsItem(dropDownItem, 0, testItem.Text, testItem.ToolTipText, testItem.Image); + } + + [Test] + public void AssertExceptionCustomMessage_NoException_ThrowsAssertionException() + { + // Setup + TestDelegate t = () => { }; + + // Call + TestDelegate call = () => { TestHelper.AssertThrowsArgumentExceptionAndTestMessage(t, String.Empty); }; + + // Assert + Assert.Throws(call); + } + + [Test] + public void AssertExceptionCustomMessage_ExceptionIncorrectMessage_ThrowsAssertionException() + { + // Setup + var someMessage = "Exception"; + var differentMessage = "Different"; + TestDelegate t = () => { throw new ArgumentException(someMessage); }; + + // Call + TestDelegate call = () => { TestHelper.AssertThrowsArgumentExceptionAndTestMessage(t, differentMessage); }; + + // Assert + Assert.Throws(call); + } + + [Test] + [TestCase("param")] + [TestCase(null)] + public void AssertExceptionCustomMessage_ExceptionEqualMessage_NoExceptions(string argument) + { + // Setup + var someMessage = "Exception"; + TestDelegate t = () => { throw new ArgumentException(someMessage, argument); }; + + // Call & Assert + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(t, someMessage); + } + + [Test] + [TestCase("param")] + [TestCase(null)] + public void AssertExceptionCustomMessage_MessageWithNewLinesMessage_NoExceptions(string argument) + { + // Setup + var someMessage = string.Join(Environment.NewLine, "Exception", "second line"); + TestDelegate t = () => { throw new ArgumentException(someMessage, argument); }; + + // Call & Assert + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(t, someMessage); + } + + private static ToolStripMenuItem CreateContextMenuItem() + { + return new ToolStripMenuItem + { + Text = @"aText", + ToolTipText = @"aToolTipText", + Image = Resources.abacus + }; + } + + private class TestToolStripDropDownItem : ToolStripDropDownItem { } } } \ No newline at end of file Index: Core/Common/test/Core.Common.TestUtil.Test/packages.config =================================================================== diff -u -rd6e6eadf4a2521df75b6d371bacbb181a43058a3 -r1a6f65407809a58d25b871af1fc77d6323c6c83a --- Core/Common/test/Core.Common.TestUtil.Test/packages.config (.../packages.config) (revision d6e6eadf4a2521df75b6d371bacbb181a43058a3) +++ Core/Common/test/Core.Common.TestUtil.Test/packages.config (.../packages.config) (revision 1a6f65407809a58d25b871af1fc77d6323c6c83a) @@ -1,4 +1,5 @@  + \ No newline at end of file Index: Core/Common/test/Core.Common.TestUtil.Test/test-data/Test.txt =================================================================== diff -u --- Core/Common/test/Core.Common.TestUtil.Test/test-data/Test.txt (revision 0) +++ Core/Common/test/Core.Common.TestUtil.Test/test-data/Test.txt (revision 1a6f65407809a58d25b871af1fc77d6323c6c83a) @@ -0,0 +1 @@ \ No newline at end of file Index: Core/Common/test/Core.Common.Utils.Test/Core.Common.Utils.Test.csproj =================================================================== diff -u -rc781ee450100c0e4ea2d3ebf28ab2ccc16c10bd6 -r1a6f65407809a58d25b871af1fc77d6323c6c83a --- Core/Common/test/Core.Common.Utils.Test/Core.Common.Utils.Test.csproj (.../Core.Common.Utils.Test.csproj) (revision c781ee450100c0e4ea2d3ebf28ab2ccc16c10bd6) +++ Core/Common/test/Core.Common.Utils.Test/Core.Common.Utils.Test.csproj (.../Core.Common.Utils.Test.csproj) (revision 1a6f65407809a58d25b871af1fc77d6323c6c83a) @@ -59,28 +59,15 @@ MinimumRecommendedRules.ruleset - - ..\..\..\..\packages\log4net.2.0.4\lib\net40-full\log4net.dll - True - ..\..\..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll True - - ..\..\..\..\packages\RhinoMocks.3.6.1\lib\net\Rhino.Mocks.dll - True - 3.5 - - 3.0 - - - @@ -95,7 +82,6 @@ - True @@ -105,9 +91,6 @@ - - Component - Index: Core/Common/test/Core.Common.Utils.Test/Extensions/ComparableExtensionsTest.cs =================================================================== diff -u -r2a1dc72ed9a202b720c26828e5d53cecc5a0e6c8 -r1a6f65407809a58d25b871af1fc77d6323c6c83a --- Core/Common/test/Core.Common.Utils.Test/Extensions/ComparableExtensionsTest.cs (.../ComparableExtensionsTest.cs) (revision 2a1dc72ed9a202b720c26828e5d53cecc5a0e6c8) +++ Core/Common/test/Core.Common.Utils.Test/Extensions/ComparableExtensionsTest.cs (.../ComparableExtensionsTest.cs) (revision 1a6f65407809a58d25b871af1fc77d6323c6c83a) @@ -125,5 +125,25 @@ // Assert Assert.Throws(call); } + + [Test] + [TestCase(-4.4, -2.2, 3.3, -2.2)] + [TestCase(-2.2, -2.2, 3.3, -2.2)] + [TestCase(1.1, -2.2, 3.3, 1.1)] + [TestCase(3.3, -2.2, 3.3, 3.3)] + [TestCase(5.5, -2.2, 3.3, 3.3)] + [TestCase(-4.4, 3.3, -2.2, -2.2)] + [TestCase(-2.2, 3.3, -2.2, -2.2)] + [TestCase(1.1, 3.3, -2.2, 1.1)] + [TestCase(3.3, 3.3, -2.2, 3.3)] + [TestCase(5.5, 3.3, -2.2, 3.3)] + public void ClipValue_VariousTestCases_ReturnExpectedValue(double input, double limit1, double limit2, double expectedValue) + { + // Call + var result = input.ClipValue(limit1, limit2); + + // Assert + Assert.AreEqual(expectedValue, result); + } } } \ No newline at end of file Fisheye: Tag 1a6f65407809a58d25b871af1fc77d6323c6c83a refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Utils.Test/MathUtilsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1a6f65407809a58d25b871af1fc77d6323c6c83a refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Utils.Test/TestHelperTests.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Common/test/Core.Common.Utils.Test/UrlTest.cs =================================================================== diff -u -r6016a9db20f1833086b35bc6aedcb2b0a3efe19d -r1a6f65407809a58d25b871af1fc77d6323c6c83a --- Core/Common/test/Core.Common.Utils.Test/UrlTest.cs (.../UrlTest.cs) (revision 6016a9db20f1833086b35bc6aedcb2b0a3efe19d) +++ Core/Common/test/Core.Common.Utils.Test/UrlTest.cs (.../UrlTest.cs) (revision 1a6f65407809a58d25b871af1fc77d6323c6c83a) @@ -13,5 +13,23 @@ Assert.AreEqual("Deltares", url.Name); Assert.AreEqual("http://www.deltares.com", url.Path); } + + [Test] + public void SipleProperties_SetAndGetValue_ReturnNewlySetValue() + { + // Setup + var url = new Url("Deltares", "http://www.deltares.com"); + + const string newName = "Google"; + const string newPath = "http://www.google.com"; + + // Call + url.Name = newName; + url.Path = newPath; + + // Assert + Assert.AreEqual(newName, url.Name); + Assert.AreEqual(newPath, url.Path); + } } } \ No newline at end of file Index: Core/Common/test/Core.Common.Utils.Test/packages.config =================================================================== diff -u -r5dc6b11ada2c7d2e4ca14413b1ddca577ba34d08 -r1a6f65407809a58d25b871af1fc77d6323c6c83a --- Core/Common/test/Core.Common.Utils.Test/packages.config (.../packages.config) (revision 5dc6b11ada2c7d2e4ca14413b1ddca577ba34d08) +++ Core/Common/test/Core.Common.Utils.Test/packages.config (.../packages.config) (revision 1a6f65407809a58d25b871af1fc77d6323c6c83a) @@ -1,6 +1,4 @@  - - \ No newline at end of file Fisheye: Tag 1a6f65407809a58d25b871af1fc77d6323c6c83a refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Utils.Test/test-data/Test.txt'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/GridProperties/LineStylePropertiesBase.cs =================================================================== diff -u -rb92517dbc9956b930a6cfc7f96a1f762dfa41cf6 -r1a6f65407809a58d25b871af1fc77d6323c6c83a --- Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/GridProperties/LineStylePropertiesBase.cs (.../LineStylePropertiesBase.cs) (revision b92517dbc9956b930a6cfc7f96a1f762dfa41cf6) +++ Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/GridProperties/LineStylePropertiesBase.cs (.../LineStylePropertiesBase.cs) (revision 1a6f65407809a58d25b871af1fc77d6323c6c83a) @@ -6,6 +6,7 @@ using Core.Common.Gui.Attributes; using Core.Common.Utils; using Core.Common.Utils.Attributes; +using Core.Common.Utils.Extensions; using Core.GIS.SharpMap.Rendering.Thematics; using Core.GIS.SharpMap.Styles; using Core.GIS.SharpMap.Styles.Shapes; @@ -65,7 +66,7 @@ } set { - Style.Line = ThemeFactory.CreatePen(MathUtils.ClipValue(value, MinimumAllowedSize, MaximumAllowedSize), Style.Line); + Style.Line = ThemeFactory.CreatePen(value.ClipValue(MinimumAllowedSize, MaximumAllowedSize), Style.Line); } } @@ -98,7 +99,7 @@ } set { - Style.Outline = ThemeFactory.CreatePen(MathUtils.ClipValue(value, MinimumAllowedSize, MaximumAllowedSize), Style.Outline); + Style.Outline = ThemeFactory.CreatePen(value.ClipValue(MinimumAllowedSize, MaximumAllowedSize), Style.Outline); } } Index: Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/GridProperties/PointStylePropertiesBase.cs =================================================================== diff -u -rb92517dbc9956b930a6cfc7f96a1f762dfa41cf6 -r1a6f65407809a58d25b871af1fc77d6323c6c83a --- Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/GridProperties/PointStylePropertiesBase.cs (.../PointStylePropertiesBase.cs) (revision b92517dbc9956b930a6cfc7f96a1f762dfa41cf6) +++ Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/GridProperties/PointStylePropertiesBase.cs (.../PointStylePropertiesBase.cs) (revision 1a6f65407809a58d25b871af1fc77d6323c6c83a) @@ -7,6 +7,7 @@ using Core.Common.Gui.Attributes; using Core.Common.Utils; using Core.Common.Utils.Attributes; +using Core.Common.Utils.Extensions; using Core.GIS.SharpMap.Styles; using Core.GIS.SharpMap.Styles.Shapes; using Core.Plugins.SharpMapGis.Gui.Properties; @@ -85,7 +86,7 @@ } set { - Style.Outline = new Pen(Style.Outline.Color, MathUtils.ClipValue(value, MinimumAllowedSize, MaximumAllowedSize)) + Style.Outline = new Pen(Style.Outline.Color, value.ClipValue(MinimumAllowedSize, MaximumAllowedSize)) { DashStyle = Style.Outline.DashStyle }; @@ -159,7 +160,7 @@ } set { - Style.ShapeSize = MathUtils.ClipValue(value, MinimumAllowedShapeSize, MaximalAllowedShapeSize); + Style.ShapeSize = value.ClipValue(MinimumAllowedShapeSize, MaximalAllowedShapeSize); } } Index: Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/GridProperties/PolygonStylePropertiesBase.cs =================================================================== diff -u -rb92517dbc9956b930a6cfc7f96a1f762dfa41cf6 -r1a6f65407809a58d25b871af1fc77d6323c6c83a --- Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/GridProperties/PolygonStylePropertiesBase.cs (.../PolygonStylePropertiesBase.cs) (revision b92517dbc9956b930a6cfc7f96a1f762dfa41cf6) +++ Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/GridProperties/PolygonStylePropertiesBase.cs (.../PolygonStylePropertiesBase.cs) (revision 1a6f65407809a58d25b871af1fc77d6323c6c83a) @@ -4,6 +4,7 @@ using Core.Common.Gui.Attributes; using Core.Common.Utils; using Core.Common.Utils.Attributes; +using Core.Common.Utils.Extensions; using Core.GIS.SharpMap.Styles; using Core.Plugins.SharpMapGis.Gui.Properties; @@ -60,7 +61,7 @@ } set { - Style.Outline = new Pen(Style.Outline.Color, MathUtils.ClipValue(value, MinimumAllowedSize, MaximumAllowedSize)); + Style.Outline = new Pen(Style.Outline.Color, value.ClipValue(MinimumAllowedSize, MaximumAllowedSize)); } } Index: Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/GridProperties/ThemeItemProperties.cs =================================================================== diff -u -r10b304d4b5cb2283801cdb16204baf2a42ab5967 -r1a6f65407809a58d25b871af1fc77d6323c6c83a --- Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/GridProperties/ThemeItemProperties.cs (.../ThemeItemProperties.cs) (revision 10b304d4b5cb2283801cdb16204baf2a42ab5967) +++ Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/GridProperties/ThemeItemProperties.cs (.../ThemeItemProperties.cs) (revision 1a6f65407809a58d25b871af1fc77d6323c6c83a) @@ -6,6 +6,7 @@ using Core.Common.Gui; using Core.Common.Utils; using Core.Common.Utils.Attributes; +using Core.Common.Utils.Extensions; using Core.GIS.SharpMap.Rendering.Thematics; using Core.GIS.SharpMap.Styles; using Core.GIS.SharpMap.Styles.Shapes; @@ -67,7 +68,7 @@ { var style = (VectorStyle) data.Style; - style.Line = new Pen(style.Line.Color, MathUtils.ClipValue(value, MinimumAllowedSize, MaximumAllowedSize)) + style.Line = new Pen(style.Line.Color, value.ClipValue(MinimumAllowedSize, MaximumAllowedSize)) { DashStyle = style.Line.DashStyle }; @@ -125,7 +126,7 @@ { var style = (VectorStyle) data.Style; - style.Outline = new Pen(style.Outline.Color, MathUtils.ClipValue(value, MinimumAllowedSize, MaximumAllowedSize)) + style.Outline = new Pen(style.Outline.Color, value.ClipValue(MinimumAllowedSize, MaximumAllowedSize)) { DashStyle = style.Outline.DashStyle }; Index: Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/GridProperties/VectorLayerProperties.cs =================================================================== diff -u -rb92517dbc9956b930a6cfc7f96a1f762dfa41cf6 -r1a6f65407809a58d25b871af1fc77d6323c6c83a --- Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/GridProperties/VectorLayerProperties.cs (.../VectorLayerProperties.cs) (revision b92517dbc9956b930a6cfc7f96a1f762dfa41cf6) +++ Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/GridProperties/VectorLayerProperties.cs (.../VectorLayerProperties.cs) (revision 1a6f65407809a58d25b871af1fc77d6323c6c83a) @@ -5,6 +5,7 @@ using Core.Common.Gui.Attributes; using Core.Common.Utils; using Core.Common.Utils.Attributes; +using Core.Common.Utils.Extensions; using Core.GIS.GeoAPI.CoordinateSystems; using Core.GIS.GeoAPI.CoordinateSystems.Transformations; using Core.GIS.SharpMap.Layers; @@ -80,7 +81,7 @@ } set { - data.Style.Line = new Pen(data.Style.Line.Color, MathUtils.ClipValue(value, MinimumAllowedSize, MaximumAllowedSize)); + data.Style.Line = new Pen(data.Style.Line.Color, value.ClipValue(MinimumAllowedSize, MaximumAllowedSize)); } } @@ -113,7 +114,7 @@ } set { - data.Style.Outline = new Pen(data.Style.Outline.Color, MathUtils.ClipValue(value, MinimumAllowedSize, MaximumAllowedSize)); + data.Style.Outline = new Pen(data.Style.Outline.Color, value.ClipValue(MinimumAllowedSize, MaximumAllowedSize)); } } Index: Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/GridProperties/VectorStyleProperties.cs =================================================================== diff -u -r10b304d4b5cb2283801cdb16204baf2a42ab5967 -r1a6f65407809a58d25b871af1fc77d6323c6c83a --- Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/GridProperties/VectorStyleProperties.cs (.../VectorStyleProperties.cs) (revision 10b304d4b5cb2283801cdb16204baf2a42ab5967) +++ Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/GridProperties/VectorStyleProperties.cs (.../VectorStyleProperties.cs) (revision 1a6f65407809a58d25b871af1fc77d6323c6c83a) @@ -6,6 +6,7 @@ using Core.Common.Gui; using Core.Common.Utils; using Core.Common.Utils.Attributes; +using Core.Common.Utils.Extensions; using Core.GIS.SharpMap.Styles; using Core.GIS.SharpMap.Styles.Shapes; using Core.Plugins.SharpMapGis.Gui.Properties; @@ -47,7 +48,7 @@ } set { - data.Line = new Pen(data.Line.Color, MathUtils.ClipValue(value, MinimumAllowedSize, MaximumAllowedSize)) + data.Line = new Pen(data.Line.Color, value.ClipValue(MinimumAllowedSize, MaximumAllowedSize)) { DashStyle = data.Line.DashStyle }; @@ -99,7 +100,7 @@ } set { - data.Outline = new Pen(data.Outline.Color, MathUtils.ClipValue(value, MinimumAllowedSize, MaximumAllowedSize)) + data.Outline = new Pen(data.Outline.Color, value.ClipValue(MinimumAllowedSize, MaximumAllowedSize)) { DashStyle = data.Outline.DashStyle }; Index: packages/repositories.config =================================================================== diff -u -rc0c01906c23d8951360f8c299473e1eb92729451 -r1a6f65407809a58d25b871af1fc77d6323c6c83a --- packages/repositories.config (.../repositories.config) (revision c0c01906c23d8951360f8c299473e1eb92729451) +++ packages/repositories.config (.../repositories.config) (revision 1a6f65407809a58d25b871af1fc77d6323c6c83a) @@ -21,7 +21,6 @@ -