Ejemplo n.º 1
0
        public void CreateReplaceStrategyConfiguration_WithoutFailureMechanism_ThrowsArgumentNullException()
        {
            // Call
            TestDelegate test = () => PipingStochasticSoilModelImporterConfigurationFactory.CreateReplaceStrategyConfiguration(null);

            // Assert
            Assert.Throws <ArgumentNullException>(test);
        }
Ejemplo n.º 2
0
        public void CreateReplaceStrategyConfiguration_ValidArgument_ReturnsReplaceStrategyAndTransformerForPiping()
        {
            // Call
            StochasticSoilModelImporterConfiguration <PipingStochasticSoilModel> result =
                PipingStochasticSoilModelImporterConfigurationFactory.CreateReplaceStrategyConfiguration(new PipingFailureMechanism());

            // Assert
            Assert.IsNotNull(result);
            Assert.IsInstanceOf <PipingStochasticSoilModelTransformer>(result.Transformer);
            Assert.IsInstanceOf <PipingStochasticSoilModelFilter>(result.MechanismFilter);
            Assert.IsInstanceOf <PipingStochasticSoilModelReplaceDataStrategy>(result.UpdateStrategy);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Imports the <see cref="PipingStochasticSoilModel"/> data for the <see cref="PipingFailureMechanism"/>
 /// 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 ImportPipingStochasticSoilModels(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 <PipingStochasticSoilModel>(
                 assessmentSection.Piping.StochasticSoilModels,
                 filePath,
                 new ImportMessageProvider(),
                 PipingStochasticSoilModelImporterConfigurationFactory.CreateReplaceStrategyConfiguration(assessmentSection.Piping)),
             "StochasticSoilModelImporter");
         activity.Run();
         activity.Finish();
     }
 }