public async Task RegistrationShouldSucceed()
        {
            Product product = await TestOperations.CreateProductAndPublish(_fixture.Context);

            string email    = RandomData.Email();
            string username = RandomData.RandomString();
            string password = RandomData.RandomString(12, true);

            UserRegistration operation = new UserRegistration(_fixture.Context, product.Id, email, username, password);
            await operation.Do();

            await operation.CommitAsync();
        }
Example #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);
        }
Example #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();
            });
        }
Example #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);
        }