public void GetNewsDetailCallsTheCorrectMethodFromTheUnderlyingCore()
        {
            //Arrange
            const int storyId = 1;
            var mockNewsQuery = MockRepository.GenerateMock<NewsQuery>(_mockConnection);
            mockNewsQuery.Expect(x => x.GetNewsDetail(storyId))
                .Return(new GetNewsDetailResponseDTO());

            //Act
            var response = new NewsService(mockNewsQuery).GetNewsDetail(storyId);

            //Assert
            Assert.IsInstanceOfType(typeof(GetNewsDetailResponseDTO), response);
            mockNewsQuery.VerifyAllExpectations();
        }
        public void ListNewsHeadlinesCallsTheCorrectMethodFromTheUnderlyingCore()
        {
            //Arrange
            const string category = "UK";
            const int maxResults = 20;
            var mockNewsQuery = MockRepository.GenerateMock<NewsQuery>(_mockConnection);
            mockNewsQuery.Expect(x => x.ListNewsHeadlines(category, maxResults))
                .Return(new ListNewsHeadlinesResponseDTO());

            //Act
            var response = new NewsService(mockNewsQuery).ListNewsHeadlines(category, maxResults);

            //Assert
            Assert.IsInstanceOfType(typeof(ListNewsHeadlinesResponseDTO), response);
            mockNewsQuery.VerifyAllExpectations();
        }
        public void NewsServicePropertyLazyLoadsTheServiceTheFirstTimeItsCalled()
        {
            // Arrange
            var serviceReturned = new NewsService(new NewsQuery(_mockApiConnection.CoreConnection));

            _mockNewsServiceFactory.Expect(x => x.Create(_mockApiConnection))
                .Return(serviceReturned)
                .Repeat.Once();

            // Act
            var newsService = _serviceManager.NewsService;
            var serviceSecondCall = _serviceManager.NewsService;

            // Assert
            Assert.AreEqual(serviceReturned, newsService);
            Assert.AreEqual(newsService, serviceSecondCall);
            _mockNewsServiceFactory.VerifyAllExpectations();
        }