public void Instance_Always_ReturnsAnInstance()
        {
            // Call
            IMacroStabilityInwardsKernelFactory factory = MacroStabilityInwardsKernelWrapperFactory.Instance;

            // Assert
            Assert.IsInstanceOf <MacroStabilityInwardsKernelWrapperFactory>(factory);
        }
        public void CreateWaternetExtremeKernel_Always_ReturnsWaternetKernelWrapper()
        {
            // Setup
            IMacroStabilityInwardsKernelFactory factory = MacroStabilityInwardsKernelWrapperFactory.Instance;

            // Call
            IWaternetKernel waternetKernel = factory.CreateWaternetExtremeKernel(new MacroStabilityInput());

            // Assert
            Assert.IsInstanceOf <WaternetKernelWrapper>(waternetKernel);
        }
        public void CreateUpliftVanKernel_Always_ReturnsUpliftVanKernelWrapper()
        {
            // Setup
            IMacroStabilityInwardsKernelFactory factory = MacroStabilityInwardsKernelWrapperFactory.Instance;

            // Call
            IUpliftVanKernel upliftVanKernel = factory.CreateUpliftVanKernel(new MacroStabilityInput());

            // Assert
            Assert.IsInstanceOf <UpliftVanKernelWrapper>(upliftVanKernel);
        }
        public void Instance_WhenSetToInstance_ReturnsThatInstance()
        {
            // Setup
            var firstFactory = new TestMacroStabilityInwardsKernelFactory();

            MacroStabilityInwardsKernelWrapperFactory.Instance = firstFactory;

            // Call
            IMacroStabilityInwardsKernelFactory secondFactory = MacroStabilityInwardsKernelWrapperFactory.Instance;

            // Assert
            Assert.AreSame(firstFactory, secondFactory);
        }
        public void Instance_WhenSetToNull_ReturnsNewInstance()
        {
            // Setup
            IMacroStabilityInwardsKernelFactory firstFactory = MacroStabilityInwardsKernelWrapperFactory.Instance;

            MacroStabilityInwardsKernelWrapperFactory.Instance = null;

            // Call
            IMacroStabilityInwardsKernelFactory secondFactory = MacroStabilityInwardsKernelWrapperFactory.Instance;

            // Assert
            Assert.AreNotSame(firstFactory, secondFactory);
        }
コード例 #6
0
        /// <summary>
        /// Creates a new instance of <see cref="WaternetCalculator"/>.
        /// </summary>
        /// <param name="input">The <see cref="WaternetCalculatorInput"/> containing all the values
        /// required for performing the Waternet calculation.</param>
        /// <param name="factory">The factory responsible for creating the Waternet kernel.</param>
        /// <exception cref="ArgumentNullException">Thrown when any parameter
        /// is <c>null</c>.</exception>
        protected WaternetCalculator(WaternetCalculatorInput input, IMacroStabilityInwardsKernelFactory factory)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            if (factory == null)
            {
                throw new ArgumentNullException(nameof(factory));
            }

            Input   = input;
            Factory = factory;
        }
コード例 #7
0
        /// <summary>
        /// Creates a new instance of <see cref="UpliftVanCalculator"/>.
        /// </summary>
        /// <param name="input">The <see cref="UpliftVanCalculatorInput"/> containing all the values required
        /// for performing the Uplift Van calculation.</param>
        /// <param name="factory">The factory responsible for creating the Uplift Van kernel.</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="input"/> or <paramref name="factory"/> is <c>null</c>.</exception>
        public UpliftVanCalculator(UpliftVanCalculatorInput input, IMacroStabilityInwardsKernelFactory factory)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            if (factory == null)
            {
                throw new ArgumentNullException(nameof(factory));
            }

            this.input   = input;
            this.factory = factory;
        }
コード例 #8
0
 public TestWaternetCalculator(WaternetCalculatorInput input, IMacroStabilityInwardsKernelFactory factory)
     : base(input, factory)
 {
 }
コード例 #9
0
 public IWaternetCalculator CreateWaternetDailyCalculator(WaternetCalculatorInput input, IMacroStabilityInwardsKernelFactory factory)
 {
     return(CreateWaternetCalculator(input, LastCreatedWaternetDailyCalculator));
 }
コード例 #10
0
        public IUpliftVanCalculator CreateUpliftVanCalculator(UpliftVanCalculatorInput input, IMacroStabilityInwardsKernelFactory factory)
        {
            LastCreatedUpliftVanCalculator.Input = input;

            return(LastCreatedUpliftVanCalculator);
        }
コード例 #11
0
 /// <summary>
 /// Creates a new instance of <see cref="MacroStabilityInwardsKernelFactoryConfig"/>.
 /// Sets a <see cref="TestMacroStabilityInwardsKernelFactory"/> to
 /// <see cref="MacroStabilityInwardsKernelWrapperFactory.Instance"/>
 /// </summary>
 public MacroStabilityInwardsKernelFactoryConfig()
 {
     previousFactory = MacroStabilityInwardsKernelWrapperFactory.Instance;
     MacroStabilityInwardsKernelWrapperFactory.Instance = new TestMacroStabilityInwardsKernelFactory();
 }
コード例 #12
0
 public IWaternetCalculator CreateWaternetExtremeCalculator(WaternetCalculatorInput input, IMacroStabilityInwardsKernelFactory factory)
 {
     return(new WaternetExtremeCalculator(input, factory));
 }
コード例 #13
0
 public IUpliftVanCalculator CreateUpliftVanCalculator(UpliftVanCalculatorInput input, IMacroStabilityInwardsKernelFactory factory)
 {
     return(new UpliftVanCalculator(input, factory));
 }