public void CreateFileImporter_Always_ReturnFileImporter() { // Setup var mocks = new MockRepository(); IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(mocks); mocks.ReplayAll(); var context = new StabilityPointStructuresCalculationGroupContext(new CalculationGroup(), null, new StabilityPointStructuresFailureMechanism(), assessmentSection); using (var plugin = new StabilityPointStructuresPlugin()) { ImportInfo info = GetImportInfo(plugin); // Call IFileImporter fileImporter = info.CreateFileImporter(context, "test"); // Assert Assert.IsInstanceOf <StabilityPointStructuresCalculationConfigurationImporter>(fileImporter); } mocks.VerifyAll(); }
public void CreateFileImporter_Always_ReturnFileImporter() { // Setup var mocks = new MockRepository(); var failureMechanism = mocks.Stub <ICalculatableFailureMechanism>(); var assessmentSection = mocks.Stub <IAssessmentSection>(); assessmentSection.Stub(a => a.ReferenceLine).Return(new ReferenceLine()); mocks.ReplayAll(); var foreshoreProfiles = new ForeshoreProfileCollection(); var importTarget = new ForeshoreProfilesContext(foreshoreProfiles, failureMechanism, assessmentSection); using (var plugin = new RiskeerPlugin()) { ImportInfo importInfo = GetImportInfo(plugin); // Call IFileImporter importer = importInfo.CreateFileImporter(importTarget, "test"); // Assert Assert.IsInstanceOf <ProfilesImporter <ForeshoreProfileCollection> >(importer); } mocks.VerifyAll(); }
public void CreateFileImporter_Always_ReturnFileImporter() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub <IAssessmentSection>(); assessmentSection.Stub(a => a.ReferenceLine).Return(new ReferenceLine()); mocks.ReplayAll(); var failureMechanism = new HeightStructuresFailureMechanism(); var importTarget = new HeightStructuresContext(failureMechanism.HeightStructures, failureMechanism, assessmentSection); using (var plugin = new HeightStructuresPlugin()) { ImportInfo importInfo = GetImportInfo(plugin); // Call IFileImporter importer = importInfo.CreateFileImporter(importTarget, "test"); // Assert Assert.IsInstanceOf <HeightStructuresImporter>(importer); } mocks.VerifyAll(); }
public void CreateFileImporter_Always_ReturnFileImporter() { // Setup var importTarget = new MapDataCollectionContext(new MapDataCollection("test"), null); // Call IFileImporter importer = importInfo.CreateFileImporter(importTarget, ""); // Assert Assert.IsInstanceOf <FeatureBasedMapDataImporter>(importer); }
private void ImportItemsUsingDialog(ImportInfo importInfo, object target) { string fileDialogResult = inquiryHelper.GetSourceFileLocation(importInfo.FileFilterGenerator.Filter); if (fileDialogResult != null && importInfo.VerifyUpdates(target)) { RunImportActivity(importInfo.CreateFileImporter(target, fileDialogResult), importInfo.Name); } else { log.InfoFormat(Resources.GuiImportHandler_ImportItemsUsingDialog_Importing_cancelled); } }
public void CreateFileImporter_Always_ReturnFileImporter() { // Setup var assessmentSection = mocks.Stub <IAssessmentSection>(); mocks.ReplayAll(); var importTarget = new ReferenceLineContext(new ReferenceLine(), assessmentSection); // Call IFileImporter importer = importInfo.CreateFileImporter(importTarget, ""); // Assert Assert.IsInstanceOf <ReferenceLineImporter>(importer); }
public void ImplicitOperator_OptionalDelegatesAndPropertiesSet_ImportInfoFullyConverted() { // Setup var mocks = new MockRepository(); var fileImporter = mocks.StrictMock <IFileImporter>(); mocks.ReplayAll(); const string name = "name"; const string category = "category"; var image = new Bitmap(16, 16); var generator = new FileFilterGenerator(); var info = new ImportInfo <int> { CreateFileImporter = (data, filePath) => fileImporter, IsEnabled = data => false, Name = name, Category = category, Image = image, FileFilterGenerator = generator, VerifyUpdates = i => true }; // Precondition Assert.IsInstanceOf <ImportInfo <int> >(info); // Call ImportInfo convertedInfo = info; // Assert Assert.IsInstanceOf <ImportInfo>(convertedInfo); Assert.AreEqual(typeof(int), convertedInfo.DataType); Assert.IsNotNull(convertedInfo.CreateFileImporter); Assert.AreSame(fileImporter, convertedInfo.CreateFileImporter(12, "")); Assert.IsNotNull(convertedInfo.IsEnabled); Assert.IsFalse(convertedInfo.IsEnabled(12)); Assert.AreEqual(name, info.Name); Assert.AreEqual(category, info.Category); Assert.AreSame(image, info.Image); Assert.AreEqual(generator, info.FileFilterGenerator); Assert.IsNotNull(info.VerifyUpdates); Assert.IsTrue(convertedInfo.VerifyUpdates(12)); mocks.VerifyAll(); }
public void CreateFileImporter_Always_ReturnFileImporter() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub <IAssessmentSection>(); mocks.ReplayAll(); var failureMechanism = new MacroStabilityInwardsFailureMechanism(); var importTarget = new MacroStabilityInwardsStochasticSoilModelCollectionContext(failureMechanism.StochasticSoilModels, failureMechanism, assessmentSection); // Call IFileImporter importer = importInfo.CreateFileImporter(importTarget, ""); // Assert Assert.IsInstanceOf <StochasticSoilModelImporter <MacroStabilityInwardsStochasticSoilModel> >(importer); mocks.VerifyAll(); }
public void CreateFileImporter_Always_ReturnFileImporter() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub <IAssessmentSection>(); var failureMechanism = mocks.Stub <IFailureMechanism <FailureMechanismSectionResult> >(); assessmentSection.Stub(a => a.ReferenceLine).Return(new ReferenceLine()); mocks.ReplayAll(); var importTarget = new FailureMechanismSectionsContext(failureMechanism, assessmentSection); // Call IFileImporter importer = importInfo.CreateFileImporter(importTarget, ""); // Assert Assert.IsInstanceOf <FailureMechanismSectionsImporter>(importer); mocks.VerifyAll(); }
public void CreateFileImporter_Always_ReturnFileImporter() { // Setup mocks = new MockRepository(); var gui = mocks.Stub <IGui>(); gui.Stub(g => g.ViewCommands).Return(mocks.Stub <IViewCommands>()); gui.Stub(g => g.ProjectOpened += null).IgnoreArguments(); gui.Stub(g => g.ProjectOpened -= null).IgnoreArguments(); mocks.ReplayAll(); var importTarget = new HydraulicBoundaryDatabaseContext(new HydraulicBoundaryDatabase(), new AssessmentSection(AssessmentSectionComposition.Dike)); // Call IFileImporter importer = importInfo.CreateFileImporter(importTarget, ""); // Assert Assert.IsInstanceOf <HydraulicBoundaryDatabaseImporter>(importer); mocks.VerifyAll(); }
public void CreateFileImporter_Always_ReturnFileImporter() { // Setup var mocks = new MockRepository(); var inquiryHelper = mocks.Stub <IInquiryHelper>(); var assessmentSection = mocks.Stub <IAssessmentSection>(); assessmentSection.Stub(a => a.ReferenceLine).Return(new ReferenceLine()); mocks.ReplayAll(); var context = new PipingFailureMechanismSectionsContext(new PipingFailureMechanism(), assessmentSection); ImportInfo <PipingFailureMechanismSectionsContext> importInfo = GetImportInfo(inquiryHelper); // Call IFileImporter importer = importInfo.CreateFileImporter(context, ""); // Assert Assert.IsInstanceOf <FailureMechanismSectionsImporter>(importer); mocks.VerifyAll(); }
public void CreateFileImporter_ValidInput_ReturnFileImporter() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub <IAssessmentSection>(); assessmentSection.Stub(a => a.ReferenceLine).Return(new ReferenceLine()); mocks.ReplayAll(); var failureMechanism = new PipingFailureMechanism(); var surfaceLines = new PipingSurfaceLineCollection(); var importTarget = new PipingSurfaceLinesContext(surfaceLines, failureMechanism, assessmentSection); // Call IFileImporter importer = importInfo.CreateFileImporter(importTarget, ""); // Assert Assert.IsInstanceOf <SurfaceLinesCsvImporter <PipingSurfaceLine> >(importer); mocks.VerifyAll(); }
public void CreateFileImporter_Always_ReturnFileImporter() { // Setup var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); var mocks = new MockRepository(); IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(mocks); assessmentSection.Stub(section => section.FailureMechanismContribution).Return(new FailureMechanismContribution(0.01, 0.001)); mocks.ReplayAll(); var context = new GrassCoverErosionInwardsCalculationGroupContext(new CalculationGroup(), null, failureMechanism, assessmentSection); // Call IFileImporter importer = importInfo.CreateFileImporter(context, ""); // Assert Assert.IsInstanceOf <GrassCoverErosionInwardsCalculationConfigurationImporter>(importer); mocks.VerifyAll(); }
public void ImplicitOperator_NoneOfTheOptionalDelegatesAndPropertiesSet_ImportInfoFullyConverted() { // Setup var info = new ImportInfo <int>(); // Precondition Assert.IsInstanceOf <ImportInfo <int> >(info); // Call ImportInfo convertedInfo = info; // Assert Assert.IsInstanceOf <ImportInfo>(convertedInfo); Assert.AreEqual(typeof(int), convertedInfo.DataType); Assert.IsNotNull(convertedInfo.CreateFileImporter); Assert.IsNull(convertedInfo.CreateFileImporter(12, "")); Assert.IsNotNull(convertedInfo.IsEnabled); Assert.IsTrue(convertedInfo.IsEnabled(12)); Assert.IsNull(info.Name); Assert.AreEqual("Importeren gegevens", info.Category); TestHelper.AssertImagesAreEqual(Resources.brick, info.Image); Assert.IsNull(info.FileFilterGenerator); Assert.IsNull(info.VerifyUpdates); }
public void CreateFileImporter_Always_ReturnFileImporter() { // Setup var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); var mocks = new MockRepository(); IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(failureMechanism, mocks); assessmentSection.Stub(section => section.WaterLevelCalculationsForUserDefinedTargetProbabilities) .Return(new ObservableList <HydraulicBoundaryLocationCalculationsForTargetProbability>()); mocks.ReplayAll(); var context = new GrassCoverErosionOutwardsCalculationGroupContext(new CalculationGroup(), null, failureMechanism, assessmentSection); // Call IFileImporter importer = importInfo.CreateFileImporter(context, ""); // Assert Assert.IsInstanceOf <GrassCoverErosionOutwardsWaveConditionsCalculationConfigurationImporter>(importer); mocks.VerifyAll(); }
public void CreateFileImporter_Always_ReturnsFileImporter() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub <IAssessmentSection>(); assessmentSection.Stub(a => a.ReferenceLine).Return(new ReferenceLine()); mocks.ReplayAll(); var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); var context = new DikeProfilesContext(failureMechanism.DikeProfiles, failureMechanism, assessmentSection); using (var plugin = new GrassCoverErosionInwardsPlugin()) { ImportInfo importInfo = GetImportInfo(plugin); // Call IFileImporter importer = importInfo.CreateFileImporter(context, string.Empty); // Assert Assert.IsInstanceOf <DikeProfilesImporter>(importer); mocks.VerifyAll(); } }
public void CreateFileImporter_Always_ReturnFileImporter() { // Setup var failureMechanism = new MacroStabilityInwardsFailureMechanism(); var mocks = new MockRepository(); IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(failureMechanism, mocks); mocks.ReplayAll(); var context = new MacroStabilityInwardsCalculationGroupContext(new CalculationGroup(), null, Enumerable.Empty <MacroStabilityInwardsSurfaceLine>(), Enumerable.Empty <MacroStabilityInwardsStochasticSoilModel>(), failureMechanism, assessmentSection); // Call IFileImporter importer = importInfo.CreateFileImporter(context, ""); // Assert Assert.IsInstanceOf <MacroStabilityInwardsCalculationConfigurationImporter>(importer); mocks.VerifyAll(); }