コード例 #1
0
        public void CreateFailureMechanismSectionsUpdateInfo_WithArguments_ExpectedPropertiesSet()
        {
            // Setup
            var mocks = new MockRepository();
            var sectionResultUpdateStrategy = mocks.Stub <IFailureMechanismSectionResultUpdateStrategy <FailureMechanismSectionResult> >();
            var assessmentSection           = mocks.Stub <IAssessmentSection>();

            assessmentSection.Stub(a => a.ReferenceLine).Return(new ReferenceLine());
            mocks.ReplayAll();

            // Call
            UpdateInfo <FailureMechanismSectionsContext> updateInfo = RiskeerUpdateInfoFactory.CreateFailureMechanismSectionsUpdateInfo <
                FailureMechanismSectionsContext, TestFailureMechanism, FailureMechanismSectionResult>(sectionResultUpdateStrategy);

            // Assert
            Assert.AreEqual("Vakindeling", updateInfo.Name);
            Assert.AreEqual("Algemeen", updateInfo.Category);

            FileFilterGenerator fileFilterGenerator = updateInfo.FileFilterGenerator;

            Assert.AreEqual("Shapebestand (*.shp)|*.shp", fileFilterGenerator.Filter);

            TestHelper.AssertImagesAreEqual(Resources.SectionsIcon, updateInfo.Image);
            Assert.IsNull(updateInfo.VerifyUpdates);

            mocks.VerifyAll();
        }
コード例 #2
0
        public void CreateFailureMechanismSectionsUpdateInfo_SectionResultUpdateStrategyNull_ThrowsArgumentNullException()
        {
            // Call
            void Call() => RiskeerUpdateInfoFactory.CreateFailureMechanismSectionsUpdateInfo <
                FailureMechanismSectionsContext, TestFailureMechanism, FailureMechanismSectionResult>(null);

            // Assert
            var exception = Assert.Throws <ArgumentNullException>(Call);

            Assert.AreEqual("sectionResultUpdateStrategy", exception.ParamName);
        }
コード例 #3
0
        public void CreateFailureMechanismSectionsUpdateInfo_WithoutSourcePath_ReturnsNullPath()
        {
            // Setup
            var mocks = new MockRepository();
            var sectionResultUpdateStrategy = mocks.Stub <IFailureMechanismSectionResultUpdateStrategy <FailureMechanismSectionResult> >();
            var assessmentSection           = mocks.Stub <IAssessmentSection>();

            assessmentSection.Stub(a => a.ReferenceLine).Return(new ReferenceLine());
            mocks.ReplayAll();

            // Call
            UpdateInfo <FailureMechanismSectionsContext> updateInfo = RiskeerUpdateInfoFactory.CreateFailureMechanismSectionsUpdateInfo <
                FailureMechanismSectionsContext, TestFailureMechanism, FailureMechanismSectionResult>(sectionResultUpdateStrategy);

            // Assert
            var failureMechanismSectionsContext = new FailureMechanismSectionsContext(new TestFailureMechanism(), assessmentSection);

            Assert.IsNull(updateInfo.CurrentPath(failureMechanismSectionsContext));
            mocks.VerifyAll();
        }
コード例 #4
0
        public void CreateFailureMechanismSectionsUpdateInfo_WithArguments_ReturnsExpectedCreatedFileImporter()
        {
            // Setup
            var mocks = new MockRepository();
            var sectionResultUpdateStrategy = mocks.Stub <IFailureMechanismSectionResultUpdateStrategy <FailureMechanismSectionResult> >();
            var assessmentSection           = mocks.Stub <IAssessmentSection>();

            assessmentSection.Stub(a => a.ReferenceLine).Return(new ReferenceLine());
            mocks.ReplayAll();

            // Call
            UpdateInfo <FailureMechanismSectionsContext> updateInfo = RiskeerUpdateInfoFactory.CreateFailureMechanismSectionsUpdateInfo <
                FailureMechanismSectionsContext, TestFailureMechanism, FailureMechanismSectionResult>(sectionResultUpdateStrategy);

            // Assert
            var failureMechanismSectionsContext = new FailureMechanismSectionsContext(new TestFailureMechanism(), assessmentSection);

            Assert.IsInstanceOf <FailureMechanismSectionsImporter>(updateInfo.CreateFileImporter(failureMechanismSectionsContext, ""));

            mocks.VerifyAll();
        }
