Index: DamClients/DamUI/trunk/src/Dam/Tests/EntityFactoryTest.cs =================================================================== diff -u -r3823 -r3825 --- DamClients/DamUI/trunk/src/Dam/Tests/EntityFactoryTest.cs (.../EntityFactoryTest.cs) (revision 3823) +++ DamClients/DamUI/trunk/src/Dam/Tests/EntityFactoryTest.cs (.../EntityFactoryTest.cs) (revision 3825) @@ -19,15 +19,14 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using System; using System.Collections.Generic; using System.Linq; using Deltares.Dam.Data; -using Deltares.Dam.TestHelper.TestUtils; using Deltares.Geometry; using Deltares.Geotechnics.GeotechnicalGeometry; using Deltares.Geotechnics.Soils; using Deltares.Geotechnics.SurfaceLines; +using Deltares.Geotechnics.TestUtils; using NUnit.Framework; namespace Deltares.Dam.Tests @@ -38,7 +37,7 @@ private EntityFactory factory; private SoilProfile1D soilProfile; - [TestFixtureSetUp] + [SetUp] public void FixtureSetup() { soilProfile = FactoryForSoilProfileTests.CreateSimpleProfile(); @@ -52,31 +51,27 @@ } [Test] - [ExpectedException(typeof(ArgumentException))] public void ThrowsExceptionWhenSegmentIdIsNull() { - factory.CreateSegment(null, "D1", 1, FailureMechanismSystemType.StabilityInside, null); + Assert.That(() => factory.CreateSegment(null, "D1", 1, FailureMechanismSystemType.StabilityInside, null), Throws.ArgumentException); } [Test] - [ExpectedException(typeof(ArgumentException))] public void ThrowsExceptionWhenSegmentIdIsEmpty() { - factory.CreateSegment("", "D1", 1, FailureMechanismSystemType.StabilityInside, null); + Assert.That(() => factory.CreateSegment("", "D1", 1, FailureMechanismSystemType.StabilityInside, null), Throws.ArgumentException); } [Test] - [ExpectedException(typeof(EntityFactoryException))] public void ThrowsExceptionWhenSoilProfileIdIsNull() { - factory.CreateSegment("1", null, 1, FailureMechanismSystemType.StabilityInside, null); + Assert.That(() => factory.CreateSegment("1", null, 1, FailureMechanismSystemType.StabilityInside, null), Throws.InstanceOf()); } [Test] - [ExpectedException(typeof(EntityFactoryException))] public void ThrowsExceptionWhenSoilProfileIdIsEmpty() { - factory.CreateSegment("1", "", 1, FailureMechanismSystemType.StabilityInside, null); + Assert.That(() => factory.CreateSegment("1", "", 1, FailureMechanismSystemType.StabilityInside, null), Throws.InstanceOf()); } [Test] @@ -131,16 +126,14 @@ } [Test] - [ExpectedException(typeof(RequiredEntityNotExistException))] public void ThrowsWhenTheRequiredSurfaceLineDoesNotExistInLookupOnCreatingASurfaceLinePoint() { const string surfaceLineId = "D1"; - factory.CreateSurfaceLinePoint(surfaceLineId, CharacteristicPointType.TrafficLoadOutside, 0, 0); + Assert.That(() => factory.CreateSurfaceLinePoint(surfaceLineId, CharacteristicPointType.TrafficLoadOutside, 0, 0), Throws.InstanceOf()); } [Test] - [ExpectedException(typeof(PointNotExistsException))] - public void ThrowsExceptionWhenPointToAddDoesNotExistInSurfaceLinePoinList() + public void ThrowsExceptionWhenPointToAddDoesNotExistInSurfaceLinePointList() { const string surfaceLineId = "D1"; using (var surfaceLine2 = new SurfaceLine2 @@ -154,9 +147,9 @@ { surfaceLine2 }; - + factory = new EntityFactory(surfaceLines); - factory.CreateSurfaceLinePoint(surfaceLineId, CharacteristicPointType.TrafficLoadOutside, 0, 0); + Assert.That(() => factory.CreateSurfaceLinePoint(surfaceLineId, CharacteristicPointType.TrafficLoadOutside, 0, 0), Throws.InstanceOf()); } } @@ -278,7 +271,7 @@ Assert.AreSame(factory.SoilProfiles.ElementAt(0), segment.GetMostProbableProfile(FailureMechanismSystemType.StabilityInside)); } - [TestFixtureTearDown] + [TearDown] public void FixtureTearDown() { }