Ejemplo n.º 1
0
        public async Task Get_IEnumerable_Of_HackStories()
        {
            var repo     = new HackNewsRepository();
            var business = new HackNewsBusiness(_memoryCache.Object, _hackNewsRepository);
            var result   = await business.GetNewHackStories("");

            Assert.AreEqual(result.Count, 0);
        }
Ejemplo n.º 2
0
        public void Setup()
        {
            _memoryCache = new Mock <IMemoryCache>();
            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("[ 9129911, 9129199, 9127761, 9128141, 9128264, 9127792, 9129248, 9127092, 9128367, 9038733]"),
            })
            .Verifiable();

            _hackNewsRepository        = new HackNewsRepository();
            _hackNewsRepository.client = new HttpClient(handlerMock.Object);
        }