コード例 #5
0
        public override IEnumerable <UpdateInfo> GetUpdateInfos()
        {
            yield return(new UpdateInfo <HeightStructuresContext>
            {
                Name = RiskeerCommonDataResources.StructureCollection_TypeDescriptor,
                Category = RiskeerCommonFormsResources.Riskeer_Category,
                Image = RiskeerCommonFormsResources.StructuresIcon,
                IsEnabled = context => context.WrappedData.SourcePath != null,
                FileFilterGenerator = CreateHeightStructureFileFilter(),
                CreateFileImporter = (context, filePath) => CreateHeightStructuresImporter(
                    context, filePath, new UpdateMessageProvider(), new HeightStructureUpdateDataStrategy(context.FailureMechanism)),
                CurrentPath = context => context.WrappedData.SourcePath,
                VerifyUpdates = context =>
                                VerifyStructuresShouldUpdate(
                    context.FailureMechanism,
                    RiskeerCommonIOResources.VerifyStructuresShouldUpdate_When_updating_Calculation_with_Structure_data_output_will_be_cleared_confirm)
            });

            yield return(RiskeerUpdateInfoFactory.CreateFailureMechanismSectionsUpdateInfo <
                             HeightStructuresFailureMechanismSectionsContext, HeightStructuresFailureMechanism, AdoptableFailureMechanismSectionResult>(
                             new AdoptableFailureMechanismSectionResultUpdateStrategy()));
        }
コード例 #6
0
        public void CreateFailureMechanismSectionsUpdateInfo_WithSourcePath_ReturnsIsEnabledTrue()
        {
            // Setup
            var mocks = new MockRepository();
            var sectionResultUpdateStrategy = mocks.Stub <IFailureMechanismSectionResultUpdateStrategy <FailureMechanismSectionResult> >();
            var assessmentSection           = mocks.Stub <IAssessmentSection>();

            assessmentSection.Stub(a => a.ReferenceLine).Return(new ReferenceLine());
            mocks.ReplayAll();

            // Call
            UpdateInfo <FailureMechanismSectionsContext> updateInfo = RiskeerUpdateInfoFactory.CreateFailureMechanismSectionsUpdateInfo <
                FailureMechanismSectionsContext, TestFailureMechanism, FailureMechanismSectionResult>(sectionResultUpdateStrategy);

            // Assert
            var testFailureMechanism = new TestFailureMechanism();

            testFailureMechanism.SetSections(Enumerable.Empty <FailureMechanismSection>(), "path/to/sections");
            var failureMechanismSectionsContext = new FailureMechanismSectionsContext(testFailureMechanism, assessmentSection);

            Assert.IsTrue(updateInfo.IsEnabled(failureMechanismSectionsContext));
            mocks.VerifyAll();
        }
コード例 #7
0
 public override IEnumerable <UpdateInfo> GetUpdateInfos()
 {
     yield return(RiskeerUpdateInfoFactory.CreateFailureMechanismSectionsUpdateInfo <
                      WaveImpactAsphaltCoverFailureMechanismSectionsContext, WaveImpactAsphaltCoverFailureMechanism, NonAdoptableWithProfileProbabilityFailureMechanismSectionResult>(
                      new NonAdoptableWithProfileProbabilityFailureMechanismSectionResultUpdateStrategy()));
 }
コード例 #8
0
 public override IEnumerable <UpdateInfo> GetUpdateInfos()
 {
     yield return(RiskeerUpdateInfoFactory.CreateFailureMechanismSectionsUpdateInfo <
                      GrassCoverErosionOutwardsFailureMechanismSectionsContext, GrassCoverErosionOutwardsFailureMechanism, NonAdoptableWithProfileProbabilityFailureMechanismSectionResult>(
                      new NonAdoptableWithProfileProbabilityFailureMechanismSectionResultUpdateStrategy()));
 }