Skip to content

Commit

Permalink
Adding an acceptance for Particular/NServiceBus#1837
Browse files Browse the repository at this point in the history
  • Loading branch information
indualagarsamy authored and andreasohlund committed Dec 12, 2013
1 parent 0648efe commit e1d15a8
Showing 1 changed file with 16 additions and 8 deletions.
Expand Up @@ -8,16 +8,22 @@

public class When_publishing_an_event_using_a_broker_transport_with_centralized_routing : NServiceBusAcceptanceTest
{
[Test, Ignore("Not reliable!")]
[Test]
public void Should_be_delivered_to_allsubscribers_without_the_need_for_config()
{
Scenario.Define<Context>()
.WithEndpoint<CentralizedPublisher>(b => b.When(c => c.EndpointsStarted, (bus, context) =>
{
bus.Publish(new MyEvent());
}))
.WithEndpoint<CentralizedSubscriber1>()
.WithEndpoint<CentralizedSubscriber2>()
.WithEndpoint<CentralizedPublisher>
(b => b.Given((bus, context) => Subscriptions.OnEndpointSubscribed(s => { }))
.When(c => c.IsSubscriptionProcessedForSub1 && c.IsSubscriptionProcessedForSub2, bus => bus.Publish(new MyEvent()))
)
.WithEndpoint<CentralizedSubscriber1>(b => b.Given((bus, context) =>
{
context.IsSubscriptionProcessedForSub1 = true;
}))
.WithEndpoint<CentralizedSubscriber2>(b => b.Given((bus, context) =>
{
context.IsSubscriptionProcessedForSub2 = true;
}))
.Done(c => c.Subscriber1GotTheEvent && c.Subscriber2GotTheEvent)
.Repeat(r => r.For<AllTransportsWithCentralizedPubSubSupport>())
.Should(c =>
Expand All @@ -32,8 +38,10 @@ public void Should_be_delivered_to_allsubscribers_without_the_need_for_config()
public class Context : ScenarioContext
{
public bool Subscriber1GotTheEvent { get; set; }

public bool Subscriber2GotTheEvent { get; set; }

public bool IsSubscriptionProcessedForSub1 { get; set; }
public bool IsSubscriptionProcessedForSub2 { get; set; }
}

public class CentralizedPublisher : EndpointConfigurationBuilder
Expand Down

0 comments on commit e1d15a8

Please sign in to comment.