Пример #1
0
        public void Constructor_ExpectedValues()
        {
            // Setup
            var mocks             = new MockRepository();
            var assessmentSection = mocks.Stub <IAssessmentSection>();

            mocks.ReplayAll();

            var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();

            // Call
            var context = new GrassCoverErosionInwardsFailureMechanismSectionResultContext(
                failureMechanism.SectionResults, failureMechanism, assessmentSection);

            // Assert
            Assert.IsInstanceOf <FailureMechanismSectionResultContext <AdoptableWithProfileProbabilityFailureMechanismSectionResult> >(context);
            mocks.VerifyAll();
        }
        public void GetViewData_WithContext_ReturnsSectionResults()
        {
            // Setup
            var mocks             = new MockRepository();
            var assessmentSection = mocks.Stub <IAssessmentSection>();

            mocks.ReplayAll();

            var sectionResults = new ObservableList <AdoptableWithProfileProbabilityFailureMechanismSectionResult>();

            var context = new GrassCoverErosionInwardsFailureMechanismSectionResultContext(
                sectionResults, new GrassCoverErosionInwardsFailureMechanism(), assessmentSection);

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

            // Assert
            Assert.AreSame(sectionResults, viewData);
            mocks.VerifyAll();
        }
        public void CreateInstance_WithContext_ReturnsView()
        {
            // Setup
            var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();

            var mocks = new MockRepository();
            IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(failureMechanism, mocks);

            mocks.ReplayAll();

            var context = new GrassCoverErosionInwardsFailureMechanismSectionResultContext(
                failureMechanism.SectionResults,
                failureMechanism,
                assessmentSection);

            // Call
            IView view = info.CreateInstance(context);

            // Assert
            Assert.IsInstanceOf <GrassCoverErosionInwardsFailureMechanismResultView>(view);
            mocks.VerifyAll();
        }