Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PersistenceRegistryTest.cs =================================================================== diff -u -rcf2b4ca40987c1f035b244cc80a382a2bf2cc12b -r85cf65b38e2e96810139a8490fec8eb5b95837a6 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PersistenceRegistryTest.cs (.../PersistenceRegistryTest.cs) (revision cf2b4ca40987c1f035b244cc80a382a2bf2cc12b) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PersistenceRegistryTest.cs (.../PersistenceRegistryTest.cs) (revision 85cf65b38e2e96810139a8490fec8eb5b95837a6) @@ -73,10 +73,10 @@ } [TestFixture] - private class PipingStochasticSoilModelTest : RegistryTest { - public PipingStochasticSoilModelTest() : base( + public PipingStochasticSoilModelRegistryTest() : base( (r, e, m) => r.Register(e, m), (r, m) => r.Contains(m), (r, m) => r.Get(m)) {} @@ -88,10 +88,10 @@ } [TestFixture] - private class PipingStochasticSoilProfileTest : RegistryTest { - public PipingStochasticSoilProfileTest() : base( + public PipingStochasticSoilProfileRegistryTest() : base( (r, e, m) => r.Register(e, m), (r, m) => r.Contains(m), (r, m) => r.Get(m)) {} @@ -103,10 +103,10 @@ } [TestFixture] - private class PipingSoilProfileTest : RegistryTest { - public PipingSoilProfileTest() : base( + public PipingSoilProfileRegistryTest() : base( (r, e, m) => r.Register(e, m), (r, m) => r.Contains(m), (r, m) => r.Get(m)) {} @@ -118,10 +118,10 @@ } [TestFixture] - private class PipingSurfaceLineTest : RegistryTest { - public PipingSurfaceLineTest() : base( + public PipingSurfaceLineRegistryTest() : base( (r, e, m) => r.Register(e, m), (r, m) => r.Contains(m), (r, m) => r.Get(m)) {} @@ -133,10 +133,10 @@ } [TestFixture] - private class MacroStabilityInwardsStochasticSoilModelTest : RegistryTest { - public MacroStabilityInwardsStochasticSoilModelTest() : base( + public MacroStabilityInwardsStochasticSoilModelRegistryTest() : base( (r, e, m) => r.Register(e, m), (r, m) => r.Contains(m), (r, m) => r.Get(m)) {} @@ -148,7 +148,7 @@ } [TestFixture] - private class MacroStabilityInwardsStochasticSoilProfileTest : RegistryTest { private MockRepository mockRepository; @@ -165,7 +165,7 @@ mockRepository.VerifyAll(); } - public MacroStabilityInwardsStochasticSoilProfileTest() : base( + public MacroStabilityInwardsStochasticSoilProfileRegistryTest() : base( (r, e, m) => r.Register(e, m), (r, m) => r.Contains(m), (r, m) => r.Get(m)) {} @@ -180,10 +180,10 @@ } [TestFixture] - private class MacroStabilityInwardsSoilProfile1DTest : RegistryTest { - public MacroStabilityInwardsSoilProfile1DTest() : base( + public MacroStabilityInwardsSoilProfile1DRegistryTest() : base( (r, e, m) => r.Register(e, m), (r, m) => r.Contains(m), (r, m) => r.Get(m)) {} @@ -195,10 +195,10 @@ } [TestFixture] - private class MacroStabilityInwardsSoilProfile2DTest : RegistryTest { - public MacroStabilityInwardsSoilProfile2DTest() : base( + public MacroStabilityInwardsSoilProfile2DRegistryTest() : base( (r, e, m) => r.Register(e, m), (r, m) => r.Contains(m), (r, m) => r.Get(m)) {} @@ -217,10 +217,10 @@ } [TestFixture] - private class MacroStabilityInwardsSurfaceLineTest : RegistryTest { - public MacroStabilityInwardsSurfaceLineTest() : base( + public MacroStabilityInwardsSurfaceLineRegistryTest() : base( (r, e, m) => r.Register(e, m), (r, m) => r.Contains(m), (r, m) => r.Get(m)) {} @@ -231,14 +231,55 @@ } } - [TestFixture] + /// + /// Test class to test the for the combination of + /// and . + /// + /// The data model. + /// The database entity. private abstract class RegistryTest where TDataModel : class where TEntity : class, new() { private readonly Action registerToRegistry; private readonly Func containsInRegistry; private readonly Func getFromRegistry; + /// + /// Creates a new instance of . + /// + /// The action to perform to register the data model + /// to the registry. + /// The action to perform to check whether the data + /// model is registered in the registry. + /// The action to perform to get the data model from + /// the registry. + /// Thrown when any input parameter is null. + /// public DerivedRegistryTest() : base( + /// (r, e, m) => r.Register(e, m), + /// (r, m) => r.Contains(m), + /// (r, m) => r.Get(m)) {} + protected RegistryTest(Action registerToRegistry, + Func containsInRegistry, + Func getFromRegistry) + { + if (registerToRegistry == null) + { + throw new ArgumentNullException(nameof(registerToRegistry)); + } + if (containsInRegistry == null) + { + throw new ArgumentNullException(nameof(containsInRegistry)); + } + if (getFromRegistry == null) + { + throw new ArgumentNullException(nameof(getFromRegistry)); + } + + this.registerToRegistry = registerToRegistry; + this.containsInRegistry = containsInRegistry; + this.getFromRegistry = getFromRegistry; + } + [Test] public void Register_WithNullEntity_ThrowsArgumentNullException() { @@ -370,45 +411,9 @@ } /// - /// Creates a new instance of . - /// - /// The action to perform to register the data model - /// to the registry. - /// The action to perform to check whether the data - /// model is registered in the registry. - /// The action to perform to get the data model from - /// the registry. - /// Thrown when any input parameter is null. - /// public DerivedRegistryTest() : base( - /// (r, e, m) => r.Register(e, m), - /// (r, m) => r.Contains(m), - /// (r, m) => r.Get(m)) {} - protected RegistryTest(Action registerToRegistry, - Func containsInRegistry, - Func getFromRegistry) - { - if (registerToRegistry == null) - { - throw new ArgumentNullException(nameof(registerToRegistry)); - } - if (containsInRegistry == null) - { - throw new ArgumentNullException(nameof(containsInRegistry)); - } - if (getFromRegistry == null) - { - throw new ArgumentNullException(nameof(getFromRegistry)); - } - - this.registerToRegistry = registerToRegistry; - this.containsInRegistry = containsInRegistry; - this.getFromRegistry = getFromRegistry; - } - - /// /// Creates a new instance of . /// - /// + /// An instance of . protected abstract TDataModel CreateDataModel(); }