Beispiel #1
0
        private static void SetPropertyAndVerifyNotificationsForCalculation(Action <MacroStabilityInwardsWaterStressesProperties> setProperty,
                                                                            MacroStabilityInwardsCalculation calculation)
        {
            // Setup
            var mocks      = new MockRepository();
            var observable = mocks.StrictMock <IObservable>();

            observable.Expect(o => o.NotifyObservers());
            mocks.ReplayAll();

            MacroStabilityInwardsInput input = calculation.InputParameters;

            var propertyChangeHandler = new SetPropertyValueAfterConfirmationParameterTester(new[]
            {
                observable
            });

            var properties = new MacroStabilityInwardsWaterStressesProperties(input,
                                                                              new GeneralMacroStabilityInwardsInput(),
                                                                              AssessmentSectionTestHelper.GetTestAssessmentLevel(),
                                                                              propertyChangeHandler);

            // Call
            setProperty(properties);

            // Assert
            Assert.IsTrue(propertyChangeHandler.Called);
            mocks.VerifyAll();
        }
Beispiel #2
0
        public void Constructor_ExpectedValues()
        {
            // Setup
            var mocks = new MockRepository();
            var propertyChangeHandler = mocks.Stub <IObservablePropertyChangeHandler>();

            mocks.ReplayAll();

            var input = new MacroStabilityInwardsInput(new MacroStabilityInwardsInput.ConstructionProperties());

            // Call
            var properties = new MacroStabilityInwardsWaterStressesProperties(input,
                                                                              new GeneralMacroStabilityInwardsInput(),
                                                                              AssessmentSectionTestHelper.GetTestAssessmentLevel(),
                                                                              propertyChangeHandler);

            // Assert
            Assert.IsInstanceOf <ObjectProperties <MacroStabilityInwardsInput> >(properties);
            Assert.AreSame(input, properties.Data);

            TestHelper.AssertTypeConverter <MacroStabilityInwardsWaterStressesProperties, ExpandableObjectConverter>(
                nameof(MacroStabilityInwardsWaterStressesProperties.Drainage));
            TestHelper.AssertTypeConverter <MacroStabilityInwardsWaterStressesProperties, ExpandableObjectConverter>(
                nameof(MacroStabilityInwardsWaterStressesProperties.LocationDaily));
            TestHelper.AssertTypeConverter <MacroStabilityInwardsWaterStressesProperties, ExpandableObjectConverter>(
                nameof(MacroStabilityInwardsWaterStressesProperties.LocationExtreme));
            TestHelper.AssertTypeConverter <MacroStabilityInwardsWaterStressesProperties, ExpandableObjectConverter>(
                nameof(MacroStabilityInwardsWaterStressesProperties.WaterStressLines));

            mocks.VerifyAll();
        }
Beispiel #3
0
        public void DynamicReadOnlyValidationMethod_OtherDikeSoilScenario_ReturnsExpectedReadOnly(MacroStabilityInwardsDikeSoilScenario dikeSoilScenario)
        {
            // Setup
            var mocks = new MockRepository();
            var propertyChangeHandler = mocks.Stub <IObservablePropertyChangeHandler>();

            mocks.ReplayAll();

            var input = new MacroStabilityInwardsInput(new MacroStabilityInwardsInput.ConstructionProperties())
            {
                DikeSoilScenario = dikeSoilScenario
            };
            var properties = new MacroStabilityInwardsWaterStressesProperties(input,
                                                                              new GeneralMacroStabilityInwardsInput(),
                                                                              AssessmentSectionTestHelper.GetTestAssessmentLevel(),
                                                                              propertyChangeHandler);

            // Call & Assert
            Assert.IsFalse(properties.DynamicReadOnlyValidationMethod(nameof(MacroStabilityInwardsWaterStressesProperties.AdjustPhreaticLine3And4ForUplift)));
            Assert.IsFalse(properties.DynamicReadOnlyValidationMethod(nameof(MacroStabilityInwardsWaterStressesProperties.LeakageLengthInwardsPhreaticLine3)));
            Assert.IsFalse(properties.DynamicReadOnlyValidationMethod(nameof(MacroStabilityInwardsWaterStressesProperties.LeakageLengthOutwardsPhreaticLine3)));
            Assert.IsFalse(properties.DynamicReadOnlyValidationMethod(nameof(MacroStabilityInwardsWaterStressesProperties.LeakageLengthInwardsPhreaticLine4)));
            Assert.IsFalse(properties.DynamicReadOnlyValidationMethod(nameof(MacroStabilityInwardsWaterStressesProperties.LeakageLengthOutwardsPhreaticLine4)));
            Assert.IsFalse(properties.DynamicReadOnlyValidationMethod(nameof(MacroStabilityInwardsWaterStressesProperties.PiezometricHeadPhreaticLine2Inwards)));
            Assert.IsFalse(properties.DynamicReadOnlyValidationMethod(nameof(MacroStabilityInwardsWaterStressesProperties.PiezometricHeadPhreaticLine2Outwards)));
            Assert.IsFalse(properties.DynamicReadOnlyValidationMethod(nameof(MacroStabilityInwardsWaterStressesProperties.WaterLevelRiverAverage)));
            Assert.IsFalse(properties.DynamicReadOnlyValidationMethod(nameof(MacroStabilityInwardsWaterStressesProperties.MinimumLevelPhreaticLineAtDikeTopPolder)));
            Assert.IsFalse(properties.DynamicReadOnlyValidationMethod(nameof(MacroStabilityInwardsWaterStressesProperties.MinimumLevelPhreaticLineAtDikeTopRiver)));
        }
