Exemplo n.º 1
0
        public void Instance_Always_ReturnsAnInstance()
        {
            // Call
            IPipingSubCalculatorFactory factory = PipingSubCalculatorFactory.Instance;

            // Assert
            Assert.IsInstanceOf <PipingSubCalculatorFactory>(factory);
        }
Exemplo n.º 2
0
        public void CreateSellmeijerCalculator_Always_ReturnsSellmeijerCalculator()
        {
            // Setup
            IPipingSubCalculatorFactory factory = PipingSubCalculatorFactory.Instance;

            // Call
            ISellmeijerCalculator calculator = factory.CreateSellmeijerCalculator();

            // Assert
            Assert.IsInstanceOf <SellmeijerCalculator>(calculator);
        }
Exemplo n.º 3
0
        public void CreateUpliftCalculator_Always_ReturnsUpliftCalculator()
        {
            // Setup
            IPipingSubCalculatorFactory factory = PipingSubCalculatorFactory.Instance;

            // Call
            IUpliftCalculator calculator = factory.CreateUpliftCalculator();

            // Assert
            Assert.IsInstanceOf <UpliftCalculator>(calculator);
        }
Exemplo n.º 4
0
        public void CreatePiezometricHeadAtExitCalculator_Always_ReturnsPiezometricHeadAtExitCalculator()
        {
            // Setup
            IPipingSubCalculatorFactory factory = PipingSubCalculatorFactory.Instance;

            // Call
            IPiezoHeadCalculator calculator = factory.CreatePiezometricHeadAtExitCalculator();

            // Assert
            Assert.IsInstanceOf <PiezoHeadCalculator>(calculator);
        }
Exemplo n.º 5
0
        public void CreateEffectiveThicknessCalculator_Always_ReturnsEffectiveThicknessCalculator()
        {
            // Setup
            IPipingSubCalculatorFactory factory = PipingSubCalculatorFactory.Instance;

            // Call
            IEffectiveThicknessCalculator calculator = factory.CreateEffectiveThicknessCalculator();

            // Assert
            Assert.IsInstanceOf <EffectiveThicknessCalculator>(calculator);
        }
Exemplo n.º 6
0
        public void Instance_WhenSetToInstance_ReturnsThatInstance()
        {
            // Setup
            var firstFactory = new TestPipingSubCalculatorFactory();

            PipingSubCalculatorFactory.Instance = firstFactory;

            // Call
            IPipingSubCalculatorFactory secondFactory = PipingSubCalculatorFactory.Instance;

            // Assert
            Assert.AreSame(firstFactory, secondFactory);
        }
Exemplo n.º 7
0
        public void Instance_WhenSetToNull_ReturnsNewInstance()
        {
            // Setup
            IPipingSubCalculatorFactory firstFactory = PipingSubCalculatorFactory.Instance;

            PipingSubCalculatorFactory.Instance = null;

            // Call
            IPipingSubCalculatorFactory secondFactory = PipingSubCalculatorFactory.Instance;

            // Assert
            Assert.AreNotSame(firstFactory, secondFactory);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Constructs a new <see cref="PipingCalculator"/>. The <paramref name="input"/> is used to
        /// obtain the parameters used in the different sub calculations.
        /// </summary>
        /// <param name="input">The <see cref="PipingCalculatorInput"/> containing all the values required
        /// for performing a piping calculation.</param>
        /// <param name="factory">The factory responsible for creating the sub calculators.</param>
        /// <exception cref="ArgumentNullException"><paramref name="input"/> or <paramref name="factory"/> is <c>null</c>.</exception>
        public PipingCalculator(PipingCalculatorInput input, IPipingSubCalculatorFactory factory)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input), @"PipingCalculatorInput required for creating a PipingCalculator.");
            }

            if (factory == null)
            {
                throw new ArgumentNullException(nameof(factory), @"IPipingSubCalculatorFactory required for creating a PipingCalculator.");
            }

            this.input   = input;
            this.factory = factory;
        }
 /// <summary>
 /// Creates a new instance of <see cref="PipingSubCalculatorFactoryConfig"/>.
 /// Sets a <see cref="TestPipingSubCalculatorFactory"/> to
 /// <see cref="PipingSubCalculatorFactory.Instance"/>
 /// </summary>
 public PipingSubCalculatorFactoryConfig()
 {
     previousFactory = PipingSubCalculatorFactory.Instance;
     PipingSubCalculatorFactory.Instance = new TestPipingSubCalculatorFactory();
 }