public void AddSportObjectMethodReturnsTrueIfNewEntry() { //Arrange var sportobjects = new SportObject { Name = "KongballObject" }; var dummysport = new Sport { Name = "KongBall", }; var mockRepo = new Mock <ISportRepository>(); mockRepo.Setup(s => s.AddSportObject(dummysport, sportobjects)); var manager = new SportManager(mockRepo.Object); //Act var result = manager.AddSportObject(dummysport, sportobjects); //Assert Assert.True(result); }
public void FailedAddSportObject() { var dummysportobject = new SportObject { Name = "sportobject 1", }; var dummysport = new Sport { Name = "KongBall", }; var sportobjects = new SportObject[] { new SportObject { Name = "sportobject 1" }, new SportObject { Name = "sportobject 2" }, new SportObject { Name = "sportobject 3" }, new SportObject { Name = "sportobject 4" } }; var mockRepo = new Mock <ISportRepository>(); mockRepo.Setup(s => s.GetAllSportObjects()).Returns(sportobjects); mockRepo.Setup(x => x.AddSportObject(dummysport, dummysportobject)); var manager = new SportManager(mockRepo.Object); //Act var result = manager.AddSportObject(dummysport, dummysportobject); //Assert Assert.False(result); }