public void AddSportMethodReturnsTrueIfNewEntry() { //Arrange var dummysport = new Sport { Name = "KongBall", }; var sports = new Sport[] { new Sport { Name = "sport 1" }, new Sport { Name = "sport 2" }, new Sport { Name = "sport 3" }, new Sport { Name = "sport 4" }, }; var mockRepo = new Mock <ISportRepository>(); mockRepo.Setup(s => s.Sports()).Returns(sports); var manager = new SportManager(mockRepo.Object); //Act var result = manager.AddSport(dummysport); //Assert Assert.True(result); }
public void FailedAddSport() { var dummysport = new Sport { Name = "sport 1", }; var sports = new Sport[] { new Sport { Name = "sport 2" }, new Sport { Name = "sport 3" }, new Sport { Name = "sport 4" }, dummysport }; var mockRepo = new Mock <ISportRepository>(); mockRepo.Setup(s => s.Sports()).Returns(sports); var manager = new SportManager(mockRepo.Object); //Act var result = manager.AddSport(dummysport); //Assert Assert.False(result); }