public async Task Ping(NotAnActor peer, int counter) { await Task.Yield(); this.PingCount++; if (counter > 0) { await peer.Ping(this, counter - 1); } }
public void TestPingNotActor() { NotAnActor ping = new NotAnActor(); NotAnActor pong = new NotAnActor(); Task t = ping.Ping(pong, 10); t.Wait(); Assert.AreEqual(6, ping.PingCount); Assert.AreEqual(5, pong.PingCount); }