Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/MacroStabilityInwardsCalculatorFactoryConfig.cs
===================================================================
diff -u -r966dc7335defa901104fd4168d57c08315db2de0 -r0c1eb485edd1764f19829f29bdad41e3343f35c1
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/MacroStabilityInwardsCalculatorFactoryConfig.cs (.../MacroStabilityInwardsCalculatorFactoryConfig.cs) (revision 966dc7335defa901104fd4168d57c08315db2de0)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil/MacroStabilityInwardsCalculatorFactoryConfig.cs (.../MacroStabilityInwardsCalculatorFactoryConfig.cs) (revision 0c1eb485edd1764f19829f29bdad41e3343f35c1)
@@ -24,47 +24,41 @@
namespace Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil
{
///
- /// This class can be used to set a temporary
- /// for while testing.
- /// Disposing an instance of this class will revert the
+ /// This class can be used to set a temporary
+ /// for while testing.
+ /// Disposing an instance of this class will revert the
/// .
///
///
/// The following is an example for how to use this class:
///
- /// var mockRepository = new MockRepository();
- /// var calculatorFactory = mockRepository.Stub<IMacroStabilityInwardsCalculatorFactory>();
- /// mockRepository.ReplayAll();
- ///
- /// using(new MacroStabilityInwardsCalculatorFactoryConfig(calculatorFactory))
+ /// using(new MacroStabilityInwardsCalculatorFactoryConfig())
/// {
- /// // Perform test with mocked factory
+ /// var testFactory = (TestMacroStabilityInwardsCalculatorFactory) MacroStabilityInwardsCalculatorFactory.Instance;
+ ///
+ /// // Perform tests with testFactory
/// }
///
- ///
- /// mockRepository.VerifyAll();
///
public class MacroStabilityInwardsCalculatorFactoryConfig : IDisposable
{
private readonly IMacroStabilityInwardsCalculatorFactory previousFactory;
///
/// Creates a new instance of .
- /// Sets the to .
+ /// Sets a to
+ ///
///
- /// The factory that will be used while testing.
- /// Thrown when
- /// is null.
- public MacroStabilityInwardsCalculatorFactoryConfig(IMacroStabilityInwardsCalculatorFactory newFactory)
+ public MacroStabilityInwardsCalculatorFactoryConfig()
{
- if (newFactory == null)
- {
- throw new ArgumentNullException(nameof(newFactory));
- }
previousFactory = MacroStabilityInwardsCalculatorFactory.Instance;
- MacroStabilityInwardsCalculatorFactory.Instance = newFactory;
+ MacroStabilityInwardsCalculatorFactory.Instance = new TestMacroStabilityInwardsCalculatorFactory();
}
+ ///
+ /// Reverts the to the value
+ /// it had at time of construction of the .
+ ///
public void Dispose()
{
MacroStabilityInwardsCalculatorFactory.Instance = previousFactory;