public void Should_not_limit_the_throughput() { const int throughputLimit = 0; TransportReceiver.ChangeMaximumMessageThroughputPerSecond(throughputLimit); TransportReceiver.Start(Address.Parse("myTest")); for (var i = 0; i < 100; i++) { fakeReceiver.FakeMessageReceived(); } Assert.AreEqual(100, fakeReceiver.NumberOfMessagesReceived); }
public void Should_limit_the_throughput_to_the_set_limit() { TransportReceiver.ChangeMaximumMessageThroughputPerSecond(ThroughputLimit); TransportReceiver.Start(Address.Parse("mytest")); ThreadPool.QueueUserWorkItem(Receive10); Thread.Sleep(600); Assert.AreEqual(ThroughputLimit, fakeReceiver.NumberOfMessagesReceived); Thread.Sleep(500); Assert.AreEqual(ThroughputLimit * 2, fakeReceiver.NumberOfMessagesReceived); }