public void Install(IWindsorContainer container, IConfigurationStore store) { container.Register(Component .For <IMessageConsumer <MakeReservationCommand> >() .UsingFactoryMethod(k => { var guard = k.Resolve <CapacityGuard>(); var first = new CompositeMessageConsumer <MakeReservationCommand>(guard, k.Resolve <ReservationWriter>(), k.Resolve <AcceptingReservationConsumer>()); var second = k.Resolve <RejectingReservationConsumer>(); return(new ConditionalMessageConsumer <MakeReservationCommand>(guard.HasCapacity, first, second)); })); container.Register(Component .For <IMessageConsumer <ReservationAcceptedEvent> >() .ImplementedBy <AcceptedReserverationMailer>()); container.Register(Component .For <IMessageConsumer <ReservationRejectedEvent> >() .ImplementedBy <RejectedReservationMailer>()); container.Register(Component .For <IMessageConsumer <SoldOutEvent> >() .ImplementedBy <MonthViewModelUpdater>()); container.Register(Component .For <ReservationWriter>()); container.Register(Component .For <AcceptingReservationConsumer>()); container.Register(Component .For <RejectingReservationConsumer>()); }
public void ConsumeConsumesAllConsumers(CompositeMessageConsumer <T> sut, T message) { sut.Consume(message); var mocks = (from c in sut.Consumers select Mock.Get(c)).ToList(); mocks.ForEach(m => m.Verify(c => c.Consume(message))); }
public void ConsumersIsCorrect([Frozen] IMessageConsumer <T>[] consumers, CompositeMessageConsumer <T> sut) { Assert.True(consumers.SequenceEqual(sut.Consumers)); }
public void SutIsMessageConsumer(CompositeMessageConsumer <T> sut) { Assert.IsAssignableFrom <IMessageConsumer <T> >(sut); }