Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj =================================================================== diff -u -r23d7af54feb72aa59fa17acb00d29a16921f1b94 -r246ebb0ea665a568e9073717d4211816220ff0fc --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision 23d7af54feb72aa59fa17acb00d29a16921f1b94) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision 246ebb0ea665a568e9073717d4211816220ff0fc) @@ -83,7 +83,7 @@ - + Fisheye: Tag 246ebb0ea665a568e9073717d4211816220ff0fc refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/FailureMechanismBaseCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/FailureMechanismBaseCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/FailureMechanismBaseCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/FailureMechanismBaseCreateExtensionsTest.cs (revision 246ebb0ea665a568e9073717d4211816220ff0fc) @@ -0,0 +1,112 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets 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.Generic; +using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.DbContext; +using Core.Common.Base.Geometry; +using NUnit.Framework; +using Ringtoets.Common.Data.Calculation; +using Ringtoets.Common.Data.FailureMechanism; + +namespace Application.Ringtoets.Storage.Test.Create +{ + [TestFixture] + public class FailureMechanismBaseCreateExtensionsTest + { + [Test] + public void CreateFailureMechanismSections_WithoutCollector_ThrowsArgumentNullException() + { + // Setup + var failureMechanism = new TestFailureMechanism(); + + // Call + TestDelegate test = () => failureMechanism.AddEntitiesForFailureMechanismSections(null, new FailureMechanismEntity()); + + // Assert + var paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("collector", paramName); + } + + [Test] + public void CreateFailureMechanismSections_WithoutEntity_ThrowsArgumentNullException() + { + // Setup + var failureMechanism = new TestFailureMechanism(); + + // Call + TestDelegate test = () => failureMechanism.AddEntitiesForFailureMechanismSections(new CreateConversionCollector(), null); + + // Assert + var paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("entity", paramName); + } + + [Test] + public void CreateFailureMechanismSections_WithoutSections_EmptyFailureMechanismSectionEntities() + { + // Setup + var failureMechanism = new TestFailureMechanism(); + var failureMechanismEntity = new FailureMechanismEntity(); + + // Call + failureMechanism.AddEntitiesForFailureMechanismSections(new CreateConversionCollector(), failureMechanismEntity); + + // Assert + Assert.IsEmpty(failureMechanismEntity.FailureMechanismSectionEntities); + } + + [Test] + public void CreateFailureMechanismSections_WithSections_FailureMechanismSectionEntitiesCreated() + { + // Setup + var failureMechanism = new TestFailureMechanism(); + failureMechanism.AddSection(new FailureMechanismSection("", new [] { new Point2D(0,0) })); + var failureMechanismEntity = new FailureMechanismEntity(); + + // Call + failureMechanism.AddEntitiesForFailureMechanismSections(new CreateConversionCollector(), failureMechanismEntity); + + // Assert + Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count); + } + + private class TestFailureMechanism : FailureMechanismBase + { + public TestFailureMechanism() : base("name", "code") + { } + + public override IEnumerable Calculations + { + get + { + throw new NotImplementedException(); + } + } + + protected override FailureMechanismSectionResult CreateFailureMechanismSectionResult(FailureMechanismSection section) + { + return new FailureMechanismSectionResult(section); + } + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/AssessmentSectionUpdateExtensionsTest.cs =================================================================== diff -u -r35408ec0912670519b01cff44a19a3e2fb12d8d6 -r246ebb0ea665a568e9073717d4211816220ff0fc --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/AssessmentSectionUpdateExtensionsTest.cs (.../AssessmentSectionUpdateExtensionsTest.cs) (revision 35408ec0912670519b01cff44a19a3e2fb12d8d6) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/AssessmentSectionUpdateExtensionsTest.cs (.../AssessmentSectionUpdateExtensionsTest.cs) (revision 246ebb0ea665a568e9073717d4211816220ff0fc) @@ -39,7 +39,7 @@ public class AssessmentSectionUpdateExtensionsTest { [Test] - public void Update_WithoutContext_ArgumentNullException() + public void Update_WithoutContext_ThrowsArgumentNullException() { // Setup var section = new AssessmentSection(AssessmentSectionComposition.Dike); @@ -53,7 +53,7 @@ } [Test] - public void Update_WithoutCollector_ArgumentNullException() + public void Update_WithoutCollector_ThrowsArgumentNullException() { // Setup var section = new AssessmentSection(AssessmentSectionComposition.Dike); @@ -582,11 +582,11 @@ { StorageId = 9 }, - GrassCoverSlipOffOutside = + GrassCoverSlipOffOutside = { StorageId = 10 }, - PipingStructure = + PipingStructure = { StorageId = 11 }, @@ -616,5 +616,4 @@ } } } - } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverErosionInwardsFailureMechanismUpdateExtensionsTest.cs =================================================================== diff -u -r35408ec0912670519b01cff44a19a3e2fb12d8d6 -r246ebb0ea665a568e9073717d4211816220ff0fc --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverErosionInwardsFailureMechanismUpdateExtensionsTest.cs (.../GrassCoverErosionInwardsFailureMechanismUpdateExtensionsTest.cs) (revision 35408ec0912670519b01cff44a19a3e2fb12d8d6) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/GrassCoverErosionInwardsFailureMechanismUpdateExtensionsTest.cs (.../GrassCoverErosionInwardsFailureMechanismUpdateExtensionsTest.cs) (revision 246ebb0ea665a568e9073717d4211816220ff0fc) @@ -37,7 +37,7 @@ public class GrassCoverErosionInwardsFailureMechanismUpdateExtensionsTest { [Test] - public void Update_WithoutContext_ArgumentNullException() + public void Update_WithoutContext_ThrowsArgumentNullException() { // Setup var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); @@ -51,7 +51,7 @@ } [Test] - public void Update_WithoutCollector_ArgumentNullException() + public void Update_WithoutCollector_ThrowsArgumentNullException() { // Setup var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); @@ -71,7 +71,7 @@ } [Test] - public void Update_ContextWithNoGrassCoverErosionInwardsFailureMechanism_EntityNotFoundException() + public void Update_ContextWithNoGrassCoverErosionInwardsFailureMechanism_ThrowsEntityNotFoundException() { // Setup var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); @@ -92,7 +92,7 @@ } [Test] - public void Update_ContextWithNoGrassCoverErosionInwardsFailureMechanismWithId_EntityNotFoundException() + public void Update_ContextWithNoGrassCoverErosionInwardsFailureMechanismWithId_ThrowsEntityNotFoundException() { // Setup MockRepository mocks = new MockRepository(); @@ -153,7 +153,7 @@ mocks.VerifyAll(); } - + [Test] public void Update_ContextWithNewFailureMechanismSections_FailureMechanismSectionsAdded() { @@ -167,7 +167,10 @@ { StorageId = 1 }; - failureMechanism.AddSection(new FailureMechanismSection("", new[] { new Point2D(0, 0) })); + failureMechanism.AddSection(new FailureMechanismSection("", new[] + { + new Point2D(0, 0) + })); var failureMechanismEntity = new FailureMechanismEntity { @@ -199,8 +202,11 @@ StorageId = 1 }; var testName = "testName"; - failureMechanism.AddSection(new FailureMechanismSection(testName, new[] { new Point2D(0, 0) }) + failureMechanism.AddSection(new FailureMechanismSection(testName, new[] { + new Point2D(0, 0) + }) + { StorageId = 1 }); @@ -211,7 +217,7 @@ var failureMechanismEntity = new FailureMechanismEntity { FailureMechanismEntityId = 1, - FailureMechanismSectionEntities = + FailureMechanismSectionEntities = { failureMechanismSectionEntity } @@ -228,6 +234,6 @@ Assert.AreEqual(testName, failureMechanismEntity.FailureMechanismSectionEntities.ElementAt(0).Name); mocks.VerifyAll(); - } + } } } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/ProjectUpdateExtensionsTest.cs =================================================================== diff -u -r35408ec0912670519b01cff44a19a3e2fb12d8d6 -r246ebb0ea665a568e9073717d4211816220ff0fc --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/ProjectUpdateExtensionsTest.cs (.../ProjectUpdateExtensionsTest.cs) (revision 35408ec0912670519b01cff44a19a3e2fb12d8d6) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/ProjectUpdateExtensionsTest.cs (.../ProjectUpdateExtensionsTest.cs) (revision 246ebb0ea665a568e9073717d4211816220ff0fc) @@ -36,7 +36,7 @@ public class ProjectUpdateExtensionsTest { [Test] - public void Update_WithoutContext_ArgumentNullException() + public void Update_WithoutContext_ThrowsArgumentNullException() { // Setup var project = new Project(); @@ -47,10 +47,10 @@ // Assert var paramName = Assert.Throws(test).ParamName; Assert.AreEqual("context", paramName); - } + } [Test] - public void Update_WithoutCollector_ArgumentNullException() + public void Update_WithoutCollector_ThrowsArgumentNullException() { // Setup var project = new Project(); @@ -67,10 +67,10 @@ // Assert var paramName = Assert.Throws(test).ParamName; Assert.AreEqual("collector", paramName); - } + } [Test] - public void Update_ContextWithNoProject_EntityNotFoundException() + public void Update_ContextWithNoProject_ThrowsEntityNotFoundException() { // Setup var project = new Project(); @@ -86,10 +86,10 @@ // Assert Assert.Throws(test); - } + } [Test] - public void Update_ContextWithNoProjectWithId_EntityNotFoundException() + public void Update_ContextWithNoProjectWithId_ThrowsEntityNotFoundException() { // Setup MockRepository mocks = new MockRepository(); @@ -120,7 +120,7 @@ } [Test] - public void Update_ContextWithMultipleProjectsWithId_EntityNotFoundException() + public void Update_ContextWithMultipleProjectsWithId_ThrowsEntityNotFoundException() { // Setup MockRepository mocks = new MockRepository(); @@ -157,7 +157,7 @@ Assert.AreEqual(expectedInnerMessage, exception.InnerException.Message); mocks.VerifyAll(); - } + } [Test] public void Update_ContextWithProject_DescriptionUpdated() @@ -277,11 +277,11 @@ { StorageId = 1 }, - GrassCoverSlipOffOutside = + GrassCoverSlipOffOutside = { StorageId = 1 }, - PipingStructure = + PipingStructure = { StorageId = 1 }, @@ -317,9 +317,12 @@ project.Update(new UpdateConversionCollector(), ringtoetsEntities); // Assert - CollectionAssert.AreEqual(new [] {assessmentSectionEntity}, projectEntity.AssessmentSectionEntities); + CollectionAssert.AreEqual(new[] + { + assessmentSectionEntity + }, projectEntity.AssessmentSectionEntities); mocks.VerifyAll(); - } + } } } \ No newline at end of file