예제 #1
0
 private async Task SignInUser(UserRegistrationDto user)
 {
     var credentials = new UserLoginDto
     {
         Email = user.Email, Password = user.Password, RememberMe = false
     };
     await _client.PostAsync("/api/auth/login", credentials.AsStringContent());
 }
예제 #2
0
        public async Task Login_CredentialsValid_ReturnsOk()
        {
            var regInfo = new UserRegistrationDto
            {
                Email           = "*****@*****.**",
                FirstName       = "Bob",
                LastName        = "Loblaw",
                Password        = "******",
                ConfirmPassword = "******",
                Username        = "******"
            };
            var res = await _client.PostAsync("/api/users", regInfo.AsStringContent());

            var creds = new UserLoginDto
            {
                Email      = regInfo.Email,
                Password   = regInfo.Password,
                RememberMe = false
            };
            var result = await _client.PostAsync(
                "/api/auth/login", creds.AsStringContent());

            result.EnsureSuccessStatusCode();
        }