public void ParameteredConstructor_ExpectedValues()
        {
            // Setup
            var mocks             = new MockRepository();
            var assessmentSection = mocks.Stub <IAssessmentSection>();

            mocks.ReplayAll();

            var calculation  = new SemiProbabilisticPipingCalculationScenario();
            var surfaceLines = new[]
            {
                new PipingSurfaceLine(string.Empty)
            };

            PipingStochasticSoilModel[] stochasticSoilModels =
            {
                PipingStochasticSoilModelTestFactory.CreatePipingStochasticSoilModel()
            };

            var failureMechanism = new PipingFailureMechanism();

            // Call
            var context = new SemiProbabilisticPipingInputContext(calculation.InputParameters, calculation, surfaceLines, stochasticSoilModels, failureMechanism, assessmentSection);

            // Assert
            Assert.IsInstanceOf <PipingContext <SemiProbabilisticPipingInput> >(context);
            Assert.AreSame(calculation.InputParameters, context.WrappedData);
            Assert.AreSame(calculation, context.PipingCalculation);
            Assert.AreSame(failureMechanism, context.FailureMechanism);
            Assert.AreSame(assessmentSection, context.AssessmentSection);
            CollectionAssert.AreEqual(surfaceLines, context.AvailablePipingSurfaceLines);
            CollectionAssert.AreEqual(stochasticSoilModels, context.AvailableStochasticSoilModels);
            mocks.VerifyAll();
        }
        public void CreateInstance_WithContextAndNormativeProbabilityTypeSignalFloodingProbability_ExpectedProperties()
        {
            // Setup
            var assessmentSection = new AssessmentSectionStub
            {
                FailureMechanismContribution =
                {
                    NormativeProbabilityType = NormativeProbabilityType.SignalFloodingProbability
                }
            };

            var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation();
            var scenario = new SemiProbabilisticPipingCalculationScenario
            {
                InputParameters =
                {
                    HydraulicBoundaryLocation = hydraulicBoundaryLocation
                }
            };

            var failureMechanism = new PipingFailureMechanism();
            var context          = new SemiProbabilisticPipingInputContext(
                scenario.InputParameters,
                scenario,
                Enumerable.Empty <PipingSurfaceLine>(),
                Enumerable.Empty <PipingStochasticSoilModel>(),
                failureMechanism,
                assessmentSection);

            assessmentSection.SetHydraulicBoundaryLocationCalculations(new[]
            {
                hydraulicBoundaryLocation
            }, true);

            // Call
            IObjectProperties objectProperties = info.CreateInstance(context);

            // Assert
            Assert.IsInstanceOf <SemiProbabilisticPipingInputContextProperties>(objectProperties);
            Assert.AreSame(context, objectProperties.Data);

            double expectedAssessmentLevel = assessmentSection.WaterLevelCalculationsForSignalFloodingProbability.ElementAt(0).Output.Result;

            Assert.AreEqual(expectedAssessmentLevel, ((SemiProbabilisticPipingInputContextProperties)objectProperties).AssessmentLevel);
        }
Exemple #3
0
        public void Text_Always_ReturnsTextFromResource()
        {
            // Setup
            var pipingInputContext = new SemiProbabilisticPipingInputContext(
                new SemiProbabilisticPipingInput(),
                new SemiProbabilisticPipingCalculationScenario(),
                Enumerable.Empty <PipingSurfaceLine>(),
                Enumerable.Empty <PipingStochasticSoilModel>(),
                new PipingFailureMechanism(),
                mocks.Stub <IAssessmentSection>());

            mocks.ReplayAll();

            // Call
            string text = info.Text(pipingInputContext);

            // Assert
            Assert.AreEqual("Invoer", text);
        }
Exemple #4
0
        public void Image_Always_ReturnsSetImage()
        {
            // Setup
            var pipingInputContext = new SemiProbabilisticPipingInputContext(
                new SemiProbabilisticPipingInput(),
                new SemiProbabilisticPipingCalculationScenario(),
                Enumerable.Empty <PipingSurfaceLine>(),
                Enumerable.Empty <PipingStochasticSoilModel>(),
                new PipingFailureMechanism(),
                mocks.Stub <IAssessmentSection>());

            mocks.ReplayAll();

            // Call
            Image image = info.Image(pipingInputContext);

            // Assert
            TestHelper.AssertImagesAreEqual(Resources.PipingInputIcon, image);
        }
Exemple #5
0
        public void GetViewData_WithContext_ReturnsWrappedCalculation()
        {
            // Setup
            var assessmentSection = mocks.Stub <IAssessmentSection>();

            mocks.ReplayAll();

            var pipingInput = new SemiProbabilisticPipingInput();

            var calculation             = new SemiProbabilisticPipingCalculationScenario();
            var calculationInputContext = new SemiProbabilisticPipingInputContext(pipingInput, calculation, Enumerable.Empty <PipingSurfaceLine>(),
                                                                                  Enumerable.Empty <PipingStochasticSoilModel>(),
                                                                                  new PipingFailureMechanism(),
                                                                                  assessmentSection);

            // Call
            object viewData = info.GetViewData(calculationInputContext);

            // Assert
            Assert.AreSame(calculation, viewData);
            mocks.VerifyAll();
        }