public void dont_throw_exception_if_updating_current_trainer()
        {
            var query = new FakeTrainerQueries();

            query.AddTrainer("Cordier", "Fabrice");

            var eventStore = new FakeEventStore();
            var trainerId  = Guid.NewGuid();

            eventStore.Save(new TrainerCreated(trainerId, 1, "BOUDOUX", "Aurélien", ""));
            query.AddTrainer("BOUDOUX", "Aurélien", trainerId: trainerId);

            new UpdateTrainer(new EventBus(new EventDispatcher(), eventStore), query).Execute(trainerId, "BOUDOUX", "Aurélien", "*****@*****.**");

            eventStore.GetEvents(trainerId).Should().Contain(new TrainerUpdated(Guid.Empty, 0, "BOUDOUX", "Aurélien", "*****@*****.**"));
        }
        public void throw_exception_if_create_2_trainer_with_same_lastname_and_firstname()
        {
            var query = new FakeTrainerQueries();

            query.AddTrainer("Cordier", "Fabrice");

            Action action = () => new CreateTrainer(new EventBus(new EventDispatcher(), new FakeEventStore()), query).Execute("CORDIER", "fabrice", "");

            action.ShouldThrow <TrainerAlreadyExistsException>();
        }
        public void throw_exception_if_update_trainer_with_existing_name()
        {
            var query = new FakeTrainerQueries();

            query.AddTrainer("Cordier", "Fabrice");

            var eventStore = new FakeEventStore();
            var trainerId  = Guid.NewGuid();

            eventStore.Save(new TrainerCreated(trainerId, 1, "BOUDOXU", "Aurélien", ""));

            Action action = () => new UpdateTrainer(new EventBus(new EventDispatcher(), eventStore), query).Execute(trainerId, "cordier", "fabrice", "");

            action.ShouldThrow <TrainerAlreadyExistsException>();
        }