Index: Core/Common/test/Core.Common.TestUtil.Test/TestHelperTest.cs =================================================================== diff -u -rd12c953518f14c3d50136775b2c03afdf3a4f8f1 -r9ca2ce99f8b1d93fb1edde4e505b5acc5094a256 --- Core/Common/test/Core.Common.TestUtil.Test/TestHelperTest.cs (.../TestHelperTest.cs) (revision d12c953518f14c3d50136775b2c03afdf3a4f8f1) +++ Core/Common/test/Core.Common.TestUtil.Test/TestHelperTest.cs (.../TestHelperTest.cs) (revision 9ca2ce99f8b1d93fb1edde4e505b5acc5094a256) @@ -20,6 +20,7 @@ // All rights reserved. using System; +using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.IO; @@ -36,6 +37,22 @@ { private static readonly ILog log = LogManager.GetLogger(typeof(TestHelperTest)); + private static IEnumerable AssertObjectsEqualButNotSameSource + { + get + { + var objectA = new TestEqualSameObject(1); + var objectB = new TestEqualSameObject(1); + var objectC = new TestEqualSameObject(2); + yield return new TestCaseData(objectA, objectA, false).SetName("EqualsAndSameObjects_False"); + yield return new TestCaseData(objectA, objectB, true).SetName("EqualsNotSameObjects_True"); + yield return new TestCaseData(objectA, objectC, false).SetName("NotEqualsNotSameObjects_False"); + yield return new TestCaseData(null, null, true).SetName("BothNull_True"); + yield return new TestCaseData(objectA, null, false).SetName("ObjectBNull_False"); + yield return new TestCaseData(null, objectB, false).SetName("ObjectBNull_False"); + } + } + [Test] public void CanOpenFileForWrite_PathDoesNotExist_DoesNotThrowAnyExceptions() { @@ -696,6 +713,52 @@ Assert.DoesNotThrow(test); } + [Test] + [TestCaseSource(nameof(AssertObjectsEqualButNotSameSource))] + public void AssertObjectsEqualButNotSame_DifferentObjects_ReturnExpectedValues(object objectA, object objectB, bool shouldSucceed) + { + // Call + TestDelegate test = () => TestHelper.AssertAreEqualButNotSame(objectA, objectB); + + // Assert + if (shouldSucceed) + { + Assert.DoesNotThrow(test); + } + else + { + Assert.Throws(test); + } + } + + public class TestEqualSameObject + { + private readonly int someInt; + + public TestEqualSameObject(int someInt) + { + this.someInt = someInt; + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) return false; + if (ReferenceEquals(this, obj)) return true; + if (obj.GetType() != GetType()) return false; + return Equals((TestEqualSameObject) obj); + } + + public override int GetHashCode() + { + return someInt; + } + + protected bool Equals(TestEqualSameObject other) + { + return someInt == other.someInt; + } + } + private static ToolStripMenuItem CreateContextMenuItem() { return new ToolStripMenuItem Index: Core/Common/test/Core.Common.TestUtil/TestHelper.cs =================================================================== diff -u -ra70cb733eb761229173777b9f6cd1b977830b24b -r9ca2ce99f8b1d93fb1edde4e505b5acc5094a256 --- Core/Common/test/Core.Common.TestUtil/TestHelper.cs (.../TestHelper.cs) (revision a70cb733eb761229173777b9f6cd1b977830b24b) +++ Core/Common/test/Core.Common.TestUtil/TestHelper.cs (.../TestHelper.cs) (revision 9ca2ce99f8b1d93fb1edde4e505b5acc5094a256) @@ -390,6 +390,22 @@ Assert.IsTrue(typeConverterAttribute.ConverterTypeName == typeof(TTypeConverter).AssemblyQualifiedName); } + /// + /// Determines whether to objects are copies of eachother by verifying that they are + /// equal, but not the same. + /// + /// The object which should be equal, but not same as . + /// The object which should be equal, but not same as . + public static void AssertAreEqualButNotSame(object objectA, object objectB) + { + Assert.AreEqual(objectA, objectB, "Objects should be equal."); + + if (objectA != null) + { + Assert.AreNotSame(objectA, objectB, "Objects should not be the same."); + } + } + private static void AssertIsFasterThan(float maxMilliseconds, string message, Action action, bool rankHddAccess) { var stopwatch = new Stopwatch(); Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructureTest.cs =================================================================== diff -u -r1c568c57d0e52050b688773ec8570157c894d4a9 -r9ca2ce99f8b1d93fb1edde4e505b5acc5094a256 --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructureTest.cs (.../ClosingStructureTest.cs) (revision 1c568c57d0e52050b688773ec8570157c894d4a9) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructureTest.cs (.../ClosingStructureTest.cs) (revision 9ca2ce99f8b1d93fb1edde4e505b5acc5094a256) @@ -353,21 +353,21 @@ // Assert Assert.AreNotEqual(otherStructure.Id, structure.Id); Assert.AreEqual(otherStructure.Name, structure.Name); - AssertAreEqualButNotSame(otherStructure.Location, structure.Location); + TestHelper.AssertAreEqualButNotSame(otherStructure.Location, structure.Location); Assert.AreEqual(otherStructure.StructureNormalOrientation, structure.StructureNormalOrientation); - AssertAreEqualButNotSame(otherStructure.AllowedLevelIncreaseStorage, structure.AllowedLevelIncreaseStorage); - AssertAreEqualButNotSame(otherStructure.AreaFlowApertures, structure.AreaFlowApertures); - AssertAreEqualButNotSame(otherStructure.CriticalOvertoppingDischarge, structure.CriticalOvertoppingDischarge); + TestHelper.AssertAreEqualButNotSame(otherStructure.AllowedLevelIncreaseStorage, structure.AllowedLevelIncreaseStorage); + TestHelper.AssertAreEqualButNotSame(otherStructure.AreaFlowApertures, structure.AreaFlowApertures); + TestHelper.AssertAreEqualButNotSame(otherStructure.CriticalOvertoppingDischarge, structure.CriticalOvertoppingDischarge); Assert.AreEqual(otherStructure.FailureProbabilityOpenStructure, structure.FailureProbabilityOpenStructure); Assert.AreEqual(otherStructure.FailureProbabilityReparation, structure.FailureProbabilityReparation); Assert.AreEqual(otherStructure.IdenticalApertures, structure.IdenticalApertures); Assert.AreEqual(otherStructure.ProbabilityOrFrequencyOpenStructureBeforeFlooding, structure.ProbabilityOrFrequencyOpenStructureBeforeFlooding); - AssertAreEqualButNotSame(otherStructure.FlowWidthAtBottomProtection, structure.FlowWidthAtBottomProtection); - AssertAreEqualButNotSame(otherStructure.InsideWaterLevel, structure.InsideWaterLevel); - AssertAreEqualButNotSame(otherStructure.LevelCrestStructureNotClosing, structure.LevelCrestStructureNotClosing); - AssertAreEqualButNotSame(otherStructure.StorageStructureArea, structure.StorageStructureArea); - AssertAreEqualButNotSame(otherStructure.ThresholdHeightOpenWeir, structure.ThresholdHeightOpenWeir); - AssertAreEqualButNotSame(otherStructure.WidthFlowApertures, structure.WidthFlowApertures); + TestHelper.AssertAreEqualButNotSame(otherStructure.FlowWidthAtBottomProtection, structure.FlowWidthAtBottomProtection); + TestHelper.AssertAreEqualButNotSame(otherStructure.InsideWaterLevel, structure.InsideWaterLevel); + TestHelper.AssertAreEqualButNotSame(otherStructure.LevelCrestStructureNotClosing, structure.LevelCrestStructureNotClosing); + TestHelper.AssertAreEqualButNotSame(otherStructure.StorageStructureArea, structure.StorageStructureArea); + TestHelper.AssertAreEqualButNotSame(otherStructure.ThresholdHeightOpenWeir, structure.ThresholdHeightOpenWeir); + TestHelper.AssertAreEqualButNotSame(otherStructure.WidthFlowApertures, structure.WidthFlowApertures); } [Test] @@ -448,11 +448,5 @@ // Assert Assert.AreEqual(hashCodeOne, hashCodeTwo); } - - private static void AssertAreEqualButNotSame(object expected, object actual) - { - Assert.AreEqual(expected, actual, "Objects not equal"); - Assert.AreNotSame(expected, actual, "Objects the same"); - } } } \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/DikeProfiles/DikeProfileTest.cs =================================================================== diff -u -r581725e1056b02305f9ec09bc8501882b23657bd -r9ca2ce99f8b1d93fb1edde4e505b5acc5094a256 --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/DikeProfiles/DikeProfileTest.cs (.../DikeProfileTest.cs) (revision 581725e1056b02305f9ec09bc8501882b23657bd) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/DikeProfiles/DikeProfileTest.cs (.../DikeProfileTest.cs) (revision 9ca2ce99f8b1d93fb1edde4e505b5acc5094a256) @@ -780,8 +780,7 @@ dikeProfileToUpdate.CopyProperties(dikeProfileToUpdateFrom); // Assert - Assert.AreEqual(expectedWorldReferencePoint, dikeProfileToUpdate.WorldReferencePoint); - Assert.AreNotSame(expectedWorldReferencePoint, dikeProfileToUpdate.WorldReferencePoint); + TestHelper.AssertAreEqualButNotSame(expectedWorldReferencePoint, dikeProfileToUpdate.WorldReferencePoint); CollectionAssert.AreEqual(expectedForeshoreGeometry, dikeProfileToUpdate.ForeshoreGeometry); for (var i = 0; i < expectedForeshoreGeometry.Length; i++) { @@ -792,8 +791,7 @@ { Assert.AreNotSame(expectedDikeGeometry[i], dikeProfileToUpdate.DikeGeometry.ElementAt(i)); } - Assert.AreEqual(expectedBreakWater, dikeProfileToUpdate.BreakWater); - Assert.AreNotSame(expectedBreakWater, dikeProfileToUpdate.BreakWater); + TestHelper.AssertAreEqualButNotSame(expectedBreakWater, dikeProfileToUpdate.BreakWater); Assert.AreEqual(expectedId, dikeProfileToUpdate.Id); Assert.AreEqual(expectedName, dikeProfileToUpdate.Name); Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructureTest.cs =================================================================== diff -u -r1c568c57d0e52050b688773ec8570157c894d4a9 -r9ca2ce99f8b1d93fb1edde4e505b5acc5094a256 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructureTest.cs (.../HeightStructureTest.cs) (revision 1c568c57d0e52050b688773ec8570157c894d4a9) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructureTest.cs (.../HeightStructureTest.cs) (revision 9ca2ce99f8b1d93fb1edde4e505b5acc5094a256) @@ -271,15 +271,15 @@ // Assert Assert.AreNotEqual(otherStructure.Id, structure.Id); Assert.AreEqual(otherStructure.Name, structure.Name); - AssertAreEqualButNotSame(otherStructure.Location, structure.Location); + TestHelper.AssertAreEqualButNotSame(otherStructure.Location, structure.Location); Assert.AreEqual(otherStructure.StructureNormalOrientation, structure.StructureNormalOrientation); - AssertAreEqualButNotSame(otherStructure.AllowedLevelIncreaseStorage, structure.AllowedLevelIncreaseStorage); - AssertAreEqualButNotSame(otherStructure.CriticalOvertoppingDischarge, structure.CriticalOvertoppingDischarge); + TestHelper.AssertAreEqualButNotSame(otherStructure.AllowedLevelIncreaseStorage, structure.AllowedLevelIncreaseStorage); + TestHelper.AssertAreEqualButNotSame(otherStructure.CriticalOvertoppingDischarge, structure.CriticalOvertoppingDischarge); Assert.AreEqual(otherStructure.FailureProbabilityStructureWithErosion, structure.FailureProbabilityStructureWithErosion); - AssertAreEqualButNotSame(otherStructure.FlowWidthAtBottomProtection, structure.FlowWidthAtBottomProtection); - AssertAreEqualButNotSame(otherStructure.LevelCrestStructure, structure.LevelCrestStructure); - AssertAreEqualButNotSame(otherStructure.StorageStructureArea, structure.StorageStructureArea); - AssertAreEqualButNotSame(otherStructure.WidthFlowApertures, structure.WidthFlowApertures); + TestHelper.AssertAreEqualButNotSame(otherStructure.FlowWidthAtBottomProtection, structure.FlowWidthAtBottomProtection); + TestHelper.AssertAreEqualButNotSame(otherStructure.LevelCrestStructure, structure.LevelCrestStructure); + TestHelper.AssertAreEqualButNotSame(otherStructure.StorageStructureArea, structure.StorageStructureArea); + TestHelper.AssertAreEqualButNotSame(otherStructure.WidthFlowApertures, structure.WidthFlowApertures); } [Test] @@ -360,11 +360,5 @@ // Assert Assert.AreEqual(hashCodeOne, hashCodeTwo); } - - private static void AssertAreEqualButNotSame(object expected, object actual) - { - Assert.AreEqual(expected, actual, "Objects not equal"); - Assert.AreNotSame(expected, actual, "Objects the same"); - } } } \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Primitives/RingtoetsPipingSurfaceLine.cs =================================================================== diff -u -r4b8ab1201eba50035392ce074fa1cc5da25ff4a7 -r9ca2ce99f8b1d93fb1edde4e505b5acc5094a256 --- Ringtoets/Piping/src/Ringtoets.Piping.Primitives/RingtoetsPipingSurfaceLine.cs (.../RingtoetsPipingSurfaceLine.cs) (revision 4b8ab1201eba50035392ce074fa1cc5da25ff4a7) +++ Ringtoets/Piping/src/Ringtoets.Piping.Primitives/RingtoetsPipingSurfaceLine.cs (.../RingtoetsPipingSurfaceLine.cs) (revision 9ca2ce99f8b1d93fb1edde4e505b5acc5094a256) @@ -369,8 +369,7 @@ Name = fromSurfaceLine.Name; ReferenceLineIntersectionWorldPoint = fromSurfaceLine.ReferenceLineIntersectionWorldPoint != null - ? new Point2D(fromSurfaceLine.ReferenceLineIntersectionWorldPoint.X, - fromSurfaceLine.ReferenceLineIntersectionWorldPoint.Y) + ? new Point2D(fromSurfaceLine.ReferenceLineIntersectionWorldPoint) : null; SetGeometry(fromSurfaceLine.Points); ClearCharacteristicPoints(); Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/RingtoetsPipingSurfaceLineTest.cs =================================================================== diff -u -r4b8ab1201eba50035392ce074fa1cc5da25ff4a7 -r9ca2ce99f8b1d93fb1edde4e505b5acc5094a256 --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/RingtoetsPipingSurfaceLineTest.cs (.../RingtoetsPipingSurfaceLineTest.cs) (revision 4b8ab1201eba50035392ce074fa1cc5da25ff4a7) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/RingtoetsPipingSurfaceLineTest.cs (.../RingtoetsPipingSurfaceLineTest.cs) (revision 9ca2ce99f8b1d93fb1edde4e505b5acc5094a256) @@ -100,8 +100,8 @@ // Assert Assert.AreNotSame(sourceData, surfaceLine.Points); CollectionAssert.AreEqual(sourceData, surfaceLine.Points); - Assert.AreEqual(sourceData[0], surfaceLine.StartingWorldPoint); - Assert.AreEqual(sourceData[0], surfaceLine.EndingWorldPoint); + TestHelper.AssertAreEqualButNotSame(sourceData[0], surfaceLine.StartingWorldPoint); + TestHelper.AssertAreEqualButNotSame(sourceData[0], surfaceLine.EndingWorldPoint); } [Test] @@ -1140,29 +1140,19 @@ private static void AssertPropertiesUpdated(RingtoetsPipingSurfaceLine expectedSurfaceLine, RingtoetsPipingSurfaceLine actualSurfaceLine) { Assert.AreEqual(expectedSurfaceLine.Name, actualSurfaceLine.Name); - AssertAreEqualButNotSame(expectedSurfaceLine.ReferenceLineIntersectionWorldPoint, + TestHelper.AssertAreEqualButNotSame(expectedSurfaceLine.ReferenceLineIntersectionWorldPoint, actualSurfaceLine.ReferenceLineIntersectionWorldPoint); CollectionAssert.AreEqual(expectedSurfaceLine.Points, actualSurfaceLine.Points); for (var i = 0; i < expectedSurfaceLine.Points.Length; i++) { Assert.AreNotSame(expectedSurfaceLine.Points[i], actualSurfaceLine.Points[i]); } - AssertAreEqualButNotSame(expectedSurfaceLine.BottomDitchDikeSide, actualSurfaceLine.BottomDitchDikeSide); - AssertAreEqualButNotSame(expectedSurfaceLine.BottomDitchPolderSide, actualSurfaceLine.BottomDitchPolderSide); - AssertAreEqualButNotSame(expectedSurfaceLine.DikeToeAtPolder, actualSurfaceLine.DikeToeAtPolder); - AssertAreEqualButNotSame(expectedSurfaceLine.DikeToeAtRiver, actualSurfaceLine.DikeToeAtRiver); - AssertAreEqualButNotSame(expectedSurfaceLine.DitchPolderSide, actualSurfaceLine.DitchPolderSide); - AssertAreEqualButNotSame(expectedSurfaceLine.DitchDikeSide, actualSurfaceLine.DitchDikeSide); + TestHelper.AssertAreEqualButNotSame(expectedSurfaceLine.BottomDitchDikeSide, actualSurfaceLine.BottomDitchDikeSide); + TestHelper.AssertAreEqualButNotSame(expectedSurfaceLine.BottomDitchPolderSide, actualSurfaceLine.BottomDitchPolderSide); + TestHelper.AssertAreEqualButNotSame(expectedSurfaceLine.DikeToeAtPolder, actualSurfaceLine.DikeToeAtPolder); + TestHelper.AssertAreEqualButNotSame(expectedSurfaceLine.DikeToeAtRiver, actualSurfaceLine.DikeToeAtRiver); + TestHelper.AssertAreEqualButNotSame(expectedSurfaceLine.DitchPolderSide, actualSurfaceLine.DitchPolderSide); + TestHelper.AssertAreEqualButNotSame(expectedSurfaceLine.DitchDikeSide, actualSurfaceLine.DitchDikeSide); } - - private static void AssertAreEqualButNotSame(object expected, object actual) - { - Assert.AreEqual(expected, actual, "Objects not equal"); - - if (expected != null) - { - Assert.AreNotSame(expected, actual, "Objects the same"); - } - } } } \ No newline at end of file Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/StabilityPointStructureTest.cs =================================================================== diff -u -r1c568c57d0e52050b688773ec8570157c894d4a9 -r9ca2ce99f8b1d93fb1edde4e505b5acc5094a256 --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/StabilityPointStructureTest.cs (.../StabilityPointStructureTest.cs) (revision 1c568c57d0e52050b688773ec8570157c894d4a9) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/StabilityPointStructureTest.cs (.../StabilityPointStructureTest.cs) (revision 9ca2ce99f8b1d93fb1edde4e505b5acc5094a256) @@ -579,31 +579,31 @@ // Assert Assert.AreNotEqual(otherStructure.Id, structure.Id); Assert.AreEqual(otherStructure.Name, structure.Name); - AssertAreEqualButNotSame(otherStructure.Location, structure.Location); - AssertAreEqualButNotSame(otherStructure.StorageStructureArea, structure.StorageStructureArea); - AssertAreEqualButNotSame(otherStructure.AllowedLevelIncreaseStorage, structure.AllowedLevelIncreaseStorage); - AssertAreEqualButNotSame(otherStructure.WidthFlowApertures, structure.WidthFlowApertures); - AssertAreEqualButNotSame(otherStructure.InsideWaterLevel, structure.InsideWaterLevel); - AssertAreEqualButNotSame(otherStructure.ThresholdHeightOpenWeir, structure.ThresholdHeightOpenWeir); - AssertAreEqualButNotSame(otherStructure.CriticalOvertoppingDischarge, structure.CriticalOvertoppingDischarge); - AssertAreEqualButNotSame(otherStructure.FlowWidthAtBottomProtection, structure.FlowWidthAtBottomProtection); - AssertAreEqualButNotSame(otherStructure.ConstructiveStrengthLinearLoadModel, structure.ConstructiveStrengthLinearLoadModel); - AssertAreEqualButNotSame(otherStructure.ConstructiveStrengthQuadraticLoadModel, structure.ConstructiveStrengthQuadraticLoadModel); - AssertAreEqualButNotSame(otherStructure.BankWidth, structure.BankWidth); - AssertAreEqualButNotSame(otherStructure.InsideWaterLevelFailureConstruction, structure.InsideWaterLevelFailureConstruction); + TestHelper.AssertAreEqualButNotSame(otherStructure.Location, structure.Location); + TestHelper.AssertAreEqualButNotSame(otherStructure.StorageStructureArea, structure.StorageStructureArea); + TestHelper.AssertAreEqualButNotSame(otherStructure.AllowedLevelIncreaseStorage, structure.AllowedLevelIncreaseStorage); + TestHelper.AssertAreEqualButNotSame(otherStructure.WidthFlowApertures, structure.WidthFlowApertures); + TestHelper.AssertAreEqualButNotSame(otherStructure.InsideWaterLevel, structure.InsideWaterLevel); + TestHelper.AssertAreEqualButNotSame(otherStructure.ThresholdHeightOpenWeir, structure.ThresholdHeightOpenWeir); + TestHelper.AssertAreEqualButNotSame(otherStructure.CriticalOvertoppingDischarge, structure.CriticalOvertoppingDischarge); + TestHelper.AssertAreEqualButNotSame(otherStructure.FlowWidthAtBottomProtection, structure.FlowWidthAtBottomProtection); + TestHelper.AssertAreEqualButNotSame(otherStructure.ConstructiveStrengthLinearLoadModel, structure.ConstructiveStrengthLinearLoadModel); + TestHelper.AssertAreEqualButNotSame(otherStructure.ConstructiveStrengthQuadraticLoadModel, structure.ConstructiveStrengthQuadraticLoadModel); + TestHelper.AssertAreEqualButNotSame(otherStructure.BankWidth, structure.BankWidth); + TestHelper.AssertAreEqualButNotSame(otherStructure.InsideWaterLevelFailureConstruction, structure.InsideWaterLevelFailureConstruction); Assert.AreEqual(otherStructure.EvaluationLevel, structure.EvaluationLevel); - AssertAreEqualButNotSame(otherStructure.LevelCrestStructure, structure.LevelCrestStructure); + TestHelper.AssertAreEqualButNotSame(otherStructure.LevelCrestStructure, structure.LevelCrestStructure); Assert.AreEqual(otherStructure.VerticalDistance, structure.VerticalDistance); Assert.AreEqual(otherStructure.FailureProbabilityRepairClosure, structure.FailureProbabilityRepairClosure); - AssertAreEqualButNotSame(otherStructure.FailureCollisionEnergy, structure.FailureCollisionEnergy); - AssertAreEqualButNotSame(otherStructure.ShipMass, structure.ShipMass); - AssertAreEqualButNotSame(otherStructure.ShipVelocity, structure.ShipVelocity); + TestHelper.AssertAreEqualButNotSame(otherStructure.FailureCollisionEnergy, structure.FailureCollisionEnergy); + TestHelper.AssertAreEqualButNotSame(otherStructure.ShipMass, structure.ShipMass); + TestHelper.AssertAreEqualButNotSame(otherStructure.ShipVelocity, structure.ShipVelocity); Assert.AreEqual(otherStructure.LevellingCount, structure.LevellingCount); Assert.AreEqual(otherStructure.ProbabilityCollisionSecondaryStructure, structure.ProbabilityCollisionSecondaryStructure); - AssertAreEqualButNotSame(otherStructure.FlowVelocityStructureClosable, structure.FlowVelocityStructureClosable); - AssertAreEqualButNotSame(otherStructure.StabilityLinearLoadModel, structure.StabilityLinearLoadModel); - AssertAreEqualButNotSame(otherStructure.StabilityQuadraticLoadModel, structure.StabilityQuadraticLoadModel); - AssertAreEqualButNotSame(otherStructure.AreaFlowApertures, structure.AreaFlowApertures); + TestHelper.AssertAreEqualButNotSame(otherStructure.FlowVelocityStructureClosable, structure.FlowVelocityStructureClosable); + TestHelper.AssertAreEqualButNotSame(otherStructure.StabilityLinearLoadModel, structure.StabilityLinearLoadModel); + TestHelper.AssertAreEqualButNotSame(otherStructure.StabilityQuadraticLoadModel, structure.StabilityQuadraticLoadModel); + TestHelper.AssertAreEqualButNotSame(otherStructure.AreaFlowApertures, structure.AreaFlowApertures); Assert.AreEqual(otherStructure.InflowModelType, structure.InflowModelType); } @@ -685,11 +685,5 @@ // Assert Assert.AreEqual(hashCodeOne, hashCodeTwo); } - - private static void AssertAreEqualButNotSame(object expected, object actual) - { - Assert.AreEqual(expected, actual, "Objects not equal"); - Assert.AreNotSame(expected, actual, "Objects the same"); - } } } \ No newline at end of file