public void InvalidNonExistentAccountLoginFail(TeamLoginPost teamLoginPost) { // DI of team login var _context = new ApiGatewayContext(); var teamLoginService = new TeamLoginService(_context); var jwtService = new JWTService(); var teamLoginManager = new TeamLoginManager(teamLoginService, jwtService); // Act login for the registered user. var loginresp = teamLoginManager.TeamLogin(teamLoginPost); // Assert that login fail Assert.IsFalse(loginresp.Status); }
public void InvalidTeamLoginWrongUsernameFail(TeamRegisterPost teamRegisterPost, TeamLoginPost teamLoginPost) { // Arrange DI of objects var _context = new ApiGatewayContext(); var teamRegistrationService = new TeamRegistrationService(_context); var urlValidationService = new UrlValidationService(_context); var teamRegistrationManager = new TeamRegistrationManager(teamRegistrationService, urlValidationService); var creatTeamStatus = teamRegistrationManager.CreateTeamAccount(teamRegisterPost); // Assert that team creation is successfull Assert.IsTrue(creatTeamStatus.TeamCreate); // DI of team login var teamLoginService = new TeamLoginService(_context); var jwtService = new JWTService(); var teamLoginManager = new TeamLoginManager(teamLoginService, jwtService); // Act login for the registered user. var loginresp = teamLoginManager.TeamLogin(teamLoginPost); // Assert that login fail Assert.IsFalse(loginresp.Status); // Cleanup the team var createdTeam = _context.Team. Where(t => teamRegisterPost.Username == t.Username). FirstOrDefault(); if (createdTeam == null) { // Failed to delete Assert.IsTrue(false); } _context.Team.Remove(createdTeam); _context.SaveChanges(); }
public TeamLoginManager(TeamLoginService teamLoginService, JWTService jwtService) { _teamLoginService = teamLoginService; _JWTService = jwtService; }