Esempio n. 1
0
        public void GivenViewWithOutputSet_WhenOutputCleared_ThenTableCleared()
        {
            // Given
            var calculation = new MacroStabilityInwardsCalculationScenario
            {
                Output = MacroStabilityInwardsOutputTestFactory.CreateOutput()
            };

            using (var view = new MacroStabilityInwardsOutputView(calculation,
                                                                  new GeneralMacroStabilityInwardsInput(),
                                                                  AssessmentSectionTestHelper.GetTestAssessmentLevel))
            {
                MacroStabilityInwardsSlicesTable slicesTable = GetSlicesTable(view);

                // Precondition
                Assert.AreEqual(3, slicesTable.Rows.Count);

                // When
                calculation.ClearOutput();
                calculation.NotifyObservers();

                // Then
                Assert.AreEqual(0, slicesTable.Rows.Count);
            }
        }
Esempio n. 2
0
        public void GivenCalculationWithOutput_WhenOutputCleared_ThenChartDataUpdated()
        {
            // Given
            MacroStabilityInwardsSurfaceLine           surfaceLine           = GetSurfaceLineWithGeometry();
            MacroStabilityInwardsStochasticSoilProfile stochasticSoilProfile = MacroStabilityInwardsStochasticSoilProfileTestFactory.CreateMacroStabilityInwardsStochasticSoilProfile2D();

            var calculation = new MacroStabilityInwardsCalculationScenario
            {
                InputParameters =
                {
                    SurfaceLine           = surfaceLine,
                    StochasticSoilProfile = stochasticSoilProfile
                },
                Output = MacroStabilityInwardsOutputTestFactory.CreateOutput()
            };

            using (var form = new Form())
                using (new MacroStabilityInwardsCalculatorFactoryConfig())
                    using (var view = new MacroStabilityInwardsOutputView(calculation,
                                                                          new GeneralMacroStabilityInwardsInput(),
                                                                          AssessmentSectionTestHelper.GetTestAssessmentLevel))
                    {
                        form.Controls.Add(view);
                        form.Show();

                        MacroStabilityInwardsOutputChartControl chartControl = GetChartControl(form);

                        // Precondition
                        ChartDataCollection chartData = GetChartControl(chartControl).Data;
                        MacroStabilityInwardsOutputViewChartDataAssert.AssertInputChartData(calculation, chartData);

                        // When
                        calculation.ClearOutput();
                        calculation.NotifyObservers();

                        // Then
                        MacroStabilityInwardsOutputViewChartDataAssert.AssertEmptyChartDataWithEmptySoilLayerAndWithWaternetChartData(chartData);
                    }
        }
        public void UpdateChartData_CalculationWithoutOutputWithoutWaternet_ChartDataUpdated()
        {
            // Setup
            MacroStabilityInwardsSurfaceLine           surfaceLine           = GetSurfaceLineWithGeometry();
            MacroStabilityInwardsStochasticSoilProfile stochasticSoilProfile = MacroStabilityInwardsStochasticSoilProfileTestFactory.CreateMacroStabilityInwardsStochasticSoilProfile2D();

            var calculation = new MacroStabilityInwardsCalculationScenario
            {
                InputParameters =
                {
                    SurfaceLine           = surfaceLine,
                    StochasticSoilProfile = stochasticSoilProfile
                },
                Output = MacroStabilityInwardsOutputTestFactory.CreateOutput()
            };

            using (new MacroStabilityInwardsCalculatorFactoryConfig())
                using (var control = new MacroStabilityInwardsOutputChartControl(calculation,
                                                                                 new GeneralMacroStabilityInwardsInput(),
                                                                                 AssessmentSectionTestHelper.GetTestAssessmentLevel))
                {
                    ChartDataCollection chartData = GetChartControl(control).Data;

                    // Precondition
                    MacroStabilityInwardsOutputViewChartDataAssert.AssertInputChartData(calculation, chartData);
                    MacroStabilityInwardsOutputViewChartDataAssert.AssertOutputChartData(calculation, chartData);

                    calculation.ClearOutput();

                    // Call
                    control.UpdateChartData();

                    // Assert
                    MacroStabilityInwardsOutputViewChartDataAssert.AssertEmptyChartDataWithEmptySoilLayerAndWithWaternetChartData(chartData);
                    MacroStabilityInwardsOutputViewChartDataAssert.AssertEmptyOutputChartData(chartData);
                }
        }