public void Parse_NotExistingLastErrorOutputFile_DoesNotThrowException() { // Setup var lastErrorFileParser = new LastErrorFileParser(); // Call TestDelegate call = () => lastErrorFileParser.Parse(noErrorTestDataDirectory, 1); // Assert Assert.DoesNotThrow(call); }
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); }
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); }
/// <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; } }
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); } }