コード例 #1
0
        public void NewsFeedController_Get_NumberOfPages_CallsProcessor()
        {
            var newsFeedController = new NewsFeedController(_newsProcessorMock.Object);

            newsFeedController.Get();

            _newsProcessorMock.Verify(m => m.GetNumberOfPages(null), Times.Once);
        }
コード例 #2
0
        public void NewsFeedController_Get_Stories_CallsProcessor_CorrectPageNumber()
        {
            var pageNumber         = 3;
            var newsFeedController = new NewsFeedController(_newsProcessorMock.Object);

            newsFeedController.Get(pageNumber);

            _newsProcessorMock.Verify(m => m.GetPageOfStories(pageNumber, null), Times.Once);
        }
コード例 #3
0
        public void NewsFeedController_Get_NumberOfPages_ReturnsValueFromProcessor()
        {
            var newsFeedController = new NewsFeedController(_newsProcessorMock.Object);

            _newsProcessorMock.Setup(m => m.GetNumberOfPages(null)).Returns(2);

            var result = newsFeedController.Get();

            Assert.AreEqual(2, result);
        }
コード例 #4
0
        public void NewsFeedController_Get_Stories_ReturnsFromProcessor()
        {
            var pageNumber = 3;
            var list       = new List <Story>();

            _newsProcessorMock.Setup(m => m.GetPageOfStories(pageNumber, null)).Returns(list);
            var newsFeedController = new NewsFeedController(_newsProcessorMock.Object);

            var results = newsFeedController.Get(pageNumber);

            Assert.AreSame(list, results);
        }