public async Task When_authorizing_session() { var userInfo = new UserInfo { Email = "*****@*****.**", FirstName = "FirstName1", Guid = Guid.NewGuid(), LastName = "LastName1", Password = "******" }; await userRepository.InsertUserAsync(userInfo.FirstName, userInfo.LastName, userInfo.Email); var result = await sessionsRepository.AuthorizeSessionAsync(userInfo); Assert.True(result); await userRepository.RemoveUserAsync(userInfo); await sessionsRepository.RemoveSessionAsync(userInfo.Email); }
public async Task RemoveUserAsync(UserInfo userInfo) { var authorizedUsersRepository = new SessionsRepository(); var email = userInfo.Email; await authorizedUsersRepository.RemoveSessionAsync(email); databaseConnection.GetNewConnection(); await using (databaseConnection.DbConnection) { var sql = $"DELETE FROM Users WHERE email = @email;"; await databaseConnection.DbConnection.ExecuteAsync(sql, new { email }); } }