Skip to content

Commit

Permalink
Dispose of file access
Browse files Browse the repository at this point in the history
  • Loading branch information
mattosaurus committed Jun 8, 2022
1 parent 743a5e8 commit d135f6c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion PgpCore.Tests/UnitTests/UnitTestsAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,15 @@ public async Task VerifyAsync_DoNotVerifySignedFileWithBadContent(KeyType keyTyp
await pgp.SignFileAsync(testFactory.ContentFilePath, testFactory.EncryptedContentFilePath);
string[] fileLines = await File.ReadAllLinesAsync(testFactory.EncryptedContentFilePath);
fileLines[3] = fileLines[3].Substring(0, fileLines[3].Length - 1 - 1) + "x";
await File.WriteAllLinesAsync(testFactory.EncryptedContentFilePath, fileLines);

using (StreamWriter streamWriter = new StreamWriter(testFactory.EncryptedContentFilePath))
{
foreach (string line in fileLines)
{
streamWriter.WriteLine(line);
}
}

Func<Task<bool>> action = async () => await pgp.VerifyFileAsync(testFactory.EncryptedContentFilePath);

// Assert
Expand Down

0 comments on commit d135f6c

Please sign in to comment.