public void Setup() { var updateStorage = new InMemoryDbUpdateStorage(); this.readStorage = updateStorage; OrderAcceptedDenormalizer denormalizer = new OrderAcceptedDenormalizer(updateStorage, new EmptyLogger()); denormalizer.Consume(new OrderAccepted(orderId, "fake order")); }
public void Setup() { var updateStorage = new InMemoryDbUpdateStorage(); this.readStorage = updateStorage; ValidationOrderDenormilizer denormilizer = new ValidationOrderDenormilizer(updateStorage, new EmptyLogger()); denormilizer.Consume(new OrderValidatedByManager(managerId, orderId, "Max Cole")); }
public void Setup() { var updateStorage = new InMemoryDbUpdateStorage(); this.readStorage = updateStorage; ManagerInfoDenormalizer denormalizer = new ManagerInfoDenormalizer(updateStorage); denormalizer.Consume(new ManagerCreated(managerId, "Max", "Cole")); }
public void Setup() { var updateStorage = new InMemoryDbUpdateStorage(); updateStorage.Add(new OrderInProgress() { OrderId = orderId.ToString(), Description = "fake order", ProductName = "fake_product", Price = 1, Quantity = 10, TotalAmount = 10 }); this.readStorage = updateStorage; OrderInProgressDenormilizer denormilizer = new OrderInProgressDenormilizer(updateStorage, new EmptyLogger()); denormilizer.Consume(new OrderRejected(orderId, "fake order", "order is not valid!")); }
public void Setup() { this.eventstore = Wireup.Init() .UsingInMemoryPersistence() .UsingSynchronousDispatchScheduler() .DispatchTo(new DelegateMessageDispatcher(c => { c.Events.ForEach(dispatchedEvents.Add); c.Events.Select(m=>m.Body).ToList().ForEach(bus.Publish); })) .Build(); var aggregateRepository = new EventStoreRepository( eventstore , new AggregateFactory() ,new ConflictDetector()); var updateStorage = new InMemoryDbUpdateStorage(); this.readStorage = updateStorage; this.bus = ServiceBusFactory.New(sbc => { sbc.ReceiveFrom("loopback://localhost/test"); sbc.Subscribe(x => x.Consumer(() => new ManagerCommandHandler(aggregateRepository))); sbc.Subscribe(x => x.Consumer(() => new ManagerInfoDenormalizer(updateStorage))); }); var createManagerCommand = new CreateManager(managerId, "Max", "Cole"); bus.Publish(createManagerCommand); TaskManager taskManager = new TaskManager(TimeSpan.FromMilliseconds(500)); taskManager. When(() => this.readStorage.Items<ManagerInfo>().Any()). Then(()=>this.sync.Set()); this.sync.WaitOne(TimeSpan.FromSeconds(5)); }
public void Setup() { var updateStorage = new InMemoryDbUpdateStorage(); this.readStorage = updateStorage; OrderInProgressDenormilizer denormilizer = new OrderInProgressDenormilizer(updateStorage, new EmptyLogger()); denormilizer.Consume(new OrderPlaced(orderId, "fake order", "fake_product", 1, 10)); }