Beispiel #1
0
        protected override void DoSetUp()
        {
            //var configuration = Configuration.Get();


            MsSqlTestHelper.EnsureTestDatabaseExists();
            MsSqlTestHelper.DropTable("views");
            _viewManager = new MsSqlViewManager <ViewInstanceWithManyPropertyTypes>(MsSqlTestHelper.ConnectionString, MsSqlTestHelper.TestDbName, "views");
        }
Beispiel #2
0
        protected override void DoSetUp()
        {
            MsSqlTestHelper.EnsureTestDatabaseExists();

            var connectionString = MsSqlTestHelper.ConnectionString;

            MsSqlTestHelper.DropTable("views");

            _viewManager = new MsSqlViewManager <ViewInstanceWithManyPropertyTypes>(connectionString, "views");
        }
Beispiel #3
0
        protected override IViewManager <TViewInstance> CreateViewManager <TViewInstance>()
        {
            var tableName = typeof(TViewInstance).Name;

            MsSqlTestHelper.DropTable(tableName);

            var viewManager = new MsSqlViewManager <TViewInstance>(_connectionString, tableName);

            return(viewManager);
        }
        protected override IViewManager <TViewInstance> CreateViewManager <TViewInstance>(bool enableBatchDispatch = false)
        {
            var tableName = typeof(TViewInstance).Name;

            MsSqlTestHelper.DropTable(tableName);

            var viewManager = new MsSqlViewManager <TViewInstance>(_connectionString, tableName)
            {
                BatchDispatchEnabled = enableBatchDispatch
            };

            return(viewManager);
        }
Beispiel #5
0
        public void TheSnippet()
        {
            MsSqlTestHelper.DropTable("events");
            MsSqlTestHelper.DropTable("counters");

            var viewManager = new MsSqlViewManager <CounterView>(MsSqlTestHelper.ConnectionString, "counters", automaticallyCreateSchema: true);

            var processor = CreateCommandProcessor(config => config
                                                   .EventStore(e => e.UseSqlServer(MsSqlTestHelper.ConnectionString, "events", automaticallyCreateSchema: true))
                                                   .EventDispatcher(e => e.UseViewManagerEventDispatcher(viewManager))
                                                   );

            RegisterForDisposal(processor);

            processor.ProcessCommand(new IncrementCounter("id", 1));
            processor.ProcessCommand(new IncrementCounter("id", 2));
            processor.ProcessCommand(new IncrementCounter("id", 3));
            processor.ProcessCommand(new IncrementCounter("id", 5));
            processor.ProcessCommand(new IncrementCounter("id", 8));
        }
        public void AutomaticallyRegeneratesSchemaIfColumnIsMissing()
        {
            // arrange
            _viewManager = new MsSqlViewManager <SomeView>(_connectionString, "views", automaticallyCreateSchema: true);

            // schema is generated now - let's drop a column and re-initialize the view manager
            DropColumn("views", "ColumnA");

            // act
            _viewManager = new MsSqlViewManager <SomeView>(_connectionString, "views", automaticallyCreateSchema: true);

            // assert
            _viewManager.Dispatch(new ThrowingViewContext(), new[]
            {
                GetAnEvent(Guid.NewGuid(), 0),
                GetAnEvent(Guid.NewGuid(), 1)
            });

            var view = _viewManager.Load(GlobalInstanceLocator.GetViewInstanceId());

            Assert.That(view.Events, Is.EqualTo(2));
        }