Skip to content

Instantly share code, notes, and snippets.

@ritalin
Created April 20, 2012 03:18
Show Gist options
  • Save ritalin/2425645 to your computer and use it in GitHub Desktop.
Save ritalin/2425645 to your computer and use it in GitHub Desktop.
A Helper method converting AggregateException to the internal exception for NUnit
// 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