Ejemplo n.º 1
0
        public async Task ProjectionsShouldWorkWithEventStore()
        {
            var policy = Policy
                         .Handle <Exception>()
                         .WaitAndRetry(100, x => TimeSpan.FromMilliseconds(50));

            await Cleanup();

            var aggregateId = Guid.NewGuid();

            await AppendEvent(aggregateId);

            IProjectionSchemaRegister schema = new ProjectionSchemaRegister();

            schema.Discover(typeof(EventStoreIntegrationTests).Assembly);

            var connection = await Connect();

            UnityContainer uc = new UnityContainer();

            uc.RegisterSingleton <IRoomAvailabilityModel, RoomAvailabilityModel>();

            IServiceProvider serviceprovider = new UnityServiceProvider(uc);

            throw new NotImplementedException();
            //connection.ConfigureWithEventBus(schema.Events,serviceprovider.GetService<IEventHandlerDispatcher>(), Logger.None);

            var model = uc.Resolve <IRoomAvailabilityModel>();

            policy.Execute(() => model.Rooms.Should().HaveCount(1));

            await AppendEvent(Guid.NewGuid());

            Thread.Sleep(2000);
            policy.Execute(() => model.Rooms.Should().HaveCount(2));
        }
Ejemplo n.º 2
0
 private void PrepareProjections(Assembly[] assemblies)
 {
     _projectionSchemaRegister = new ProjectionSchemaRegister();
     _projectionSchemaRegister.Discover(assemblies);
 }