Example #1
0
        public void TestRawApplicationPerformance(int numberOfEvents, int numberOfHydrations)
        {
            const string aggregateRootId = "bim";

            using (var context = TestContext.With().Options(x => x.Asynchronous()).Create())
            {
                Console.WriteLine("Saving {0} to history of '{1}'", numberOfEvents, aggregateRootId);

                using (var printer = new Timer(2000))
                {
                    var inserts = 0;
                    printer.Elapsed += delegate { Console.WriteLine("{0} events saved...", inserts); };
                    printer.Start();

                    foreach (var e in Enumerable.Range(0, numberOfEvents).Select(i => new SomeEvent(string.Format("Event {0}", i))))
                    {
                        context.Save(aggregateRootId, e);
                        inserts++;
                    }
                }

                Console.WriteLine("Hydrating {0} times", numberOfHydrations);
                var stopwatch = Stopwatch.StartNew();
                numberOfHydrations.Times(() =>
                {
                    using (var uow = context.BeginUnitOfWork())
                    {
                        var instance = uow.Load <SomeAggregate>(aggregateRootId);
                    }
                });

                var elapsed = stopwatch.Elapsed;
                Console.WriteLine("Elapsed total: {0}, hydrations/s: {1:0.0}", elapsed, numberOfHydrations / elapsed.TotalSeconds);
            }
        }
Example #2
0
        protected void Configure(Action <IOptionalConfiguration <TestContext> > configurator)
        {
            var configuration = TestContext.With();

            configurator(configuration);
            Context = configuration.Create();
        }
Example #3
0
        protected override void DoSetUp()
        {
            CirqusLoggerFactory.Current = new ConsoleLoggerFactory(minLevel: Logger.Level.Debug);

            _factory = RegisterForDisposal(new TFactory());

            _context = RegisterForDisposal(
                TestContext.With()
                .Options(x => x.Asynchronous())
                .Create());
        }
Example #4
0
        protected override void DoSetUp()
        {
            _factory = RegisterForDisposal(new TFactory());

            _globalInstanceViewManager           = _factory.GetViewManager <GlobalInstanceViewInstance>();
            _instancePerAggregateRootViewManager = _factory.GetViewManager <InstancePerAggregateRootView>();

            _context = RegisterForDisposal(
                TestContext.With()
                .Options(x => x.Asynchronous())
                .Create());
        }
Example #5
0
        protected override void DoSetUp()
        {
            CirqusLoggerFactory.Current = new ConsoleLoggerFactory(minLevel: Logger.Level.Warn);

            _factory     = RegisterForDisposal(new TFactory());
            _viewManager = _factory.GetViewManager <View>();

            _context = RegisterForDisposal(
                TestContext.With()
                .EventDispatcher(x => x.UseViewManagerEventDispatcher(_viewManager).WithMaxDomainEventsPerBatch(10))
                .Options(x => x.Asynchronous())
                .Create());
        }
Example #6
0
        protected override void DoSetUp()
        {
            CirqusLoggerFactory.Current = new ConsoleLoggerFactory(minLevel: Logger.Level.Warn);

            _factory = RegisterForDisposal(new TFactory());

            _context = RegisterForDisposal(
                TestContext.With()
                .Options(x => x.Asynchronous())
                .Create());

            _viewManager = _factory.GetViewManager <PurgeTestView>();
            _context.AddViewManager(_viewManager);
        }
Example #7
0
        protected override void DoSetUp()
        {
            CirqusLoggerFactory.Current = new ConsoleLoggerFactory(minLevel: Logger.Level.Warn);

            _factory = RegisterForDisposal(new TFactory());

            _context = RegisterForDisposal(
                TestContext.With()
                .Options(x => x.Asynchronous())
                .Create());

            _viewManager1 = _factory.GetViewManager <ViewThatSubscribesToEvents>();
            _viewManager2 = _factory.GetViewManager <ViewThatSubscribesToAggregateRootEvent>();
            _viewManager3 = _factory.GetViewManager <ViewThatSubscribesToAllEvents>();

            _context
            .AddViewManager(_viewManager1)
            .AddViewManager(_viewManager2)
            .AddViewManager(_viewManager3);
        }