mirror of
https://github.com/FabInfra/capnproto-dotnetcore_Runtime.git
synced 2025-03-12 23:01:44 +01:00
added test
This commit is contained in:
parent
bdc8240e5b
commit
be10b356aa
@ -958,7 +958,7 @@ namespace Capnp.Net.Runtime.Tests.GenImpls
|
||||
}
|
||||
}
|
||||
|
||||
class TestMoreStuffImpl3 : ITestMoreStuff
|
||||
class TestMoreStuffImpl3 : ITestMoreStuff, ITestCallOrder
|
||||
{
|
||||
readonly TaskCompletionSource<ITestInterface> _heldCap = new TaskCompletionSource<ITestInterface>();
|
||||
|
||||
@ -987,9 +987,18 @@ namespace Capnp.Net.Runtime.Tests.GenImpls
|
||||
}
|
||||
}
|
||||
|
||||
public Task<ITestCallOrder> Echo(ITestCallOrder Cap, CancellationToken cancellationToken_ = default)
|
||||
int _echoCounter;
|
||||
|
||||
public Task<ITestCallOrder> Echo(ITestCallOrder cap, CancellationToken cancellationToken_ = default)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
if (_echoCounter++ < 20)
|
||||
{
|
||||
return Task.FromResult<ITestCallOrder>(((Proxy)cap).Cast<ITestMoreStuff>(true).Echo(cap).Eager());
|
||||
}
|
||||
else
|
||||
{
|
||||
return Task.FromResult(cap);
|
||||
}
|
||||
}
|
||||
|
||||
public Task ExpectCancel(ITestInterface Cap, CancellationToken cancellationToken_ = default)
|
||||
@ -997,9 +1006,12 @@ namespace Capnp.Net.Runtime.Tests.GenImpls
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<uint> GetCallSequence(uint Expected, CancellationToken cancellationToken_ = default)
|
||||
uint _counter;
|
||||
|
||||
public Task<uint> GetCallSequence(uint expected, CancellationToken cancellationToken_ = default)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
Assert.AreEqual(_counter, expected);
|
||||
return Task.FromResult(_counter++);
|
||||
}
|
||||
|
||||
public Task<string> GetEnormousString(CancellationToken cancellationToken_ = default)
|
||||
|
@ -245,5 +245,36 @@ namespace Capnp.Net.Runtime.Tests
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SalamiTactics()
|
||||
{
|
||||
using (var server = SetupServer())
|
||||
{
|
||||
server.Main = new TestMoreStuffImpl3();
|
||||
|
||||
using (var client = SetupClient())
|
||||
{
|
||||
client.WhenConnected.Wait();
|
||||
|
||||
using (var main = client.GetMain<ITestMoreStuff>())
|
||||
{
|
||||
var echoTask = main.Echo(Proxy.Share<ITestCallOrder>(main));
|
||||
Assert.IsTrue(echoTask.Wait(MediumNonDbgTimeout));
|
||||
var echo = echoTask.Result;
|
||||
var list = new Task<uint>[1000];
|
||||
for (uint i = 0; i < list.Length; i++)
|
||||
{
|
||||
list[i] = echo.GetCallSequence(i);
|
||||
}
|
||||
Assert.IsTrue(Task.WaitAll(list, MediumNonDbgTimeout));
|
||||
for (uint i = 0; i < list.Length; i++)
|
||||
{
|
||||
Assert.AreEqual(i, list[i].Result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user