public void SetUp() { _persistanceStore = new MemoryPersistance(); _resultPersistance = new DomainResultPersistanceStore(_persistanceStore, new InProcDomainResultStoreQuery(_persistanceStore)); _id = Guid.NewGuid(); _testCommand = new TestDomainCommand { Id = _id, TrackingId = Guid.NewGuid().ToString() }; }
public void TestCommandsAreDispatchedOnCommandQueue() { DomainResult runResult = null; _resultPublisher.Setup(x => x.Publish(It.IsAny <DomainResult>())).Callback <DomainResult>(r => runResult = r); _commandQueueBus.Setup(x => x.QueueCommand(It.IsAny <ICommand>())).Verifiable(); var command = new TestDomainCommand(); _bus.Send(command); Assert.IsNotNull(runResult); Assert.IsFalse(string.IsNullOrEmpty(runResult.TrackingId)); _commandQueueBus.Verify(); }
public void TestEventResultIsAwaitedFor() { var id = Guid.NewGuid(); ITrackable sent = null; var command = new TestDomainCommand(); command.Id = id; _commandQueueBus.Setup(x => x.QueueCommand(It.IsAny <ICommand[]>())).Callback <ICommand[]>(bm => sent = bm[0] as ITrackable); _bus.SendAndWait(new TestDomainCommand { Id = id }); Assert.IsNotNull(sent); Assert.IsFalse(string.IsNullOrEmpty(sent.TrackingId)); _resultAwaiter.Verify(x => x.WaitForResults(It.IsAny <ITrackable>()), Times.Exactly(1)); }