public async Task Register(string email, string displayName, string password) { DeveloperRegistration operation = new DeveloperRegistration(_AuthorityContext, email, displayName, password); Developer developer = await operation.Do(); await operation.CommitAsync(); await _emailService.SendDeveloperActivation(developer.Email, new DeveloperActivationModel { ActivationUrl = string.Format(_configuration.DeveloperActivationUrlTemplate, developer.PendingRegistrationId) }); }
public static async Task <Developer> RegisterDeveloper(AuthorityContext context, string password = "") { string email = RandomData.Email(); string username = RandomData.RandomString(); password = password == "" ? RandomData.RandomString(12, true) : password; DeveloperRegistration operation = new DeveloperRegistration(context, email, username, password); Developer developer = await operation.Do(); await operation.CommitAsync(); return(developer); }
public async Task RegistrationDuplicateUserShouldFail() { string email = RandomData.Email(); string username = RandomData.RandomString(); string password = RandomData.RandomString(12, true); DeveloperRegistration operation = new DeveloperRegistration(_fixture.Context, email, username, password); Developer developer = await operation.Do(); await operation.CommitAsync(); await AssertExtensions.ThrowAsync <RequirementFailedException>(async() => { DeveloperRegistration failOperation = new DeveloperRegistration(_fixture.Context, email, username, password); Developer failDeveloper = await failOperation.Do(); }); }
public async Task RegistrationShouldSuccess() { string email = RandomData.Email(); string username = RandomData.RandomString(); string password = RandomData.RandomString(12, true); DeveloperRegistration operation = new DeveloperRegistration(_fixture.Context, email, username, password); Developer developer = await operation.Do(); await operation.CommitAsync(); Developer developerInDb = await _fixture.Context.Developers .FirstOrDefaultAsync(d => d.Id == developer.Id); Assert.NotNull(developerInDb); Assert.Equal(developerInDb.DisplayName, username); }
static void Main(string[] args) { AuthorityContext context = new AuthorityContext(); DeveloperRegistration registration = new DeveloperRegistration(context, "*****@*****.**", "ireiter", "almabeka"); Developer dev = registration.Do().Result; registration.Commit(); DeveloperActivation activation = new DeveloperActivation(context, dev.PendingRegistrationId); activation.Do().Wait(); activation.Commit(); CreateProduct create = new CreateProduct(context, dev.Id, "Awsome", "http://alma.com", "*****@*****.**", "http://alma.com"); Guid id = create.Do().Result; create.Commit(); int max = 1000000; for (int i = 0; i < 1000000; ++i) { Console.WriteLine("Creating user {0}/{1}", i + 1, max); string email = Guid.NewGuid() + "@test.com"; UserRegistration userReg = new UserRegistration(context, id, email, email, "12Budapest99"); var user = userReg.Do().Result; userReg.Commit(); Console.WriteLine("User created"); } //context.Database.Delete(); Console.WriteLine("Done..."); }