public void throw_error_if_trying_to_update_assignation_that_not_exists() { var history = new History(); history.Add(new TrainerCreated(Guid.NewGuid(), 1, "BOUDOUX", "Aurelien", "*****@*****.**")); var trainer = new Trainer(history); Action action = () => trainer.ChangeAssignation(new DateTime(2017, 01, 15), 10, new DateTime(2017, 02, 10), 10); action.ShouldThrow <PeriodDoNotExistsException>(); }
public void raise_assignationChanged_when_change_trainer_assignation() { var history = new History(); history.Add(new TrainerCreated(Guid.NewGuid(), 1, "BOUDOUX", "Aurelien", "*****@*****.**")); history.Add(new TrainerAssigned(Guid.NewGuid(), 2, new DateTime(2017, 01, 15), 10)); var trainer = new Trainer(history); trainer.ChangeAssignation(new DateTime(2017, 01, 15), 10, new DateTime(2017, 01, 10), 10); trainer.UncommitedEvents.GetStream().Should().Contain(new TrainerReassigned(Guid.Empty, 0, new DateTime(2017, 01, 15), 10, new DateTime(2017, 01, 10), 10)); }
public void throw_error_if_trying_to_reassign_trainer_to_an_already_assigned_session() { var history = new History(); history.Add(new TrainerCreated(Guid.NewGuid(), 1, "BOUDOUX", "Aurelien", "*****@*****.**")); history.Add(new TrainerAssigned(Guid.NewGuid(), 2, new DateTime(2017, 01, 15), 10)); history.Add(new TrainerAssigned(Guid.NewGuid(), 2, new DateTime(2017, 02, 15), 10)); var trainer = new Trainer(history); Action action = () => trainer.ChangeAssignation(new DateTime(2017, 01, 15), 10, new DateTime(2017, 02, 10), 10); action.ShouldThrow <TrainerAlreadyAssignedException>(); }