Created
April 20, 2012 03:18
-
-
Save ritalin/2425645 to your computer and use it in GitHub Desktop.
A Helper method converting AggregateException to the internal exception for NUnit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In CUI test runner, to use await syntax at the test code is involved skipping test. | |
// So It nessesary to wait using Task#Wait() method. | |
// In Assert#Throws method for NUnit, threfore, expected exception is not thrown but AggregateException. | |
// Following method is conversion AggregateException to the internal exception. | |
private TestDelegate ResolveAggregateException(Action inTestAction) { | |
return () => { | |
try { | |
inTestAction(); | |
} | |
catch (AggregateException ex) { | |
throw ex.InnerException; | |
} | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment