public void Setup() { factory = MockRepository.GenerateStub <IFailedMessagesStoreFactory>(); domainEvents = MockRepository.GenerateStub <IDomainEvents>(); service = new FailedMessagesService(factory, domainEvents); store = MockRepository.GenerateStub <IFailedMessagesStore>(); store.Stub(x => x.GetAllMessages()).Return(new List <FailedMessage>()); factory.Stub(x => x.CreateFailedMessagesStore(adressOfFailedMessagesStore)).Return(store); }
public void GetAllMessages_should_aggregate_all_message_stores() { var adressOfAnotherFailedMessagesStore = "124"; var anotherStore = MockRepository.GenerateStub <IFailedMessagesStore>(); factory.Stub(x => x.CreateFailedMessagesStore(adressOfAnotherFailedMessagesStore)).Return(anotherStore); anotherStore.Stub(x => x.GetAllMessages()).Return(new List <FailedMessage> { new FailedMessage { Id = "2" }, new FailedMessage { Id = "3" } }); service.MonitorFailedMessagesStores(adressOfFailedMessagesStore); service.MonitorFailedMessagesStores(adressOfAnotherFailedMessagesStore); service.GetAllMessages().Count().ShouldEqual(2); }
public void Setup() { factory = MockRepository.GenerateStub<IFailedMessagesStoreFactory>(); domainEvents = MockRepository.GenerateStub<IDomainEvents>(); service = new FailedMessagesService(factory, domainEvents); store = MockRepository.GenerateStub<IFailedMessagesStore>(); store.Stub(x => x.GetAllMessages()).Return(new List<FailedMessage>()); factory.Stub(x => x.CreateFailedMessagesStore(adressOfFailedMessagesStore)).Return(store); }