Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: refactor TestVectors into Positive and Negative Tests #628

Draft
wants to merge 5 commits into
base: mainline
Choose a base branch
from

Conversation

josecorella
Copy link
Contributor

Issue #, if available:

Description of changes:

Squash/merge commit message, if applicable:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Comment on lines +309 to 325
if (expectedPlaintext != null && exceptionHasBeenCaught)
{
testLogging.WriteLine("Decrypt Failed, and should not have!");
}

if (exceptionHolder != null && expectedPlaintext != null)
{
// Should succeed but did not, throw exception
if (exceptionHolder is System.Security.Cryptography.CryptographicException
or Org.BouncyCastle.Crypto.InvalidCipherTextException)
{
// Should succeed but did not, throw exception
throw new TestVectorShouldHaveFailedException(exceptionHolder.Message);
}

throw exceptionHolder;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am reading:

(309) if plaintext is expected and an exception has been caught: log

(314) if plaintext is expected and an exception has been stored: throw

I think that is the same behavior I had...
But I have a hard time reasoning if it is correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants