Add tests to prove behavior when Async and non-Async method suffixes are present
This commit is contained in:
Родитель
eac13acffb
Коммит
ff8701f03c
|
@ -261,6 +261,20 @@ public class JsonRpcTests : IDisposable
|
|||
Assert.Equal(3, result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task CanCallMethodWithAsyncSuffixInPresenceOfOneMissingSuffix()
|
||||
{
|
||||
int result = await this.clientRpc.InvokeAsync<int>(nameof(Server.MethodThatMayEndInAsync));
|
||||
Assert.Equal(4, result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task CanCallMethodOmittingAsyncSuffixInPresenceOfOneWithSuffix()
|
||||
{
|
||||
int result = await this.clientRpc.InvokeAsync<int>(nameof(Server.MethodThatMayEndIn));
|
||||
Assert.Equal(5, result);
|
||||
}
|
||||
|
||||
public class BaseClass
|
||||
{
|
||||
public string BaseMethod() => "base";
|
||||
|
@ -364,6 +378,16 @@ public class JsonRpcTests : IDisposable
|
|||
return Task.FromResult(3);
|
||||
}
|
||||
|
||||
public Task<int> MethodThatMayEndInAsync()
|
||||
{
|
||||
return Task.FromResult(4);
|
||||
}
|
||||
|
||||
public Task<int> MethodThatMayEndIn()
|
||||
{
|
||||
return Task.FromResult(5);
|
||||
}
|
||||
|
||||
public int OverloadedMethod(Foo foo)
|
||||
{
|
||||
Assert.NotNull(foo);
|
||||
|
|
Загрузка…
Ссылка в новой задаче