Пример #1
0
        private static bool ExportCalculationsForTargetProbability(
            Tuple <IEnumerable <HydraulicBoundaryLocationCalculation>, double> calculationsForTargetProbability,
            HydraulicBoundaryLocationCalculationsType calculationsType,
            ICollection <string> exportedCalculationFileNames,
            string folderPath)
        {
            IEnumerable <HydraulicBoundaryLocationCalculation> calculations = calculationsForTargetProbability.Item1;
            double targetProbability = calculationsForTargetProbability.Item2;

            string exportType = calculationsType == HydraulicBoundaryLocationCalculationsType.WaterLevel
                                    ? Resources.WaterLevels_DisplayName
                                    : Resources.WaveHeights_DisplayName;

            string uniqueName = NamingHelper.GetUniqueName(
                exportedCalculationFileNames, $"{exportType}_{ReturnPeriodFormattingHelper.FormatFromProbability(targetProbability)}",
                c => c);

            exportedCalculationFileNames.Add(uniqueName);

            string tempFilePath = Path.Combine(folderPath, $"{uniqueName}.{RiskeerCommonIOResources.Shape_file_filter_Extension}");

            var exporter = new HydraulicBoundaryLocationCalculationsForTargetProbabilityExporter(
                calculations, tempFilePath, calculationsType);

            return(exporter.Export());
        }
        public void FormatFromProbability_ValidValue_ReturnsReturnPeriod(double probability, string expectedText)
        {
            // Call
            string returnPeriod = ReturnPeriodFormattingHelper.FormatFromProbability(probability);

            // Assert
            Assert.AreEqual(expectedText, returnPeriod);
        }
Пример #3
0
        private static string GetExpectedShapeFileName(HydraulicBoundaryLocationCalculationsType calculationsType,
                                                       double targetProbability)
        {
            string exportType = calculationsType == HydraulicBoundaryLocationCalculationsType.WaterLevel
                                    ? "Waterstanden"
                                    : "Golfhoogten";

            return($"{exportType}_{ReturnPeriodFormattingHelper.FormatFromProbability(targetProbability)}");
        }
        public void FormatFromProbability_InvalidValue_ThrowsArgumentOutOfRangeException(double probability)
        {
            // Call
            void Call() => ReturnPeriodFormattingHelper.FormatFromProbability(probability);

            // Assert
            const string message = "Probability must be larger than 0.0.";

            TestHelper.AssertThrowsArgumentExceptionAndTestMessage <ArgumentOutOfRangeException>(Call, message);
        }
 private static string GetReturnPeriodText(double targetProbability)
 {
     return(ReturnPeriodFormattingHelper.FormatFromProbability(targetProbability));
 }