public void ThatDontExist() { var endpoint = TestableRegisterEndpoint.Build(Session); var command = new DuplicateEmailAddressCommand { EmailAddress = "someOtherUserName" }; endpoint.ValidateEmailAddress(command).IsValid.ShouldBeTrue(); }
public void ThatExist() { var endpoint = TestableRegisterEndpoint.Build(Session); var command = new DuplicateEmailAddressCommand { EmailAddress = DefaultUser.EmailAddress }; endpoint.ValidateEmailAddress(command).IsValid.ShouldBeFalse(); }
public DuplicateEmailAddressResponse ValidateEmailAddress(DuplicateEmailAddressCommand command) { var exists = _session.Query<UserAccount>().Any(x => x.EmailAddress == command.EmailAddress); return new DuplicateEmailAddressResponse { IsValid = !exists }; }