public void CreateReplaceStrategyConfiguration_WithoutFailureMechanism_ThrowsArgumentNullException() { // Call TestDelegate test = () => MacroStabilityInwardsStochasticSoilModelImporterConfigurationFactory.CreateReplaceStrategyConfiguration(null); // Assert Assert.Throws <ArgumentNullException>(test); }
public void CreateReplaceStrategyConfiguration_ValidArgument_ReturnsReplaceStrategyAndTransformerForMacroStabilityInwards() { // Call StochasticSoilModelImporterConfiguration <MacroStabilityInwardsStochasticSoilModel> result = MacroStabilityInwardsStochasticSoilModelImporterConfigurationFactory.CreateReplaceStrategyConfiguration(new MacroStabilityInwardsFailureMechanism()); // Assert Assert.IsNotNull(result); Assert.IsInstanceOf <MacroStabilityInwardsStochasticSoilModelTransformer>(result.Transformer); Assert.IsInstanceOf <MacroStabilityInwardsStochasticSoilModelFilter>(result.MechanismFilter); Assert.IsInstanceOf <MacroStabilityInwardsStochasticSoilModelReplaceDataStrategy>(result.UpdateStrategy); }
/// <summary> /// Imports the <see cref="MacroStabilityInwardsStochasticSoilModel"/> data for the <see cref="MacroStabilityInwardsFailureMechanism"/> /// of the given <see cref="IAssessmentSection"/>. /// </summary> /// <param name="assessmentSection">The <see cref="AssessmentSection"/> to import on.</param> /// <remarks>This will import 4 soil models with one profile each.</remarks> public static void ImportMacroStabilityInwardsStochasticSoilModels(AssessmentSection assessmentSection) { using (var embeddedResourceFileWriter = new EmbeddedResourceFileWriter(typeof(DataImportHelper).Assembly, true, "DR6.soil")) { string filePath = Path.Combine(embeddedResourceFileWriter.TargetFolderPath, "DR6.soil"); var activity = new FileImportActivity(new StochasticSoilModelImporter <MacroStabilityInwardsStochasticSoilModel>( assessmentSection.MacroStabilityInwards.StochasticSoilModels, filePath, new ImportMessageProvider(), MacroStabilityInwardsStochasticSoilModelImporterConfigurationFactory.CreateReplaceStrategyConfiguration(assessmentSection.MacroStabilityInwards)), "MacroStabilityInwardsStochasticSoilModelImporter"); activity.Run(); activity.Finish(); } }