예제 #1
0
        public void Parse_NotExistingLastErrorOutputFile_DoesNotThrowException()
        {
            // Setup
            var lastErrorFileParser = new LastErrorFileParser();

            // Call
            TestDelegate call = () => lastErrorFileParser.Parse(noErrorTestDataDirectory, 1);

            // Assert
            Assert.DoesNotThrow(call);
        }
예제 #2
0
        public void Parse_NotExistingWorkingDirectory_DoesNotThrowException()
        {
            // Setup
            var          lastErrorFileParser  = new LastErrorFileParser();
            const string nonExistentDirectory = "c:/niet_bestaande_map";

            // Call
            TestDelegate call = () => lastErrorFileParser.Parse(nonExistentDirectory, 1);

            // Assert
            Assert.DoesNotThrow(call);
        }
예제 #3
0
        public void Parse_LastErrorFileExists_LastErrorContentSet()
        {
            // Setup
            var lastErrorFileParser = new LastErrorFileParser();

            // Call
            lastErrorFileParser.Parse(lastErrorTestDataDirectory, 1);

            // Assert
            string expectedContent = " File not found: D:\\Repos\\Riskeer\\Riskeer\\Integration\\test\\Riskeer.Integra"
                                     + Environment.NewLine +
                                     " tion.Service.Test\\test-data\\HLCD.sqlite"
                                     + Environment.NewLine;

            Assert.AreEqual(expectedContent, lastErrorFileParser.ErrorFileContent);
        }
예제 #4
0
        /// <summary>
        /// Executes the generic parsers of the calculation.
        /// </summary>
        /// <param name="hydraRingInitializationService">The <see cref="HydraRingInitializationService"/> to get the directory from.</param>
        /// <param name="sectionId">The id of the section of the calculation.</param>
        /// <exception cref="HydraRingFileParserException">Thrown when the HydraRing file parser
        /// encounters an error while parsing HydraRing output.</exception>
        /// <remarks>The <see cref="IllustrationPointsResult"/> is set to <c>null</c> when the <see cref="illustrationPointsParser"/>
        /// encounters an error.</remarks>
        private void ExecuteGenericParsers(HydraRingInitializationService hydraRingInitializationService, int sectionId)
        {
            lastErrorFileParser.Parse(hydraRingInitializationService.TemporaryWorkingDirectory, sectionId);
            LastErrorFileContent = lastErrorFileParser.ErrorFileContent;

            try
            {
                illustrationPointsParser.Parse(hydraRingInitializationService.TemporaryWorkingDirectory, sectionId);
                IllustrationPointsResult = illustrationPointsParser.Output;
            }
            catch (HydraRingFileParserException e)
            {
                IllustrationPointsParserErrorMessage = e.Message;
                IllustrationPointsResult             = null;
            }
        }
예제 #5
0
        public void Parse_ErrorWhileReadingFile_ThrowsHydraRingFileParserException()
        {
            // Setup
            var lastErrorFileParser = new LastErrorFileParser();

            using (new DirectoryPermissionsRevoker(lastErrorTestDataDirectory, FileSystemRights.ReadData))
            {
                // Call
                TestDelegate call = () => lastErrorFileParser.Parse(lastErrorTestDataDirectory, 1);

                // Assert
                var    exception       = Assert.Throws <HydraRingFileParserException>(call);
                string expectedMessage = $"Kan het Hydra-Ring last_error bestand {HydraRingFileConstants.LastErrorFileName} " +
                                         $"niet lezen uit de map {lastErrorTestDataDirectory}.";
                Assert.AreEqual(expectedMessage, exception.Message);
            }
        }