public void GetStoriesByID_InvalidIDReturnsValid()
        {
            var handlerMock = new Mock <HttpMessageHandler>(MockBehavior.Strict);

            handlerMock
            .Protected()
            .Setup <Task <HttpResponseMessage> >(
                "SendAsync",
                ItExpr.IsAny <HttpRequestMessage>(),
                ItExpr.IsAny <CancellationToken>()
                )
            .ReturnsAsync(new HttpResponseMessage()
            {
                StatusCode = HttpStatusCode.OK,
                Content    = new StringContent(string.Empty)
            })
            .Verifiable();

            var client = new HttpClient(handlerMock.Object);

            client.BaseAddress = new Uri("http://test.test");
            var service = new HackerNewsService();

            service.Client = client;

            var result = service.GetStoriesByID(new List <int>()
            {
                21
            });

            Assert.True(result != null);
            Assert.True(result.First() == null);
        }
        public void GetStoriesByID_ReturnsValid()
        {
            var testId      = 1;
            var handlerMock = new Mock <HttpMessageHandler>(MockBehavior.Strict);

            handlerMock
            .Protected()
            .Setup <Task <HttpResponseMessage> >(
                "SendAsync",
                ItExpr.IsAny <HttpRequestMessage>(),
                ItExpr.IsAny <CancellationToken>()
                )
            .ReturnsAsync(new HttpResponseMessage()
            {
                StatusCode = HttpStatusCode.OK,
                Content    = new StringContent(JsonConvert.SerializeObject(testStories.Where(s => s.id == testId).First()), Encoding.UTF8, "application/json"),
            })
            .Verifiable();

            var client = new HttpClient(handlerMock.Object);

            client.BaseAddress = new Uri("http://test.test");
            var service = new HackerNewsService();

            service.Client = client;

            var result = service.GetStoriesByID(new List <int>()
            {
                testId
            });

            Assert.True(result != null);
            Assert.True(result.Count() == 1);
            Assert.Equal(result.First().id, testId);
        }