public void THEN_credit_card_number_is_masked() { var expectedUser = new UserAccount("myName", "myEmail", DateTime.Parse("1990-10-10"), "123456789", "password", "4111222233337890"); UserRegistrationService service = new BuildUserRegistrationService() .ForAccount(123) .Return(expectedUser); var returnedUser = service.GetUserInformation(123); returnedUser.CreditCardNo.Should() .StartWith("41") .And.EndWith("7890") .And.HaveLength(16); }
internal RegistrationResult RegisterUser(UserAccountRequest userAccountRequest) { if (string.IsNullOrEmpty(userAccountRequest.Email) || string.IsNullOrEmpty(userAccountRequest.Name) || string.IsNullOrEmpty(userAccountRequest.Password) || userAccountRequest.DateOfBirth == DateTime.MinValue) { return new TooFewDataPassed(); } if (userAccountRequest.DateOfBirth > DateTime.UtcNow.AddYears(-16)) { return new UserIsTooYoung(); } var newCard = new UserAccount(userAccountRequest); users.Add(newCard); return new RegistrationSuccesfull(); }
public BuildUserRegistrationService Return(UserAccount user) { this.defaultUserToReturn = user; return this; }
public BuildUserRegistrationService() { defaultUserToReturn = new UserAccount("", "", new DateTime(), "", ""); }