public void ListDvdItemsReturnsEmptyListIfTheAreDvdItemAtAll() { //arrange var dvdItemRepository = new Mock <IDvdItemRepository>(); dvdItemRepository.Setup(o => o.Find()).Returns(new List <DvdItem>()); var movieEngine = new RentalsEngine(null, dvdItemRepository.Object, null); //act var returnedDvdItems = movieEngine.ListDvdItem(); //assert Assert.IsNotNull(returnedDvdItems, "Returned DvdItem list is null"); Assert.AreEqual(0, returnedDvdItems.Count, "Returned DvdItem has DvdItem items"); }
public void ListDvdItemsReturnsAllDvdItems() { //arrange var availableDvdItems = CreateDvdItemList(); var actualDvdItems = CreateDvdItemList(); var dvdItemRepository = new Mock <IDvdItemRepository>(); dvdItemRepository.Setup(o => o.Find()).Returns(actualDvdItems); var rentalsEngine = new RentalsEngine(null, dvdItemRepository.Object, null); //act var dvdItems = rentalsEngine.ListDvdItem(); //assert Assert.IsNotNull(dvdItems, "Return DvdItem collection is null"); Assert.AreEqual(10, dvdItems.Count); CollectionAssert.AreEquivalent(availableDvdItems, dvdItems, "Returned list of DvdItem are not equivalent to the expected list"); }
public void ListDvdItemsReturnsEmptyListIfTheAreDvdItemAtAll() { //arrange var dvdItemRepository = new Mock<IDvdItemRepository>(); dvdItemRepository.Setup(o => o.Find()).Returns(new List<DvdItem>()); var movieEngine = new RentalsEngine(null, dvdItemRepository.Object, null); //act var returnedDvdItems = movieEngine.ListDvdItem(); //assert Assert.IsNotNull(returnedDvdItems, "Returned DvdItem list is null"); Assert.AreEqual(0, returnedDvdItems.Count, "Returned DvdItem has DvdItem items"); }
public void ListDvdItemsReturnsAllDvdItems() { //arrange var availableDvdItems = CreateDvdItemList(); var actualDvdItems = CreateDvdItemList(); var dvdItemRepository = new Mock<IDvdItemRepository>(); dvdItemRepository.Setup(o => o.Find()).Returns(actualDvdItems); var rentalsEngine = new RentalsEngine(null, dvdItemRepository.Object, null); //act var dvdItems = rentalsEngine.ListDvdItem(); //assert Assert.IsNotNull(dvdItems, "Return DvdItem collection is null"); Assert.AreEqual(10, dvdItems.Count); CollectionAssert.AreEquivalent(availableDvdItems, dvdItems, "Returned list of DvdItem are not equivalent to the expected list"); }