public void Constructor_ValidData_PropertiesHaveExpectedAttributeValues()
        {
            // Setup
            var waternet = new MacroStabilityInwardsWaternet(Enumerable.Empty <MacroStabilityInwardsPhreaticLine>(),
                                                             Enumerable.Empty <MacroStabilityInwardsWaternetLine>());

            // Call
            var properties = new MacroStabilityInwardsWaternetProperties(waternet);

            // Assert
            PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);

            Assert.AreEqual(2, dynamicProperties.Count);

            const string waterStressesCategoryName = "Waterspanningen";

            PropertyDescriptor phreaticLinesProperty = dynamicProperties[0];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(phreaticLinesProperty,
                                                                            waterStressesCategoryName,
                                                                            "Stijghoogtelijnen",
                                                                            "Eigenschappen van de stijghoogtelijnen.",
                                                                            true);

            PropertyDescriptor waternetLinesProperty = dynamicProperties[1];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(waternetLinesProperty,
                                                                            waterStressesCategoryName,
                                                                            "Zones",
                                                                            "Eigenschappen van de zones.",
                                                                            true);
        }
        public void ToString_Always_ReturnEmpty()
        {
            // Setup
            var waternet = new MacroStabilityInwardsWaternet(Enumerable.Empty <MacroStabilityInwardsPhreaticLine>(),
                                                             Enumerable.Empty <MacroStabilityInwardsWaternetLine>());
            var properties = new MacroStabilityInwardsWaternetProperties(waternet);

            // Call
            var name = properties.ToString();

            // Assert
            Assert.IsEmpty(name);
        }
