示例#1
0
        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)
            });
        }
示例#2
0
        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);
        }
示例#3
0
        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();
            });
        }
示例#4
0
        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);
        }
示例#5
0
        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...");
        }