Exemplo n.º 1
0
        protected override void DoSetUp()
        {
            _factory = RegisterForDisposal(new TFactory());

            //brett
            _context = RegisterForDisposal(base.CreateTestContext()); // RegisterForDisposal(TestContext.Create());
        }
 protected override TestContext CreateContext()
 {
     serializer = new FunnySerializer();
     return(TestContext.With()
            .Options(x => x.UseCustomDomainEventSerializer(serializer))
            .Create());
 }
Exemplo n.º 3
0
        protected override void DoSetUp()
        {
            CirqusLoggerFactory.Current = new ConsoleLoggerFactory(minLevel: Logger.Level.Warn);

            _factory = RegisterForDisposal(new TFactory());
            _context = RegisterForDisposal(TestContext.Create());

            _context.AddViewManager(_factory.GetViewManager <ViewRoot>());
        }
 public void CanDoItPrivately()
 {
     TestContext.With().Create();
     using (var context = TestContext.Create())
     {
         context.ProcessCommand(new Commando("hej"));
         context.ProcessCommand(new Commando("hej"));
         context.ProcessCommand(new Commando("hej"));
     }
 }
Exemplo n.º 5
0
        protected override void DoSetUp()
        {
            _commandProcessor = CreateCommandProcessor(config => config
                                                       .EventStore(e => e.Register <IEventStore>(c =>
            {
                _inMemoryEventStore = new InMemoryEventStore();
                return(_inMemoryEventStore);
            })));

            _context = CreateTestContext();
        }
        protected override void DoSetUp()
        {
            _commandProcessor = CommandProcessor.With()
                                .EventStore(e => e.Register(c =>
            {
                _inMemoryEventStore = new InMemoryEventStore();
                return(_inMemoryEventStore);
            }))
                                .Create();

            _context = TestContext.Create();
        }
Exemplo n.º 7
0
        public void CanDecorateAggregateRootRepositoryForTestContext()
        {
            var decorated = true;

            TestContext.With()
            .AggregateRootRepository(x => x.Decorate(c =>
            {
                decorated = true;
                return(c.Get <IAggregateRootRepository>());
            }))
            .Create();

            Assert.True(decorated);
        }
        protected override void DoSetUp()
        {
            CirqusLoggerFactory.Current = new ConsoleLoggerFactory(minLevel: Logger.Level.Info);

            MsSqlTestHelper.EnsureTestDatabaseExists();
            MsSqlTestHelper.DropTable("__MigrationHistory");
            MsSqlTestHelper.DropTable("SomeParent_Position");
            MsSqlTestHelper.DropTable("AnotherChilds");
            MsSqlTestHelper.DropTable("SomeChilds");
            MsSqlTestHelper.DropTable("SomeParent");

            _viewManager = new EntityFrameworkViewManager <SomeParent>(MsSqlTestHelper.ConnectionString);

            _context = TestContext.Create()
                       .AddViewManager(_viewManager);

            RegisterForDisposal(_context);
        }
Exemplo n.º 9
0
        public void NoProblemoWithTestContext()
        {
            // arrange
            var context = RegisterForDisposal(TestContext.Create());

            try
            {
                // make sure all roots exist
                Console.WriteLine("Processing initial two commands");
                context.ProcessCommand(new DoSomethingToABunchOfRootsCommand("id1"));
                context.ProcessCommand(new DoSomethingToABunchOfRootsCommand("id2"));

                // act
                Console.WriteLine("\r\n\r\nActing...");
                context.ProcessCommand(new DoSomethingToABunchOfRootsCommand("id1", "id2"));
            }
            finally
            {
                context.History.WriteTo(Console.Out);
            }
            // assert
        }
Exemplo n.º 10
0
        protected override void DoSetUp()
        {
            var commandMappings = new CommandMappings()
                                  .Map <RawRootCommand>((context, command) =>
            {
                var instance = context.TryLoad <Root>(command.AggregateRootId)
                               ?? context.Create <Root>(command.AggregateRootId);

                instance.DoStuff();
            })
                                  .Map <AnotherRawRootCommand>((context, command) =>
            {
                var instance = context.TryLoad <Root>(command.AggregateRootId)
                               ?? context.Create <Root>(command.AggregateRootId);

                instance
                .DoStuff()
                .DoStuff();

                var otherInstance = context.TryLoad <Root>(command.AggregateRootId + "w00t!")
                                    ?? context.Create <Root>(command.AggregateRootId + "w00t!");

                otherInstance
                .DoStuff()
                .DoStuff()
                .DoStuff();
            });

            _realCommandProcessor = CommandProcessor.With()
                                    .EventStore(e => e.Register <IEventStore>(c => new InMemoryEventStore()))
                                    .Options(o => o.AddCommandMappings(commandMappings))
                                    .Create();

            RegisterForDisposal(_realCommandProcessor);

            _fakeCommandProcessor = TestContext.With()
                                    .Options(x => x.AddCommandMappings(commandMappings))
                                    .Create();
        }
 protected override void DoSetUp()
 {
     _context = RegisterForDisposal(TestContext.Create());
 }