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

            mocks.ReplayAll();

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

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

            var failureMechanism = new PipingFailureMechanism();

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

            // Assert
            Assert.IsInstanceOf <PipingContext <ProbabilisticPipingInput> >(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 Text_Always_ReturnsTextFromResource()
        {
            // Setup
            var pipingInputContext = new ProbabilisticPipingInputContext(
                new ProbabilisticPipingInput(),
                new ProbabilisticPipingCalculationScenario(),
                Enumerable.Empty <PipingSurfaceLine>(),
                Enumerable.Empty <PipingStochasticSoilModel>(),
                new PipingFailureMechanism(),
                mocks.Stub <IAssessmentSection>());

            mocks.ReplayAll();

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

            // Assert
            Assert.AreEqual("Invoer", text);
        }
        public void Image_Always_ReturnsSetImage()
        {
            // Setup
            var pipingInputContext = new ProbabilisticPipingInputContext(
                new ProbabilisticPipingInput(),
                new ProbabilisticPipingCalculationScenario(),
                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);
        }
Beispiel #4
0
        public void CreateInstance_WithContext_ExpectedProperties()
        {
            // Setup
            var scenario = new ProbabilisticPipingCalculationScenario();
            var context  = new ProbabilisticPipingInputContext(
                scenario.InputParameters,
                scenario,
                Enumerable.Empty <PipingSurfaceLine>(),
                Enumerable.Empty <PipingStochasticSoilModel>(),
                new PipingFailureMechanism(),
                new AssessmentSectionStub());

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

            // Assert
            Assert.IsInstanceOf <ProbabilisticPipingInputContextProperties>(objectProperties);
            Assert.AreSame(context, objectProperties.Data);
        }
Beispiel #5
0
        public void GetViewData_WithContext_ReturnsWrappedCalculation()
        {
            // Setup
            var assessmentSection = mocks.Stub <IAssessmentSection>();

            mocks.ReplayAll();

            var pipingInput = new ProbabilisticPipingInput();

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

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

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