public void ReturnRentalReturnsFalseReturnNeverRented() { //arrange const string testSerial = "45636"; var actualRentalList = CreateRentalList(); var actualDvdItemsList = CreateDvdList(); var RentalRepository = new Mock <IRentalRepository>(); var DvdItemRepository = new Mock <IDvdItemRepository>(); RentalRepository.Setup(o => o.Find()).Returns(actualRentalList); DvdItemRepository.Setup(o => o.Find()).Returns(actualDvdItemsList); var movieEngine = new RentalsEngine(null, DvdItemRepository.Object, RentalRepository.Object); //act var ReturnRentalResponse = movieEngine.ReturnRental(testSerial); //assert Assert.IsNotNull(ReturnRentalResponse, "Returned ReturnedRental is null"); Assert.IsFalse(ReturnRentalResponse, "Returned ReturnedRental is not False"); }
public void ReturnRentalReturnsTrue() { //arrange const string testSerial = "64356"; var actualRentalList = CreateRentalList(); var actualDvdItemsList = CreateDvdList(); var RentalRepository = new Mock <IRentalRepository>(); var DvdItemRepository = new Mock <IDvdItemRepository>(); RentalRepository.Setup(o => o.Find()).Returns(actualRentalList); DvdItemRepository.Setup(o => o.Find()).Returns(actualDvdItemsList); var movieEngine = new RentalsEngine(null, DvdItemRepository.Object, RentalRepository.Object); //act var ReturnRentalResponse = movieEngine.ReturnRental(testSerial); //assert Assert.IsNotNull(ReturnRentalResponse, "Returned ReturnedRental is null"); Assert.IsTrue(ReturnRentalResponse, "Returned ReturnedRental is not True"); RentalRepository.Verify(x => x.Modify(It.Is <Rental>(r => r.clientId == 5))); }
public void ReturnRentalReturnsTrue() { //arrange const string testSerial = "64356"; var actualRentalList = CreateRentalList(); var actualDvdItemsList = CreateDvdList(); var RentalRepository = new Mock<IRentalRepository>(); var DvdItemRepository = new Mock<IDvdItemRepository>(); RentalRepository.Setup(o => o.Find()).Returns(actualRentalList); DvdItemRepository.Setup(o => o.Find()).Returns(actualDvdItemsList); var movieEngine = new RentalsEngine(null, DvdItemRepository.Object, RentalRepository.Object); //act var ReturnRentalResponse = movieEngine.ReturnRental(testSerial); //assert Assert.IsNotNull(ReturnRentalResponse, "Returned ReturnedRental is null"); Assert.IsTrue(ReturnRentalResponse, "Returned ReturnedRental is not True"); RentalRepository.Verify(x => x.Modify(It.Is<Rental>(r => r.clientId == 5))); }
public void ReturnRentalReturnsFalseReturnNotRented() { //arrange const string testSerial = "72376"; var actualRentalList = CreateRentalList(); var actualDvdItemsList = CreateDvdList(); var RentalRepository = new Mock<IRentalRepository>(); var DvdItemRepository = new Mock<IDvdItemRepository>(); RentalRepository.Setup(o => o.Find()).Returns(actualRentalList); DvdItemRepository.Setup(o => o.Find()).Returns(actualDvdItemsList); var movieEngine = new RentalsEngine(null, DvdItemRepository.Object, RentalRepository.Object); //act var ReturnRentalResponse = movieEngine.ReturnRental(testSerial); //assert Assert.IsNotNull(ReturnRentalResponse, "Returned ReturnedRental is null"); Assert.IsFalse(ReturnRentalResponse, "Returned ReturnedRental is not False"); }