public void With_an_invalid_birth_date() { var dateOfBirth = new DateOfBirth(DateTime.Today.Date); Given(ClientRegistered()); When(client => client.CorrectDateOfBirth(dateOfBirth)); Then<DomainError>("underage"); }
public ClientDateOfBirthCorrected(ClientId clientId, DateOfBirth dateOfBirth) { Mandate.ParameterNotNull(clientId, "clientId"); Mandate.ParameterNotDefaut(dateOfBirth, "dateOfBirth"); ClientId = clientId; DateOfBirth = dateOfBirth; }
public void With_a_valid_bith_date() { var dateOfBirth = new DateOfBirth(DateTime.Today.Date.AddYears(-18)); Given(ClientRegistered()); When(client => client.CorrectDateOfBirth(dateOfBirth)); Then(new ClientDateOfBirthCorrected(DefaultClientId, dateOfBirth)); }
void IHandleClientStateTransitions.When(ClientRegistered @event) { Identity = @event.ClientId; identityNumber = @event.IdentityNumber; clientName = @event.ClientName; primaryContactNumber = @event.PrimaryContactNumber; dateOfBirth = @event.IdentityNumber.GetDateOfBirth(); }
public virtual bool Equals(DateOfBirth other) { if (null != other && other.GetType() == GetType()) { return other.Date == Date; } return false; }
public void Build(string[] args) { if (args.Length != 2) { throw new Exception(String.Format("Error. Usage is: {0}", Usage)); } ClientId = new ClientId(args[0]); DateOfBirth = new DateOfBirth(DateTime.Parse(args[1])); }
public void With_a_valid_bith_date() { DomainEvent.Current.Subscribe<ClientDateOfBirthCorrected>(Events.Handle); var dateOfBirth = new DateOfBirth(DateTime.Today.Date.AddYears(-18)); var client = DefaultClient(); client.CorrectDateOfBirth(dateOfBirth); Then(new ClientDateOfBirthCorrected(client.Identity, dateOfBirth)); }
public void With_a_valid_bith_date() { var dateOfBirth = new DateOfBirth(DateTime.Today.Date.AddYears(-18)); var client = DefaultClient(); client.CorrectDateOfBirth(dateOfBirth); var snapshot = ((IEntity)client).GetSnapshot(); ((ClientSnapshot)snapshot).DateOfBirth.ShouldBe(dateOfBirth); }
public void With_an_invalid_birth_date() { try { var dateOfBirth = new DateOfBirth(DateTime.Today.Date); var client = DefaultClient(); client.CorrectDateOfBirth(dateOfBirth); } catch (DomainError e) { e.Name.ShouldBe("underage"); throw; } }
void IHandleClientStateTransitions.When(ClientDateOfBirthCorrected @event) { dateOfBirth = @event.DateOfBirth; }
protected override void RestoreSnapshot(IMemento memento) { var snapshot = (ClientSnapshot)memento; dateOfBirth = snapshot.DateOfBirth; clientName = snapshot.ClientName; primaryContactNumber = snapshot.PrimaryContactNumber; identityNumber = snapshot.IdentityNumber; isDeceased = snapshot.IsDeceased; }
public ClientDateOfBirthCorrected(ClientId clientId, DateOfBirth dateOfBirth) { ClientId = clientId; DateOfBirth = dateOfBirth; }
void IClientState.When(ClientDateOfBirthCorrected @event) { dateOfBirth = @event.DateOfBirth; }