Example #1
0
        public async Task LoginNotActivatedShouldFail()
        {
            string    password  = "******";
            Developer developer = await TestOperations.RegisterDeveloper(_fixture.Context, password);

            DeveloperLogin login  = new DeveloperLogin(_fixture.Context, developer.Email, password);
            bool           result = await login.Do();

            Assert.False(result);
        }
Example #2
0
        public async Task LoginNotActiveShouldFail()
        {
            string    password  = "******";
            Developer developer = await TestOperations.RegisterAndActivateDeveloper(_fixture.Context, password);

            developer.IsActive = false;
            _fixture.Context.Entry(developer).State = EntityState.Modified;
            await _fixture.Context.SaveChangesAsync();

            DeveloperLogin login  = new DeveloperLogin(_fixture.Context, developer.Email, password);
            bool           result = await login.Do();

            Assert.False(result);
        }
Example #3
0
        public async Task <LoginResult> Login(string email, string password)
        {
            LoginResult result = new LoginResult
            {
                IsSuccess = false
            };

            DeveloperLogin operation = new DeveloperLogin(_AuthorityContext, email, password);

            if (!await operation.Do())
            {
                return(result);
            }

            result.IsSuccess = true;
            result.Email     = email;

            Developer developer = await _AuthorityContext.Developers.FirstAsync(d => d.Email == email);

            result.Id = developer.Id;

            return(result);
        }