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_GetContentItemsByTerm_Returns_Empty_List_If_Term_Not_Used() { // Arrange Mock <IDataService> mockDataService = new Mock <IDataService>(); mockDataService.Setup(ds => ds.GetContentItemsByTerm(Constants.TERM_UnusedName)).Returns(MockHelper.CreateEmptyContentItemReader()); ContentController controller = new ContentController(mockDataService.Object); // Act IQueryable <ContentItem> contentItems = controller.GetContentItemsByTerm(Constants.TERM_UnusedName); // Assert Assert.AreEqual(0, contentItems.Count()); }
public void ContentController_GetContentItemsByContentType_Invalid_Id_Returns_No_Elements() { var mock = new Mock <IDataService>(); mock.Setup(ds => ds.GetContentItemsByContentType(It.IsAny <int>())).Returns(MockHelper.CreateEmptyContentItemReader()); var controller = new ContentController(mock.Object); var items = controller.GetContentItemsByContentType(-1).ToArray(); Assert.IsEmpty(items); }
public void ContentController_GetContentItem_Returns_Null_On_InValid_ContentItemId() { // Arrange Mock <IDataService> mockDataService = new Mock <IDataService>(); mockDataService.Setup(ds => ds.GetContentItem(Constants.CONTENT_InValidContentItemId)).Returns(MockHelper.CreateEmptyContentItemReader()); ContentController controller = new ContentController(mockDataService.Object); // Act ContentItem content = controller.GetContentItem(Constants.CONTENT_InValidContentItemId); // Assert Assert.IsNull(content); }