public void Reading_without_receiving_should_return_the_same_set_of_messages() { LocalEndpoint.Send(new PingMessage()); int count = 0; foreach (var selector in LocalEndpoint.SelectiveReceive(1.Seconds())) { object message = selector.DeserializeMessage(); Assert.IsInstanceOfType(typeof(PingMessage), message); count++; } int secondCount = 0; foreach (var selector in LocalEndpoint.SelectiveReceive(1.Seconds())) { object message = selector.DeserializeMessage(); Assert.IsInstanceOfType(typeof(PingMessage), message); secondCount++; } Assert.AreEqual(1, count); Assert.AreEqual(1, secondCount); }
private void PurgeEndpoint() { foreach (var selector in LocalEndpoint.SelectiveReceive(10.Milliseconds())) { selector.AcceptMessage(); } }
public void Reading_from_an_empty_queue_should_just_return_an_empty_enumerator() { int count = 0; foreach (var selector in LocalEndpoint.SelectiveReceive(1.Seconds())) { selector.AcceptMessage(); count++; } Assert.AreEqual(0, count); }
public void Reading_a_single_message_should_return_one_message_selector() { LocalEndpoint.Send(new PingMessage()); int count = 0; foreach (var selector in LocalEndpoint.SelectiveReceive(1.Seconds())) { selector.AcceptMessage(); count++; } Assert.AreEqual(1, count); }
public void Receiving_the_message_and_accepting_it_should_make_it_go_away() { LocalEndpoint.Send(new PingMessage()); foreach (var selector in LocalEndpoint.SelectiveReceive(1.Seconds())) { object message = selector.DeserializeMessage(); Assert.IsInstanceOfType(typeof(PingMessage), message); Assert.IsTrue(selector.AcceptMessage()); } int count = 0; foreach (var selector in LocalEndpoint.SelectiveReceive(1.Seconds())) { count++; } Assert.AreEqual(0, count); }