public void Should_return_false_from_Tick_when_no_receiver_is_registered() { var port = new StandardInputPort(1, null); port.TrySend(new InformationPacket(null)); port.Tick().ShouldBeFalse(); }
public void Should_return_true_from_Tick_when_at_least_one_packet_is_accepted() { var port = new StandardInputPort(1, null); port.Receive = data => data.Accept(); port.TrySend(new InformationPacket(null)); port.Tick().ShouldBeTrue(); }
public void Should_offer_one_IPs_if_queued_when_Tick_is_called() { var port = new StandardInputPort(1, null); var timesCalled = 0; port.TrySend(new InformationPacket(null)); port.Receive = data => ++ timesCalled; port.Tick(); timesCalled.ShouldEqual(1); }
public void Should_offer_all_IPs_if_queued_when_Tick_is_called_and_greedy_is_true() { var port = new StandardInputPort(4, null); port.Greedy = true; var timesCalled = 0; port.TrySend(new InformationPacket(null)); port.TrySend(new InformationPacket(null)); port.TrySend(new InformationPacket(null)); port.TrySend(new InformationPacket(null)); port.Receive = data => { ++timesCalled; data.Accept(); }; port.Tick(); timesCalled.ShouldEqual(4); }
public void Should_return_false_from_Tick_when_no_packets_are_sent() { var port = new StandardInputPort(1, null); port.Tick().ShouldBeFalse(); }