public void FailsWhenThePasswordIsTooShort(string empty) { Action signingUp = () => unauthenticatedTogglApi .User .SignUp(RandomEmail.GenerateValid(), empty.ToPassword(), true, 237, "Europe/Tallinn") .Wait(); signingUp.Should().Throw <BadRequestException>(); }
public void FailsIfUserDoesNotExist() { var api = TogglApiWith(Credentials.None); var email = RandomEmail.GenerateValid(); Action resetInvalidEmail = () => api.User.ResetPassword(email).Wait(); resetInvalidEmail.Should().Throw <BadRequestException>(); }
public async Task FailsWhenSigningUpWithTheSameEmailAndPasswordForTheSecondTime() { var email = RandomEmail.GenerateValid(); var password = "******".ToPassword(); await unauthenticatedTogglApi.User.SignUp(email, password, true, 237, null); Action secondSigningUp = () => unauthenticatedTogglApi.User.SignUp(email, password, true, 237, null).Wait(); secondSigningUp.Should().Throw <EmailIsAlreadyUsedException>(); }
public async Task CreatesANewUserAccount() { var emailAddress = RandomEmail.GenerateValid(); var user = await unauthenticatedTogglApi .User .SignUp(emailAddress, "somePassword".ToPassword(), true, 237, "Europe/Tallinn"); user.Email.Should().Be(emailAddress); }
public async Task SucceedsForAPasswordConsistingOfOnlyWhiteCharactersWhenItIsLongEnough(string seeminglyEmpty) { var email = RandomEmail.GenerateValid(); var user = await unauthenticatedTogglApi .User .SignUp(email, seeminglyEmpty.ToPassword(), true, 237, "Europe/Tallinn"); user.Id.Should().BeGreaterThan(0); user.Email.Should().Be(email); }
public async Task FailsForNonSupportedTimezone() { var email = RandomEmail.GenerateValid(); var password = "******".ToPassword(); Action signingUp = () => unauthenticatedTogglApi .User .SignUp(email, password, true, 237, "A-made-up-tz") .Wait(); signingUp.Should().Throw <BadRequestException>(); }
public void FailsIfCountryIdIsNotValid(int countryId) { var email = RandomEmail.GenerateValid(); var password = "******".ToPassword(); Action signingUp = () => unauthenticatedTogglApi .User .SignUp(email, password, true, countryId, null) .Wait(); signingUp.Should().Throw <BadRequestException>(); }
public async Task FailsWhenTheEmailIsAlreadyTaken() { var email = RandomEmail.GenerateValid(); await unauthenticatedTogglApi.User.SignUp(email, "somePassword".ToPassword(), true, 237, "Europe/Tallinn"); Action secondSigningUp = () => unauthenticatedTogglApi .User .SignUp(email, "thePasswordIsNotImportant".ToPassword(), true, 237, "Europe/Tallinn") .Wait(); secondSigningUp.Should().Throw <EmailIsAlreadyUsedException>(); }
public async Task FailsForNonSupportedTimezone() { var email = RandomEmail.GenerateValid(); var password = "******".ToPassword(); var user = await unauthenticatedTogglApi .User .SignUp(email, password, true, 237, ""); user.Id.Should().BeGreaterThan(0); user.Email.Should().Be(email); }
public async Task SucceedsForValidCountryId(int countryId) { var email = RandomEmail.GenerateValid(); var password = "******".ToPassword(); var termsNotAccepted = true; var user = await unauthenticatedTogglApi .User .SignUp(email, password, termsNotAccepted, countryId, null); user.Id.Should().BeGreaterThan(0); user.Email.Should().Be(email); }
public async Task EnablesLoginForTheNewlyCreatedUserAccount() { var emailAddress = RandomEmail.GenerateValid(); var password = Guid.NewGuid().ToString().ToPassword(); var signedUpUser = await unauthenticatedTogglApi.User.SignUp(emailAddress, password, true, 237, null); var credentials = Credentials.WithPassword(emailAddress, password); var togglApi = TogglApiWith(credentials); var user = await togglApi.User.Get(); signedUpUser.Id.Should().Be(user.Id); }
public void FailsIfUserDidNotAcceptTermsAndConditions() { var email = RandomEmail.GenerateValid(); var password = "******".ToPassword(); var termsAccepted = false; var countryId = 237; Action signingUpWithoutAcceptingTerms = () => unauthenticatedTogglApi.User .SignUp(email, password, termsAccepted, countryId, null) .Wait(); signingUpWithoutAcceptingTerms.Should().Throw <BadRequestException>(); }
public async Task SucceedsForSupportedTimezone() { var email = RandomEmail.GenerateValid(); var password = "******".ToPassword(); var timezones = unauthenticatedTogglApi.Timezones.GetAll().Wait(); var aRandomSupportTimezone = timezones.OrderBy(s => Guid.NewGuid()).First(); var user = await unauthenticatedTogglApi .User .SignUp(email, password, true, 237, aRandomSupportTimezone); user.Id.Should().BeGreaterThan(0); user.Email.Should().Be(email); }