public static void ClassInitialise(TestContext context) { bus = new InProcessBus(DispatchStrategy.Synchronous); client = new SomeAwesomeUi(bus); store = Wireup.Init().UsingInMemoryPersistence().Build(); var repository = new EventStoreRepository(store, new AggregateFactory(), new ConflictDetector()); var handler = new CreateAccountCommandHandler(repository); bus.Subscribe(handler); accountId = client.CreateNewAccount(); }
// Here, I'm wiring up my MemBus instance and telling it how to resolve my subscribers // MemBus also has an awesome way to resolve subscribers from an IoC container. In prod, // I'll wire my subscribers into StructureMap and have MemBus resolve them from there. // I'm also initializing my awesome test client UI which, if you'll recall from way back at the start // simply publishes commands to my MemBus instance (and, again, it could be whatever) public SynchronousDispatchTests() { this.bus = new InProcessBus(DispatchStrategy.Synchronous); #pragma warning disable 0618 this.store = Wireup.Init() .UsingInMemoryPersistence() .UsingSynchronousDispatchScheduler() .DispatchTo(new DelegateMessageDispatcher(c => MassTransitDispatcher.DispatchCommit(this.bus, c))) .Build(); #pragma warning restore 0618 this.repository = new EventStoreRepository(this.store, new AggregateFactory(), new ConflictDetector()); var handler = new CreateAccountCommandHandler(this.repository); this.bus.Subscribe(handler); this.client = new SomeAwesomeUi(this.bus); }
public void TestInitialise() { bus = A.Fake <IBus>(); sut = new SomeAwesomeUi(bus); }