Add tests to prove behavior when Async and non-Async method suffixes are present

This commit is contained in:
Andrew Arnott 2016-07-14 12:14:12 -07:00
Родитель eac13acffb
Коммит ff8701f03c
1 изменённых файлов: 24 добавлений и 0 удалений

Просмотреть файл

@ -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);