Index: Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.KernelWrapper.TestUtil.Test/Kernels/UpliftVan/Input/PreconsolidationStressComparerTest.cs
===================================================================
diff -u
--- Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.KernelWrapper.TestUtil.Test/Kernels/UpliftVan/Input/PreconsolidationStressComparerTest.cs (revision 0)
+++ Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.KernelWrapper.TestUtil.Test/Kernels/UpliftVan/Input/PreconsolidationStressComparerTest.cs (revision 87f4d1cf5a008b441db6182017a02be41b7aefee)
@@ -0,0 +1,189 @@
+// Copyright (C) Stichting Deltares 2019. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer is free software: you can redistribute it and/or modify
+// it under the terms of the GNU 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 General Public License for more details.
+//
+// You should have received a copy of the GNU 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;
+using System.Collections.Generic;
+using Deltares.MacroStability.CSharpWrapper;
+using Deltares.MacroStability.CSharpWrapper.Input;
+using NUnit.Framework;
+using Riskeer.MacroStabilityInwards.KernelWrapper.TestUtil.Kernels.UpliftVan.Input;
+
+namespace Riskeer.MacroStabilityInwards.KernelWrapper.TestUtil.Test.Kernels.UpliftVan.Input
+{
+ [TestFixture]
+ public class PreconsolidationStressComparerTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Call
+ var comparer = new PreconsolidationStressComparer();
+
+ // Assert
+ Assert.IsInstanceOf(comparer);
+ Assert.IsInstanceOf>(comparer);
+ }
+
+ [Test]
+ public void Compare_FirstObjectOfIncorrectType_ThrowArgumentException()
+ {
+ // Setup
+ var firstObject = new object();
+ object secondObject = new PreconsolidationStress();
+
+ var comparer = new PreconsolidationStressComparer();
+
+ // Call
+ void Call() => comparer.Compare(firstObject, secondObject);
+
+ // Assert
+ var exception = Assert.Throws(Call);
+ Assert.AreEqual($"Cannot compare objects other than {typeof(PreconsolidationStress)} with this comparer.", exception.Message);
+ }
+
+ [Test]
+ public void Compare_SecondObjectOfIncorrectType_ThrowArgumentException()
+ {
+ // Setup
+ object firstObject = new PreconsolidationStress();
+ var secondObject = new object();
+
+ var comparer = new PreconsolidationStressComparer();
+
+ // Call
+ void Call() => comparer.Compare(firstObject, secondObject);
+
+ // Assert
+ var exception = Assert.Throws(Call);
+ Assert.AreEqual($"Cannot compare objects other than {typeof(PreconsolidationStress)} with this comparer.", exception.Message);
+ }
+
+ [Test]
+ public void Compare_SameInstance_ReturnZero()
+ {
+ // Setup
+ var preConsolidationStress = new PreconsolidationStress();
+
+ // Call
+ int result = new PreconsolidationStressComparer().Compare(preConsolidationStress, preConsolidationStress);
+
+ // Assert
+ Assert.AreEqual(0, result);
+ }
+
+ [Test]
+ public void Compare_EqualProperties_ReturnZero()
+ {
+ // Setup
+ const double stressValue = 8.4;
+ var point = new Point2D(2.01, 40.486);
+ var preConsolidationStress1 = new PreconsolidationStress
+ {
+ StressValue = stressValue,
+ Point = point
+ };
+ var preConsolidationStress2 = new PreconsolidationStress
+ {
+ StressValue = stressValue,
+ Point = point
+ };
+
+ // Call
+ int result = new PreconsolidationStressComparer().Compare(preConsolidationStress1, preConsolidationStress2);
+
+ // Assert
+ Assert.AreEqual(0, result);
+ }
+
+ [Test]
+ public void Compare_DifferentStressValue_ReturnOne()
+ {
+ // Setup
+ const double stressValue = 8.4;
+ var point = new Point2D(2.01, 40.486);
+ var preConsolidationStress1 = new PreconsolidationStress
+ {
+ StressValue = stressValue,
+ Point = point
+ };
+ var preConsolidationStress2 = new PreconsolidationStress
+ {
+ StressValue = 16.8,
+ Point = point
+ };
+
+ // Call
+ int result = new PreconsolidationStressComparer().Compare(preConsolidationStress1, preConsolidationStress2);
+
+ // Assert
+ Assert.AreEqual(1, result);
+ }
+
+ [Test]
+ public void Compare_DifferentX_ReturnOne()
+ {
+ // Setup
+ const double stressValue = 8.4;
+ const double z = 40.486;
+ var preConsolidationStress1 = new PreconsolidationStress
+ {
+ StressValue = stressValue,
+ Point = new Point2D(2.01, z)
+ };
+ var preConsolidationStress2 = new PreconsolidationStress
+ {
+ StressValue = stressValue,
+ Point = new Point2D(18.78, z)
+ };
+
+ // Call
+ int result = new PreconsolidationStressComparer().Compare(preConsolidationStress1, preConsolidationStress2);
+
+ // Assert
+ Assert.AreEqual(1, result);
+ }
+
+ [Test]
+ public void Compare_DifferentZ_ReturnOne()
+ {
+ // Setup
+ const double stressValue = 8.4;
+ const double x = 2.01;
+ var preConsolidationStress1 = new PreconsolidationStress
+ {
+ StressValue = stressValue,
+ Point = new Point2D(x, 40.486)
+ };
+ var preConsolidationStress2 = new PreconsolidationStress
+ {
+ StressValue = stressValue,
+ Point = new Point2D(x, 40.487)
+ };
+
+ // Call
+ int result = new PreconsolidationStressComparer().Compare(preConsolidationStress1, preConsolidationStress2);
+
+ // Assert
+ Assert.AreEqual(1, result);
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 87f4d1cf5a008b441db6182017a02be41b7aefee refers to a dead (removed) revision in file `Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.KernelWrapper.TestUtil.Test/Kernels/UpliftVan/Input/PreconsolidationStressComparerTestRename.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.KernelWrapper.TestUtil/Kernels/UpliftVan/Input/PreconsolidationStressComparer.cs
===================================================================
diff -u
--- Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.KernelWrapper.TestUtil/Kernels/UpliftVan/Input/PreconsolidationStressComparer.cs (revision 0)
+++ Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.KernelWrapper.TestUtil/Kernels/UpliftVan/Input/PreconsolidationStressComparer.cs (revision 87f4d1cf5a008b441db6182017a02be41b7aefee)
@@ -0,0 +1,61 @@
+// Copyright (C) Stichting Deltares 2019. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer is free software: you can redistribute it and/or modify
+// it under the terms of the GNU 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 General Public License for more details.
+//
+// You should have received a copy of the GNU 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;
+using System.Collections.Generic;
+using Deltares.MacroStability.CSharpWrapper.Input;
+
+namespace Riskeer.MacroStabilityInwards.KernelWrapper.TestUtil.Kernels.UpliftVan.Input
+{
+ ///
+ /// This class compares the coordinates of two
+ /// instances to determine whether they're equal to each other or not.
+ ///
+ public class PreconsolidationStressComparer : IComparer, IComparer
+ {
+ public int Compare(object x, object y)
+ {
+ if (!(x is PreconsolidationStress) || !(y is PreconsolidationStress))
+ {
+ throw new ArgumentException($"Cannot compare objects other than {typeof(PreconsolidationStress)} with this comparer.");
+ }
+
+ return Compare((PreconsolidationStress) x, (PreconsolidationStress) y);
+ }
+
+ public int Compare(PreconsolidationStress x, PreconsolidationStress y)
+ {
+ if (x.Equals(y))
+ {
+ return 0;
+ }
+ if (Math.Abs(x.StressValue - y.StressValue) < 1e-6 &&
+ Math.Abs(x.Point.X - y.Point.X) < 1e-6 &&
+ Math.Abs(x.Point.Z - y.Point.Z) < 1e-6)
+ {
+ return 0;
+ }
+
+ return 1;
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 87f4d1cf5a008b441db6182017a02be41b7aefee refers to a dead (removed) revision in file `Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.KernelWrapper.TestUtil/Kernels/UpliftVan/Input/PreconsolidationStressComparerRename.cs'.
Fisheye: No comparison available. Pass `N' to diff?