コード例 #1
0
        public void Multiple_commands()
        {
            var container = new UnityContainer();
            var test      = new TestAggregate();

            container
            .RegisterHandlerFactoriesInAssembly <TestAggregate>()
            .RegisterInstance(test);

            var system = ActorSystem.Create("test");
            var broker = system.ActorOf(MessageRouter.Create <TestAggregate>(container), "router");

            broker.Tell(new FirstCommand());
            broker.Tell(new SecondCommand());

            Assert.That(() => test.PublishedEvents <FirstThingHappened>(), Has.Count.EqualTo(1).After(500, 50));
            Assert.That(() => test.PublishedEvents <SecondThingHappened>(), Has.Count.EqualTo(1).After(500, 50));
        }