public IActionResult ViewTeam(string teamName) { var _calculatedMatches = new CalculatedMatches(_httpContextAccessor.HttpContext.Session.GetString("result")); var team = _calculatedMatches.GetResults(teamName); // Team object return(PartialView("_TeamDetail", team)); }
public IActionResult CalculateMatch(string result) { _httpContextAccessor.HttpContext.Session.SetString(nameof(result), result); var _calculatedMatches = new CalculatedMatches(result); var _teams = _calculatedMatches.Teams; return(View("CalculateMatch", _teams)); }
public void HaveTheSameGoalsScored(string result, string teamName, int expected) { var mockLoadData = new Mock <ILoadData>(); mockLoadData.Setup(x => x.FromTextFile(It.IsAny <string>())) .Returns(result); var calculatedMatches = new CalculatedMatches(mockLoadData.Object, results); Team selectedTeam = calculatedMatches.GetResults(teamName); Assert.Equal(expected, selectedTeam.GoalsScored); }
public IActionResult Details(int?id) { var calculatedMatches = new CalculatedMatches(_httpContextAccessor.HttpContext.Request.Cookies["result"]); if (id == null) { return(NotFound("ID cannot be null. Please provide a valid input.")); } var team = calculatedMatches.Teams .FirstOrDefault(m => m.Id == id); if (team == null) { return(NotFound()); } return(View(team)); }
public void NotHaveTheTeamsRegistered() { var calculateMatches = new CalculatedMatches(results); Assert.False(calculateMatches.HasTeamsRegistered()); }