public void Init() { // setup _competitions = new List<Competition>() { new Competition(){Competition_Id = 1,Competition_Name = "WorldCup"}, new Competition(){Competition_Id = 2,Competition_Name = "AsiaCup"}, new Competition(){Competition_Id = 3,Competition_Name = "AfricaCup"}, }; _competition = new Competition() {Competition_Id = 1, Competition_Name = "WorldCup"}; _mockCompetitionService = new Mock<ICompetitionService>(); _mockCompetitionService.Setup(obj => obj.GetCompetitions()).Returns(_competitions.ToList()); _mockCompetitionService.Setup(obj => obj.GetCompetitionById(1)).Returns(_competition); }
/// <summary> /// Updates the competition /// </summary> /// <param name="competition">Competition</param> public bool UpdateCompetition(Competition competition) { if (competition == null) throw new ArgumentNullException("Invalid Competition"); return _competitionRepository.Update(competition); }