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); }
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); }
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); }
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); }
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); }
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); }
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); } }