Exemplo n.º 1
0
        public async Task Activation(Guid activationCode)
        {
            DeveloperActivation operation = new DeveloperActivation(_AuthorityContext, activationCode);
            await operation.Do();

            await operation.CommitAsync();
        }
Exemplo n.º 2
0
 public async Task ActivationInvalidActivationCodeShouldFail()
 {
     await AssertExtensions.ThrowAsync <RequirementFailedException>(async() =>
     {
         DeveloperActivation operation = new DeveloperActivation(_fixture.Context, Guid.Empty);
         await operation.Do();
     });
 }
Exemplo n.º 3
0
        public async Task ActivationShouldSuccess()
        {
            Developer developer = await TestOperations.RegisterDeveloper(_fixture.Context);

            DeveloperActivation activationOperation = new DeveloperActivation(_fixture.Context, developer.PendingRegistrationId);
            await activationOperation.Do();

            await activationOperation.CommitAsync();

            Developer existingDeveloper = _fixture.Context.ReloadEntity <Developer>(developer.Id);

            Assert.False(existingDeveloper.IsPending);
            Assert.True(existingDeveloper.PendingRegistrationId == Guid.Empty);
        }
Exemplo n.º 4
0
        public static async Task <Developer> RegisterAndActivateDeveloper(
            AuthorityContext context,
            string password = "")
        {
            string email    = RandomData.Email();
            string username = RandomData.RandomString();

            password = password == "" ? RandomData.RandomString(12, true) : password;

            DeveloperRegistration registration = new DeveloperRegistration(context, email, username, password);
            Developer             developer    = await registration.Do();

            await registration.CommitAsync();

            DeveloperActivation activation = new DeveloperActivation(context, developer.PendingRegistrationId);
            await activation.Do();

            await activation.CommitAsync();

            return(developer);
        }
Exemplo n.º 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...");
        }