Beispiel #4
0
        public void GivenPropertiesWithData_WhenChangingProperties_ThenPropertiesSetOnInput()
        {
            // Given
            var calculation = new MacroStabilityInwardsCalculationScenario();
            MacroStabilityInwardsInput input = calculation.InputParameters;

            var propertyChangeHandler = new ObservablePropertyChangeHandler(calculation, input);
            var properties            = new MacroStabilityInwardsWaterStressesProperties(input,
                                                                                         new GeneralMacroStabilityInwardsInput(),
                                                                                         AssessmentSectionTestHelper.GetTestAssessmentLevel(),
                                                                                         propertyChangeHandler);

            var    random = new Random(21);
            double waterLevelRiverAverage = random.NextDouble();
            double minimumLevelPhreaticLineAtDikeTopRiver  = random.NextDouble();
            double minimumLevelPhreaticLineAtDikeTopPolder = random.NextDouble();
            bool   adjustPhreaticLine3And4ForUplift        = random.NextBoolean();
            double leakageLengthOutwardsPhreaticLine3      = random.NextDouble();
            double leakageLengthInwardsPhreaticLine3       = random.NextDouble();
            double leakageLengthOutwardsPhreaticLine4      = random.NextDouble();
            double leakageLengthInwardsPhreaticLine4       = random.NextDouble();
            double piezometricHeadPhreaticLine2Outwards    = random.NextDouble();
            double piezometricHeadPhreaticLine2Inwards     = random.NextDouble();

            // When
            properties.WaterLevelRiverAverage = (RoundedDouble)waterLevelRiverAverage;
            properties.MinimumLevelPhreaticLineAtDikeTopRiver  = (RoundedDouble)minimumLevelPhreaticLineAtDikeTopRiver;
            properties.MinimumLevelPhreaticLineAtDikeTopPolder = (RoundedDouble)minimumLevelPhreaticLineAtDikeTopPolder;
            properties.AdjustPhreaticLine3And4ForUplift        = adjustPhreaticLine3And4ForUplift;
            properties.LeakageLengthOutwardsPhreaticLine3      = (RoundedDouble)leakageLengthOutwardsPhreaticLine3;
            properties.LeakageLengthInwardsPhreaticLine3       = (RoundedDouble)leakageLengthInwardsPhreaticLine3;
            properties.LeakageLengthOutwardsPhreaticLine4      = (RoundedDouble)leakageLengthOutwardsPhreaticLine4;
            properties.LeakageLengthInwardsPhreaticLine4       = (RoundedDouble)leakageLengthInwardsPhreaticLine4;
            properties.PiezometricHeadPhreaticLine2Outwards    = (RoundedDouble)piezometricHeadPhreaticLine2Outwards;
            properties.PiezometricHeadPhreaticLine2Inwards     = (RoundedDouble)piezometricHeadPhreaticLine2Inwards;

            // Then
            Assert.AreEqual(waterLevelRiverAverage, input.WaterLevelRiverAverage,
                            input.WaterLevelRiverAverage.GetAccuracy());
            Assert.AreEqual(minimumLevelPhreaticLineAtDikeTopRiver, input.MinimumLevelPhreaticLineAtDikeTopRiver,
                            input.MinimumLevelPhreaticLineAtDikeTopRiver.GetAccuracy());
            Assert.AreEqual(minimumLevelPhreaticLineAtDikeTopPolder, input.MinimumLevelPhreaticLineAtDikeTopPolder,
                            input.MinimumLevelPhreaticLineAtDikeTopPolder.GetAccuracy());
            Assert.AreEqual(adjustPhreaticLine3And4ForUplift, input.AdjustPhreaticLine3And4ForUplift);
            Assert.AreEqual(leakageLengthOutwardsPhreaticLine3, input.LeakageLengthOutwardsPhreaticLine3,
                            input.LeakageLengthOutwardsPhreaticLine3.GetAccuracy());
            Assert.AreEqual(leakageLengthInwardsPhreaticLine3, input.LeakageLengthInwardsPhreaticLine3,
                            input.LeakageLengthInwardsPhreaticLine3.GetAccuracy());
            Assert.AreEqual(leakageLengthOutwardsPhreaticLine4, input.LeakageLengthOutwardsPhreaticLine4,
                            input.LeakageLengthOutwardsPhreaticLine4.GetAccuracy());
            Assert.AreEqual(leakageLengthInwardsPhreaticLine4, input.LeakageLengthInwardsPhreaticLine4,
                            input.LeakageLengthInwardsPhreaticLine4.GetAccuracy());
            Assert.AreEqual(piezometricHeadPhreaticLine2Outwards, input.PiezometricHeadPhreaticLine2Outwards,
                            input.PiezometricHeadPhreaticLine2Outwards.GetAccuracy());
            Assert.AreEqual(piezometricHeadPhreaticLine2Inwards, input.PiezometricHeadPhreaticLine2Inwards,
                            input.PiezometricHeadPhreaticLine2Inwards.GetAccuracy());
        }
