Tidy up test
This commit is contained in:
parent
8c36d75d91
commit
cf4ce5d5a2
@ -87,12 +87,12 @@ namespace Ben.Demystifier.Test
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DemistifiesMethodWithAsyncLambda()
|
||||
public async Task DemistifiesMethodWithAsyncLambda()
|
||||
{
|
||||
Exception dex = null;
|
||||
try
|
||||
{
|
||||
MethodWithAsyncLambda();
|
||||
await MethodWithAsyncLambda();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -106,9 +106,9 @@ namespace Ben.Demystifier.Test
|
||||
|
||||
var expected = string.Join(string.Empty,
|
||||
"System.ArgumentException: Value does not fall within the expected range.",
|
||||
" at async void Ben.Demystifier.Test.MethodTests.MethodWithAsyncLambda()+(?) => { }",
|
||||
" at void Ben.Demystifier.Test.MethodTests.MethodWithAsyncLambda()",
|
||||
" at void Ben.Demystifier.Test.MethodTests.DemistifiesMethodWithAsyncLambda()");
|
||||
" at async Task Ben.Demystifier.Test.MethodTests.MethodWithAsyncLambda()+(?) => { }",
|
||||
" at async Task Ben.Demystifier.Test.MethodTests.MethodWithAsyncLambda()",
|
||||
" at async Task Ben.Demystifier.Test.MethodTests.DemistifiesMethodWithAsyncLambda()");
|
||||
|
||||
Assert.Equal(expected, trace);
|
||||
}
|
||||
@ -123,10 +123,15 @@ namespace Ben.Demystifier.Test
|
||||
action();
|
||||
}
|
||||
|
||||
private void MethodWithAsyncLambda()
|
||||
private async Task MethodWithAsyncLambda()
|
||||
{
|
||||
Func<Task> action = async () => throw new ArgumentException();
|
||||
action().ConfigureAwait(false).GetAwaiter().GetResult();
|
||||
Func<Task> action = async () =>
|
||||
{
|
||||
await Task.Delay(0);
|
||||
throw new ArgumentException();
|
||||
};
|
||||
|
||||
await action();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user