Пример #1
0
        public void Constructor_ExpectedValues()
        {
            // Call
            var parser = new ConvergenceParser();

            // Assert
            Assert.IsInstanceOf <IHydraRingFileParser>(parser);
            Assert.IsNull(parser.Output);
        }
Пример #2
0
        /// <summary>
        /// Create a new instance of <see cref="DesignWaterLevelCalculator"/>.
        /// </summary>
        /// <param name="calculationSettings">The <see cref="HydraRingCalculationSettings"/>.</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="calculationSettings"/>
        /// is <c>null</c>.</exception>
        /// <remarks>Preprocessing is disabled when <see cref="HydraRingCalculationSettings.PreprocessorDirectory"/>
        /// equals <see cref="string.Empty"/>.</remarks>
        internal DunesBoundaryConditionsCalculator(HydraRingCalculationSettings calculationSettings) : base(calculationSettings)
        {
            dunesBoundaryParser     = new DunesBoundaryConditionsCalculationParser();
            targetProbabilityParser = new ReliabilityIndexCalculationParser();
            convergenceParser       = new ConvergenceParser();

            WaterLevel       = double.NaN;
            WaveHeight       = double.NaN;
            WavePeriod       = double.NaN;
            ReliabilityIndex = double.NaN;
        }
Пример #3
0
        public void Parse_WithWorkingDirectoryWithFileWithTrueResult_SetOutputTrue(string testSubDirectory)
        {
            // Setup
            string path   = Path.Combine(testDirectory, testSubDirectory);
            var    parser = new ConvergenceParser();

            // Call
            parser.Parse(path, 1);

            // Assert
            Assert.IsTrue(parser.Output);
        }
        /// <summary>
        /// Create a new instance of <see cref="WaveConditionsCosineCalculator"/>.
        /// </summary>
        /// <param name="calculationSettings">The <see cref="HydraRingCalculationSettings"/>.</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="calculationSettings"/>
        /// is <c>null</c>.</exception>
        /// <remarks>Preprocessing is disabled when <see cref="HydraRingCalculationSettings.PreprocessorDirectory" />
        /// equals <see cref="string.Empty"/>.</remarks>
        internal WaveConditionsCosineCalculator(HydraRingCalculationSettings calculationSettings) : base(calculationSettings)
        {
            waveConditionsCalculationParser   = new WaveConditionsCalculationParser();
            reliabilityIndexCalculationParser = new ReliabilityIndexCalculationParser();
            convergenceParser = new ConvergenceParser();

            WaveHeight       = double.NaN;
            WaveAngle        = double.NaN;
            WavePeakPeriod   = double.NaN;
            WaveDirection    = double.NaN;
            ReliabilityIndex = double.NaN;
        }
Пример #5
0
        public void Parse_WorkingDirectoryNull_ThrowsArgumentNullException()
        {
            // Setup
            var parser = new ConvergenceParser();

            // Call
            TestDelegate test = () => parser.Parse(null, 1);

            // Assert
            var exception = Assert.Throws <ArgumentNullException>(test);

            Assert.AreEqual("workingDirectory", exception.ParamName);
        }
Пример #6
0
        public void Parse_WithWorkingDirectoryWithEmptyFile_ThrowsHydraRingFileParserException()
        {
            // Setup
            string path   = Path.Combine(testDirectory, "EmptyDatabase");
            var    parser = new ConvergenceParser();

            // Call
            TestDelegate test = () => parser.Parse(path, 1);

            // Assert
            var exception = Assert.Throws <HydraRingFileParserException>(test);

            Assert.AreEqual("Er is geen resultaat voor convergentie gevonden in de Hydra-Ring uitvoerdatabase.", exception.Message);
        }
Пример #7
0
        public void Parse_WithWorkingDirectoryWithoutExpectedFile_ThrowsHydraRingFileParserException()
        {
            // Setup
            string path   = Path.Combine(testDirectory, "EmptyWorkingDirectory");
            var    parser = new ConvergenceParser();

            // Call
            TestDelegate test = () => parser.Parse(path, 1);

            // Assert
            var exception = Assert.Throws <HydraRingFileParserException>(test);

            Assert.IsInstanceOf <SQLiteException>(exception.InnerException);
        }
Пример #8
0
        public void Parse_WithWorkingDirectoryWithInvalidOutputFile_ThrowsHydraRingFileParserException()
        {
            // Setup
            string path   = Path.Combine(testDirectory, "InvalidFile");
            var    parser = new ConvergenceParser();

            // Call
            TestDelegate test = () => parser.Parse(path, 1);

            // Assert
            var exception = Assert.Throws <HydraRingFileParserException>(test);

            Assert.AreEqual("Er kon geen resultaat gelezen worden uit de Hydra-Ring uitvoerdatabase.", exception.Message);
            Assert.IsInstanceOf <SQLiteException>(exception.InnerException);
        }
Пример #9
0
        public void Parse_ResultNull_ThrowsHydraRingFileParserException()
        {
            // Setup
            string path   = Path.Combine(testDirectory, "ConvergenceNull");
            var    parser = new ConvergenceParser();

            // Call
            TestDelegate test = () => parser.Parse(path, 1);

            // Assert
            var exception = Assert.Throws <HydraRingFileParserException>(test);

            Assert.AreEqual("Er is geen resultaat voor convergentie gevonden in de Hydra-Ring uitvoerdatabase.", exception.Message);
            Assert.IsInstanceOf <InvalidCastException>(exception.InnerException);
        }
Пример #10
0
        public void Parse_ErrorWhileReadingFile_ThrowsHydraRingFileParserException()
        {
            // Setup
            var    parser           = new ConvergenceParser();
            string workingDirectory = Path.Combine(testDirectory, "ValidFile");

            using (new DirectoryPermissionsRevoker(testDirectory, FileSystemRights.ReadData))
            {
                // Call
                TestDelegate call = () => parser.Parse(workingDirectory, 1);

                // Assert
                var          exception       = Assert.Throws <HydraRingFileParserException>(call);
                const string expectedMessage = "Er kon geen resultaat gelezen worden uit de Hydra-Ring uitvoerdatabase.";
                Assert.AreEqual(expectedMessage, exception.Message);
                Assert.IsInstanceOf <SQLiteException>(exception.InnerException);
            }
        }