예제 #3
0
        public void GetProperties_WithData_ReturnExpectedValues()
        {
            // Setup
            var mocks = new MockRepository();
            var propertyChangeHandler = mocks.Stub <IObservablePropertyChangeHandler>();

            mocks.ReplayAll();

            RoundedDouble assessmentLevel = new Random(21).NextRoundedDouble();
            MacroStabilityInwardsCalculationScenario calculation = MacroStabilityInwardsCalculationScenarioTestFactory.CreateMacroStabilityInwardsCalculationScenarioWithValidInput(new TestHydraulicBoundaryLocation());
            MacroStabilityInwardsInput input = calculation.InputParameters;

            // Call
            var properties = new MacroStabilityInwardsWaterStressesProperties(input, new GeneralMacroStabilityInwardsInput(), assessmentLevel, propertyChangeHandler);

            // Assert
            Assert.AreEqual(input.WaterLevelRiverAverage, properties.WaterLevelRiverAverage);
            Assert.AreSame(input.LocationInputExtreme, properties.LocationExtreme.Data);
            Assert.AreSame(input.LocationInputDaily, properties.LocationDaily.Data);

            Assert.AreSame(input, properties.WaterStressLines.Data);

            using (new MacroStabilityInwardsCalculatorFactoryConfig())
            {
                MacroStabilityInwardsWaternetProperties waternetProperties = properties.WaterStressLines.WaternetExtreme;

                var calculatorFactory = (TestMacroStabilityInwardsCalculatorFactory)MacroStabilityInwardsCalculatorFactory.Instance;

                WaternetCalculatorStub calculator = calculatorFactory.LastCreatedWaternetExtremeCalculator;
                Assert.AreEqual(assessmentLevel, calculator.Input.AssessmentLevel);
                CalculatorOutputAssert.AssertWaternet(calculator.Output, (MacroStabilityInwardsWaternet)waternetProperties.Data);
            }

            Assert.AreSame(input, properties.Drainage.Data);
            Assert.AreEqual(input.MinimumLevelPhreaticLineAtDikeTopRiver, properties.MinimumLevelPhreaticLineAtDikeTopRiver);
            Assert.AreEqual(input.MinimumLevelPhreaticLineAtDikeTopPolder, properties.MinimumLevelPhreaticLineAtDikeTopPolder);
            Assert.AreEqual(input.AdjustPhreaticLine3And4ForUplift, properties.AdjustPhreaticLine3And4ForUplift);
            Assert.AreEqual(input.LeakageLengthOutwardsPhreaticLine3, properties.LeakageLengthOutwardsPhreaticLine3);
            Assert.AreEqual(input.LeakageLengthInwardsPhreaticLine3, properties.LeakageLengthInwardsPhreaticLine3);
            Assert.AreEqual(input.LeakageLengthOutwardsPhreaticLine4, properties.LeakageLengthOutwardsPhreaticLine4);
            Assert.AreEqual(input.LeakageLengthInwardsPhreaticLine4, properties.LeakageLengthInwardsPhreaticLine4);
            Assert.AreEqual(input.PiezometricHeadPhreaticLine2Outwards, properties.PiezometricHeadPhreaticLine2Outwards);
            Assert.AreEqual(input.PiezometricHeadPhreaticLine2Inwards, properties.PiezometricHeadPhreaticLine2Inwards);
            mocks.VerifyAll();
        }
        public void GetProperties_WithData_ReturnExpectedValues()
        {
            // Setup
            var waternet = new MacroStabilityInwardsWaternet(new[]
            {
                MacroStabilityInwardsTestDataFactory.CreateMacroStabilityInwardsPhreaticLine()
            }, new[]
            {
                MacroStabilityInwardsTestDataFactory.CreateMacroStabilityInwardsWaternetLine()
            });

            // Call
            var properties = new MacroStabilityInwardsWaternetProperties(waternet);

            // Assert
            Assert.AreSame(waternet.PhreaticLines.Single(), properties.PhreaticLines.Single().Data);
            Assert.AreSame(waternet.WaternetLines.Single(), properties.WaternetLines.Single().Data);
        }
        public void Constructor_ValidWaternet_ExpectedValues()
        {
            // Setup
            var waternet = new MacroStabilityInwardsWaternet(new[]
            {
                MacroStabilityInwardsTestDataFactory.CreateMacroStabilityInwardsPhreaticLine()
            }, new[]
            {
                MacroStabilityInwardsTestDataFactory.CreateMacroStabilityInwardsWaternetLine()
            });

            // Call
            var properties = new MacroStabilityInwardsWaternetProperties(waternet);

            // Assert
            Assert.IsInstanceOf <ObjectProperties <MacroStabilityInwardsWaternet> >(properties);
            TestHelper.AssertTypeConverter <MacroStabilityInwardsWaternetProperties, ExpandableReadOnlyArrayConverter>(
                nameof(MacroStabilityInwardsWaternetProperties.PhreaticLines));
            Assert.AreSame(waternet, properties.Data);
        }
        public void WaternetDaily_ValidWaternet_ExpectedValue()
        {
            // Setup
            MacroStabilityInwardsCalculationScenario calculation = MacroStabilityInwardsCalculationScenarioTestFactory.CreateMacroStabilityInwardsCalculationScenarioWithValidInput(new TestHydraulicBoundaryLocation());

            var properties = new MacroStabilityInwardsWaterStressLinesProperties(calculation.InputParameters,
                                                                                 new GeneralMacroStabilityInwardsInput(),
                                                                                 AssessmentSectionTestHelper.GetTestAssessmentLevel());

            using (new MacroStabilityInwardsCalculatorFactoryConfig())
            {
                // Call
                MacroStabilityInwardsWaternetProperties waternetProperties = properties.WaternetDaily;

                // Assert
                var calculatorFactory = (TestMacroStabilityInwardsCalculatorFactory)MacroStabilityInwardsCalculatorFactory.Instance;

                CalculatorOutputAssert.AssertWaternet(calculatorFactory.LastCreatedWaternetDailyCalculator.Output, (MacroStabilityInwardsWaternet)waternetProperties.Data);
            }
        }
        public void WaternetExtreme_ValidWaternet_ExpectedValue()
        {
            // Setup
            RoundedDouble assessmentLevel = new Random(21).NextRoundedDouble();
            MacroStabilityInwardsCalculationScenario calculation = MacroStabilityInwardsCalculationScenarioTestFactory.CreateMacroStabilityInwardsCalculationScenarioWithValidInput(new TestHydraulicBoundaryLocation());

            var properties = new MacroStabilityInwardsWaterStressLinesProperties(calculation.InputParameters, new GeneralMacroStabilityInwardsInput(), assessmentLevel);

            using (new MacroStabilityInwardsCalculatorFactoryConfig())
            {
                // Call
                MacroStabilityInwardsWaternetProperties waternetProperties = properties.WaternetExtreme;

                // Assert
                var calculatorFactory = (TestMacroStabilityInwardsCalculatorFactory)MacroStabilityInwardsCalculatorFactory.Instance;

                WaternetCalculatorStub calculator = calculatorFactory.LastCreatedWaternetExtremeCalculator;
                Assert.AreEqual(assessmentLevel, calculator.Input.AssessmentLevel);
                CalculatorOutputAssert.AssertWaternet(calculator.Output, (MacroStabilityInwardsWaternet)waternetProperties.Data);
            }
        }