Exemplo n.º 1
0
        public void Parse_ValidFileWithBetaResult_OutputSet()
        {
            // Setup
            string path   = Path.Combine(testDirectory, validFile);
            var    parser = new ExceedanceProbabilityCalculationParser();

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

            // Assert
            Assert.AreEqual(3.42848, parser.Output);
        }
Exemplo n.º 2
0
        public void Parse_WorkingDirectoryNull_ThrowsArgumentNullException()
        {
            // Setup
            var parser = new ExceedanceProbabilityCalculationParser();

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

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

            Assert.AreEqual("workingDirectory", exception.ParamName);
        }
Exemplo n.º 3
0
        public void Parse_WithWorkingDirectoryWithoutExpectedFile_ThrowsHydraRingFileParserException()
        {
            // Setup
            string path   = Path.Combine(testDirectory, "EmptyWorkingDirectory");
            var    parser = new ExceedanceProbabilityCalculationParser();

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

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

            Assert.IsInstanceOf <SQLiteException>(exception.InnerException);
        }
Exemplo n.º 4
0
        public void Parse_WithBetaResultOnOtherSection_ThrowsHydraRingFileParserException()
        {
            // Setup
            string path   = Path.Combine(testDirectory, "OtherSection");
            var    parser = new ExceedanceProbabilityCalculationParser();

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

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

            Assert.AreEqual("Er is geen resultaat voor de betrouwbaarheidsindex van de faalkans gevonden in de Hydra-Ring uitvoerdatabase.", exception.Message);
        }
Exemplo n.º 5
0
        public void Parse_WithWorkingDirectoryWithInvalidOutputFile_ThrowsHydraRingFileParserException()
        {
            // Setup
            string path   = Path.Combine(testDirectory, "InvalidFile");
            var    parser = new ExceedanceProbabilityCalculationParser();

            // 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);
        }
Exemplo n.º 6
0
        public void Parse_ErrorWhileReadingFile_ThrowsHydraRingFileParserException()
        {
            // Setup
            var    parser           = new ExceedanceProbabilityCalculationParser();
            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);
            }
        }