public void ContentController_GetUnIndexedContentItems_Returns_EmptyList_If_No_UnIndexed_Items() { //Arrange Mock<IDataService> mockDataService = new Mock<IDataService>(); mockDataService.Setup(ds => ds.GetUnIndexedContentItems()) .Returns(MockHelper.CreateEmptyContentItemReader()); ContentController controller = new ContentController(mockDataService.Object); //Act IQueryable<ContentItem> contentItems = controller.GetUnIndexedContentItems(); //Assert Assert.AreEqual(0, contentItems.Count()); }
public void ContentController_GetUnIndexedContentItems_Returns_List_Of_UnIndexedContentItems() { //Arrange Mock<IDataService> mockDataService = new Mock<IDataService>(); mockDataService.Setup(ds => ds.GetUnIndexedContentItems()) .Returns(MockHelper.CreateValidContentItemsReader(Constants.CONTENT_IndexedFalseItemCount, Constants.CONTENT_IndexedFalse, Null.NullInteger, Null.NullString)); ContentController controller = new ContentController(mockDataService.Object); //Act IQueryable<ContentItem> contentItems = controller.GetUnIndexedContentItems(); //Assert Assert.AreEqual(Constants.CONTENT_IndexedFalseItemCount, contentItems.Count()); foreach (ContentItem content in contentItems) { Assert.IsFalse(content.Indexed); } }
public void ContentController_GetUnIndexedContentItems_Calls_DataService() { //Arrange Mock<IDataService> mockDataService = new Mock<IDataService>(); mockDataService.Setup(ds => ds.GetUnIndexedContentItems()) .Returns(MockHelper.CreateValidContentItemReader()); ContentController controller = new ContentController(mockDataService.Object); //Act IQueryable<ContentItem> contentItems = controller.GetUnIndexedContentItems(); //Assert mockDataService.Verify(ds => ds.GetUnIndexedContentItems()); }