Beispiel #5
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();
        }
Beispiel #6
0
        public void ToString_Always_ReturnEmptyString()
        {
            // Setup
            var mocks = new MockRepository();
            var propertyChangeHandler = mocks.Stub <IObservablePropertyChangeHandler>();

            mocks.ReplayAll();

            var input      = new MacroStabilityInwardsInput(new MacroStabilityInwardsInput.ConstructionProperties());
            var properties = new MacroStabilityInwardsWaterStressesProperties(input,
                                                                              new GeneralMacroStabilityInwardsInput(),
                                                                              AssessmentSectionTestHelper.GetTestAssessmentLevel(),
                                                                              propertyChangeHandler);

            // Call
            string toString = properties.ToString();

            // Assert
            Assert.AreEqual(string.Empty, toString);
        }
Beispiel #7
0
        public void Constructor_ValidData_PropertiesHaveExpectedAttributesValues()
        {
            // Setup
            var mocks = new MockRepository();
            var propertyChangeHandler = mocks.Stub <IObservablePropertyChangeHandler>();

            mocks.ReplayAll();

            var input = new MacroStabilityInwardsInput(new MacroStabilityInwardsInput.ConstructionProperties());

            // Call
            var properties = new MacroStabilityInwardsWaterStressesProperties(input,
                                                                              new GeneralMacroStabilityInwardsInput(),
                                                                              AssessmentSectionTestHelper.GetTestAssessmentLevel(),
                                                                              propertyChangeHandler);

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

            Assert.AreEqual(14, dynamicProperties.Count);

            const string waterStressesCategory = "Waterspanningen";

            PropertyDescriptor waterLevelRiverAverageProperty = dynamicProperties[expectedWaterLevelRiverAveragePropertyIndex];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(
                waterLevelRiverAverageProperty,
                waterStressesCategory,
                "Gemiddeld hoog water (GHW) [m+NAP]",
                "Gemiddeld hoog water.");

            PropertyDescriptor drainageProperty = dynamicProperties[expectedDrainagePropertyIndex];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(
                drainageProperty,
                waterStressesCategory,
                "Drainage",
                "Eigenschappen van drainage constructie.",
                true);

            PropertyDescriptor minimumLevelPhreaticLineAtDikeTopRiverProperty = dynamicProperties[expectedMinimumLevelPhreaticLineAtDikeTopRiverPropertyIndex];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(
                minimumLevelPhreaticLineAtDikeTopRiverProperty,
                waterStressesCategory,
                "PL 1 initiële hoogte onder buitenkruin [m+NAP]",
                "Minimale hoogte van de freatische lijn onder kruin buitentalud.");

            PropertyDescriptor minimumLevelPhreaticLineAtDikeTopPolderProperty = dynamicProperties[expectedMinimumLevelPhreaticLineAtDikeTopPolderPropertyIndex];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(
                minimumLevelPhreaticLineAtDikeTopPolderProperty,
                waterStressesCategory,
                "PL 1 initiële hoogte onder binnenkruin [m+NAP]",
                "Minimale hoogte van de freatische lijn onder kruin binnentalud.");

            PropertyDescriptor adjustPhreaticLine3And4ForUpliftProperty = dynamicProperties[expectedAdjustPhreaticLine3And4ForUpliftPropertyIndex];

            Assert.NotNull(adjustPhreaticLine3And4ForUpliftProperty.Attributes[typeof(DynamicReadOnlyAttribute)]);
            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(
                adjustPhreaticLine3And4ForUpliftProperty,
                waterStressesCategory,
                "Corrigeer PL 3 en PL 4 voor opbarsten",
                "Corrigeer de stijghoogte in watervoerende zandlaag en tussenzandlaag voor opbarsten?");

            PropertyDescriptor leakageLengthOutwardsPhreaticLine3Property = dynamicProperties[expectedLeakageLengthOutwardsPhreaticLine3PropertyIndex];

            Assert.NotNull(leakageLengthOutwardsPhreaticLine3Property.Attributes[typeof(DynamicReadOnlyAttribute)]);
            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(
                leakageLengthOutwardsPhreaticLine3Property,
                waterStressesCategory,
                "Leklengte buitenwaarts PL 3 [m]",
                "Lengtemaat die uitdrukking geeft aan de afstand waarover de stijghoogte verloopt in de diepe watervoerende zandlaag ter hoogte van het voorland.");

            PropertyDescriptor leakageLengthInwardsPhreaticLine3Property = dynamicProperties[expectedLeakageLengthInwardsPhreaticLine3PropertyIndex];

            Assert.NotNull(leakageLengthInwardsPhreaticLine3Property.Attributes[typeof(DynamicReadOnlyAttribute)]);
            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(
                leakageLengthInwardsPhreaticLine3Property,
                waterStressesCategory,
                "Leklengte binnenwaarts PL 3 [m]",
                "Lengtemaat die uitdrukking geeft aan de afstand waarover de stijghoogte verloopt in de diepe watervoerende zandlaag ter hoogte van het achterland.");

            PropertyDescriptor leakageLengthOutwardsPhreaticLine4Property = dynamicProperties[expectedLeakageLengthOutwardsPhreaticLine4PropertyIndex];

            Assert.NotNull(leakageLengthOutwardsPhreaticLine4Property.Attributes[typeof(DynamicReadOnlyAttribute)]);
            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(
                leakageLengthOutwardsPhreaticLine4Property,
                waterStressesCategory,
                "Leklengte buitenwaarts PL 4 [m]",
                "Lengtemaat die uitdrukking geeft aan de afstand waarover de stijghoogte verloopt in de tussenzandlaag ter hoogte van het voorland.");

            PropertyDescriptor leakageLengthInwardsPhreaticLine4Property = dynamicProperties[expectedLeakageLengthInwardsPhreaticLine4PropertyIndex];

            Assert.NotNull(leakageLengthInwardsPhreaticLine4Property.Attributes[typeof(DynamicReadOnlyAttribute)]);
            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(
                leakageLengthInwardsPhreaticLine4Property,
                waterStressesCategory,
                "Leklengte binnenwaarts PL 4 [m]",
                "Lengtemaat die uitdrukking geeft aan de afstand waarover de stijghoogte verloopt in de tussenzandlaag ter hoogte van het achterland.");

            PropertyDescriptor piezometricHeadPhreaticLine2OutwardsProperty = dynamicProperties[expectedPiezometricHeadPhreaticLine2OutwardsPropertyIndex];

            Assert.NotNull(piezometricHeadPhreaticLine2OutwardsProperty.Attributes[typeof(DynamicReadOnlyAttribute)]);
            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(
                piezometricHeadPhreaticLine2OutwardsProperty,
                waterStressesCategory,
                "Stijghoogte PL 2 buitenwaarts [m+NAP]",
                "Stijghoogte in de indringingslaag buitenwaarts.");

            PropertyDescriptor piezometricHeadPhreaticLine2InwardsProperty = dynamicProperties[expectedPiezometricHeadPhreaticLine2InwardsPropertyIndex];

            Assert.NotNull(piezometricHeadPhreaticLine2InwardsProperty.Attributes[typeof(DynamicReadOnlyAttribute)]);
            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(
                piezometricHeadPhreaticLine2InwardsProperty,
                waterStressesCategory,
                "Stijghoogte PL 2 binnenwaarts [m+NAP]",
                "Stijghoogte in de indringingslaag binnenwaarts.");

            PropertyDescriptor locationExtremeProperty = dynamicProperties[locationExtremePropertyIndex];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(
                locationExtremeProperty,
                waterStressesCategory,
                "Extreme omstandigheden",
                "Eigenschappen van de waterspanningen bij extreme omstandigheden.",
                true);

            PropertyDescriptor locationDailyProperty = dynamicProperties[locationDailyPropertyIndex];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(
                locationDailyProperty,
                waterStressesCategory,
                "Dagelijkse omstandigheden",
                "Eigenschappen van de waterspanningen bij dagelijkse omstandigheden.",
                true);

            PropertyDescriptor waterStressLinesProperty = dynamicProperties[waterStressLinesPropertyIndex];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(
                waterStressLinesProperty,
                waterStressesCategory,
                "Waterspanningslijnen",
                "Eigenschappen van de waterspanningslijnen.",
                true);

            mocks.VerifyAll();
        }