public IActionResult AddRole(ManagesCompetition m, int competitionId, string userId) { if (ModelState.IsValid) { var task = _competitionService.AddRole(m); task.Wait(); return(RedirectToAction("Personnel", "Admin", new { competitionId = m.CompetitionId })); } return(View()); }
public async void TestAddRole() { //Arrange await _service.AddRole(new ManagesCompetition { CompetitionId = 2, UserId = "1", Role = Role.Host }); int n = _service.GetAllRoles().Count(); //Act await _service.AddRole(new ManagesCompetition { CompetitionId = 1, UserId = "2", Role = Role.Staff }); var result = _service.GetAllRoles(); //Assert Assert.Equal(expected: 1, actual: n); Assert.Equal(expected: n + 1, actual: result.Count()); Assert.Equal(expected: 1, actual: result.Last().CompetitionId); }