-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Add to Test
public Type ExpectedException => (Type) attrsByName["ExpectedExceptionAttribute"].FirstOrDefault()?.ConstructorArguments?.First().Value;
...
public static IEnumerable<Test> Tests(MethodInfo method)
{
var attrsByName = method.CustomAttributes.ToLookup(a => a.AttributeType.Name);
// check test cases first just in case someone adds the TestAttribute as well
if (attrsByName["TestCaseAttribute"].Any())
{
foreach (var testCase in attrsByName["TestCaseAttribute"])
{
yield return new TestCase(method, attrsByName, testCase);
}
}
else if (attrsByName.IsTest())
{
yield return new Test(method, attrsByName);
}
}
Add to TestRunner RunTestMethod:
catch (Exception ex) when (ex.GetType() == test.ExpectedException)
{
Pass();
}
catch (TargetInvocationException ex) when (ex.InnerException.GetType() == test.ExpectedException)
{
Pass();
}
Add to TestRunner WaitForAsyncTestToComplete:
catch (AggregateException ex) when (ex.InnerException.GetType() == test.ExpectedException)
{
Pass();
}
catch (AggregateException ex) when (ex.InnerException is TargetInvocationException eio && eio.InnerException.GetType() == test.ExpectedException)
{
Pass();
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels