Index: Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Service.Test/ClosingStructureDataSynchronizationServiceTest.cs =================================================================== diff -u -r6a22c0bc4da3805d6e2ca60f6c89de919a340453 -r0bfba7b4c19b735a030889ca66d0e6ae90a54529 --- Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Service.Test/ClosingStructureDataSynchronizationServiceTest.cs (.../ClosingStructureDataSynchronizationServiceTest.cs) (revision 6a22c0bc4da3805d6e2ca60f6c89de919a340453) +++ Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Service.Test/ClosingStructureDataSynchronizationServiceTest.cs (.../ClosingStructureDataSynchronizationServiceTest.cs) (revision 0bfba7b4c19b735a030889ca66d0e6ae90a54529) @@ -43,25 +43,21 @@ public void RemoveStructure_StructureNull_ThrowsArgumentNullException() { // Call - TestDelegate test = () => ClosingStructuresDataSynchronizationService.RemoveStructure( - null, - new ClosingStructuresFailureMechanism()); + void Call() => ClosingStructuresDataSynchronizationService.RemoveStructure(null, new ClosingStructuresFailureMechanism()); // Assert - var exception = Assert.Throws(test); + var exception = Assert.Throws(Call); Assert.AreEqual("structure", exception.ParamName); } [Test] public void RemoveStructure_FailureMechanismNull_ThrowsArgumentNullException() { // Call - TestDelegate test = () => ClosingStructuresDataSynchronizationService.RemoveStructure( - new TestClosingStructure(), - null); + void Call() => ClosingStructuresDataSynchronizationService.RemoveStructure(new TestClosingStructure(), null); // Assert - var exception = Assert.Throws(test); + var exception = Assert.Throws(Call); Assert.AreEqual("failureMechanism", exception.ParamName); } @@ -71,12 +67,9 @@ // Setup var failureMechanism = new ClosingStructuresFailureMechanism(); - var locationStructureToRemove = new Point2D(0, 0); - var structureToRemove = new TestClosingStructure(locationStructureToRemove, "id1"); + var structureToRemove = new TestClosingStructure(new Point2D(0, 0), "id1"); + var structureToKeep = new TestClosingStructure(new Point2D(2, 2), "id2"); - var locationStructureToKeep = new Point2D(2, 2); - var structureToKeep = new TestClosingStructure(locationStructureToKeep, "id2"); - failureMechanism.ClosingStructures.AddRange(new[] { structureToRemove, @@ -118,20 +111,6 @@ calculationWithStructureToRemoveAndOutput }); - FailureMechanismTestHelper.SetSections(failureMechanism, new[] - { - FailureMechanismSectionTestFactory.CreateFailureMechanismSection(new[] - { - locationStructureToRemove, - new Point2D(1, 1) - }), - FailureMechanismSectionTestFactory.CreateFailureMechanismSection(new[] - { - new Point2D(1, 1), - locationStructureToKeep - }) - }); - // Call IEnumerable affectedObjects = ClosingStructuresDataSynchronizationService.RemoveStructure( structureToRemove, failureMechanism); @@ -161,11 +140,11 @@ public void RemoveAllStructures_FailureMechanismNull_ThrowsArgumentNullException() { // Call - TestDelegate call = () => ClosingStructuresDataSynchronizationService.RemoveAllStructures(null); + void Call() => ClosingStructuresDataSynchronizationService.RemoveAllStructures(null); // Assert - string paramName = Assert.Throws(call).ParamName; - Assert.AreEqual("failureMechanism", paramName); + var exception = Assert.Throws(Call); + Assert.AreEqual("failureMechanism", exception.ParamName); } [Test] @@ -174,12 +153,9 @@ // Setup var failureMechanism = new ClosingStructuresFailureMechanism(); - var locationStructureA = new Point2D(0, 0); - var structureA = new TestClosingStructure(locationStructureA, "A"); + var structureA = new TestClosingStructure(new Point2D(0, 0), "A"); + var structureB = new TestClosingStructure(new Point2D(2, 2), "B"); - var locationStructureB = new Point2D(2, 2); - var structureB = new TestClosingStructure(locationStructureB, "B"); - failureMechanism.ClosingStructures.AddRange(new[] { structureA, @@ -221,21 +197,6 @@ calculationWithStructureAAndOutput }); - FailureMechanismTestHelper.SetSections(failureMechanism, new[] - { - FailureMechanismSectionTestFactory.CreateFailureMechanismSection(new[] - { - locationStructureA, - new Point2D(1, 1) - }), - FailureMechanismSectionTestFactory.CreateFailureMechanismSection(new[] - { - new Point2D(1, 1), - locationStructureB - }) - }); - - // Call IEnumerable affectedObjects = ClosingStructuresDataSynchronizationService.RemoveAllStructures(failureMechanism); @@ -266,10 +227,10 @@ public void ClearAllCalculationOutput_FailureMechanismNull_ThrowsArgumentNullException() { // Call - TestDelegate call = () => ClosingStructuresDataSynchronizationService.ClearAllCalculationOutput(null); + void Call() => ClosingStructuresDataSynchronizationService.ClearAllCalculationOutput(null); // Assert - var exception = Assert.Throws(call); + var exception = Assert.Throws(Call); Assert.AreEqual("failureMechanism", exception.ParamName); } @@ -316,10 +277,10 @@ public void ClearAllCalculationOutputAndHydraulicBoundaryLocations_WithoutFailureMechanism_ThrowsArgumentNullException() { // Call - TestDelegate call = () => ClosingStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations(null); + void Call() => ClosingStructuresDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations(null); // Assert - var exception = Assert.Throws(call); + var exception = Assert.Throws(Call); Assert.AreEqual("failureMechanism", exception.ParamName); } @@ -487,11 +448,11 @@ public void ClearReferenceLineDependentData_FailureMechanismNull_ThrowArgumentNullException() { // Call - TestDelegate call = () => ClosingStructuresDataSynchronizationService.ClearReferenceLineDependentData(null); + void Call() => ClosingStructuresDataSynchronizationService.ClearReferenceLineDependentData(null); // Assert - string paramName = Assert.Throws(call).ParamName; - Assert.AreEqual("failureMechanism", paramName); + var exception = Assert.Throws(Call); + Assert.AreEqual("failureMechanism", exception.ParamName); } [Test]