bcgit / bc-csharp

BouncyCastle.NET Cryptography Library (Mirror)
https://www.bouncycastle.org/csharp
MIT License
1.68k stars 559 forks source link

Refine FindTestResource #566

Closed Rob-Hague closed 2 months ago

Rob-Hague commented 2 months ago

Describe your changes

This was failing on the Substring call with:

"System.ArgumentOutOfRangeException : Length cannot be less than zero."

Now it is:

"System.IO.DirectoryNotFoundException : Test data directory bc-test-data not found. Test data available from: https://github.com/bcgit/bc-test-data.git"

Also add "using" declarations on the returned streams. (This requires declaring a more recent language version in the project)

How has this been tested?

Verified the relevant tests fail with the more informative exception, and pass when the test data is downloaded.

Checklist before requesting a review

See also Contributing Guidelines.

peterdettman commented 2 months ago

Merged with follow-up changes, thanks for the PR.