public void TestMessageSend()
        {
            InitializerWireUp wireUp = new InitializerWireUpBuilder()
                .LoadAssemblyPrefix("GHI")
                .ShouldRunDefault(true)
                .WithAssemblyNotReferencedToLoad("GHI.EventRepository.Impl")
                .WithAssemblyNotReferencedToLoad("GHI.Bus.InMemory");

            IContainer container = (IContainer) ObjectFactory.GetInstance(typeof(IContainer));
            AggregateRootInspector inspector = (AggregateRootInspector) container.GetInstance<IHandlerResolver>();
            inspector.InspectAggregateRoot(typeof(TestAggregateRoot));
            IMessagePublisher publisher = container.GetInstance<IMessagePublisher>();
            Guid id = Guid.NewGuid();
            publisher.SendMessage(new CreateNewTestAggregateRootCommand(id));

            IRequestResponseClient requestResponseClient = container.GetInstance<IRequestResponseClient>();
            GetTestAggregateRootResponse response = (GetTestAggregateRootResponse) requestResponseClient.SendRequest<GetTestAggregateRootResponse>(new GetTestAggregateRootRequest(id));

            publisher.SendMessage(new ChangeAddressCommand(id, "test"));
            publisher.SendMessage(new ChangeAddressCommand(id, "test"));
            publisher.SendMessage(new ChangeAddressCommand(id, "SnapshotTime"));
            publisher.SendMessage(new ChangeAddressCommand(id, "test"));
            publisher.SendMessage(new ChangeAddressCommand(id, "test"));

            Assert.AreEqual(id,response.Id);
        }
        public void TestSend()
        {
            InitializerWireUp wireUp = new InitializerWireUpBuilder()
                .LoadAssemblyPrefix("GHI")
                .WithAssemblyNotReferencedToLoad("GHI.EventRepository.Impl")
                .WithAssemblyNotReferencedToLoad("GHI.Bus.ZeroMQ")
                .ShouldRunDefault(true);

            IContainer container = (IContainer)ObjectFactory.GetInstance(typeof(IContainer));
            IMessagePublisher publisher = container.GetInstance<IMessagePublisher>();

            IMessageSubscriber subscriber = container.GetInstance<IMessageSubscriber>();

            Guid id = Guid.NewGuid();
            Thread.Sleep(2000);
            publisher.SendMessage(new CreateNewTestAggregateRootCommand(id));
            publisher.SendMessage(new ChangeAddressCommand(id, "test"));
            publisher.SendMessage(new ChangeAddressCommand(id, "test"));
            publisher.SendMessage(new ChangeAddressCommand(id, "SnapshotTime"));
            publisher.SendMessage(new ChangeAddressCommand(id, "test"));
            publisher.SendMessage(new ChangeAddressCommand(id, "test"));

            Thread.Sleep(5000);
            subscriber.Dispose();
            publisher.Dispose();
        }
        public void TestAggregateRootMapping()
        {
            InitializerWireUp wireUp = new InitializerWireUpBuilder()
                .LoadAssemblyPrefix("GHI")
                .ShouldRunDefault(true)
                .WithAssemblyNotReferencedToLoad("GHI.EventRepository.Impl")
                .WithAssemblyNotReferencedToLoad("GHI.Bus.InMemory");

            IContainer container = (IContainer)ObjectFactory.GetInstance(typeof(IContainer));
            IRepository<Guid> repository = container.GetInstance<IRepository<Guid>>();
            IUnitOfWorkFactory unitOfWorkFactory = container.GetInstance<IUnitOfWorkFactory>();

            AggregateRootInspector inspector = new AggregateRootInspector(unitOfWorkFactory, container, repository);
            inspector.InspectAggregateRoot(typeof(TestAggregateRoot));

            Guid aggregateId = Guid.NewGuid();
            inspector.ExecuteHandler(new CreateNewTestAggregateRootCommand(aggregateId));
            inspector.ExecuteHandler(new ChangeAddressCommand(aggregateId, "testAddress"));
        }