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(); }
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); }
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(); }
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(); }
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())); }
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(); }
public override IEnumerable <UpdateInfo> GetUpdateInfos() { yield return(RiskeerUpdateInfoFactory.CreateFailureMechanismSectionsUpdateInfo < WaveImpactAsphaltCoverFailureMechanismSectionsContext, WaveImpactAsphaltCoverFailureMechanism, NonAdoptableWithProfileProbabilityFailureMechanismSectionResult>( new NonAdoptableWithProfileProbabilityFailureMechanismSectionResultUpdateStrategy())); }
public override IEnumerable <UpdateInfo> GetUpdateInfos() { yield return(RiskeerUpdateInfoFactory.CreateFailureMechanismSectionsUpdateInfo < GrassCoverErosionOutwardsFailureMechanismSectionsContext, GrassCoverErosionOutwardsFailureMechanism, NonAdoptableWithProfileProbabilityFailureMechanismSectionResult>( new NonAdoptableWithProfileProbabilityFailureMechanismSectionResultUpdateStrategy())); }