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); }
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 The_exception_should_not_disrupt_the_flow_of_messages() { CrashingService service = new CrashingService(); LocalBus.SubscribeInstance(service); LocalEndpoint.Send(new BogusMessage()); CrashingService.Received.WaitOne(5.Seconds(), true).ShouldBeTrue("No message received"); CrashingService.Received.Reset(); LocalEndpoint.Send(new LegitMessage()); CrashingService.LegitReceived.WaitOne(5.Seconds(), true).ShouldBeTrue("No message received"); }
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); }