public void WhenIIssueACreateElectionCommand()
        {
            //setup the "bus" components
            m_commandDispatcher = new CommandDispatcher();
            m_eventPublisher = new EventDispatcher();

            //register the command handler
            var repository = MockRepository.GenerateStub<IRepository<Election>>();
            m_commandDispatcher.Register(new MakeAnElectionCommandHandler(repository, null));

            //register the event handler
            m_eventPublisher.RegisterHandler<ElectionMadeEvent>(@event => m_electionCreatedEvent = @event);

            //wire-up the domain event to the event publisher
            DomainEvents.Register<ElectionMadeEvent>(@event => m_eventPublisher.Publish(@event));

            //create and send the command
            var command = new MakeAnElection
                              {
                                  AdministratorCode = "AdmCode",
                                  CompanyCode = "CoCode",
                                  ParticipantId = "12345",
                                  ElectionAmount = 1000,
                                  ElectionReason = "election reason",
                              };

            m_commandDispatcher.Dispatch<MakeAnElection>(command);
            
            Assert.Pass();
        }
 private void When(ElectionMadeEvent @event)
 {
     //The command has been validated and we are now going to apply
     //the state change to this instance.
     //This state transition CAN NOT FAIL now.
     //Note: this method may be called in either of these cases:
     //  1 - the command is being processed for the first time
     //  2 - the event has been replayed from the event store
     _id = new Guid(@event.Id);
     _electionAmount = @event.ElectionAmount.Dollars();
 }