예제 #1
0
        public async Task GetFourDomainsFromSampleFeed()
        {
            int expected = 4;

            await sut.AddTweet(model);

            var results = await sut.GetDomainList();

            Assert.IsType <List <Entity> >(results);

            Assert.Equal(expected, results.Count);
        }
예제 #2
0
        public async Task Get4DomainsFromSampleTwitterFeed()
        {
            int expected = 4;

            var mockOptions = new OptionsWrapper <AppSettings>(new AppSettings
            {
                TwitterApiKey = "SOMEKEYVALUE",
                TwitterSecret = "SOMESECRET",
                BearerToken   = "SOMETOKEN"
            });

            TwitterStatCache cache = new TwitterStatCache();

            cache.SampleSize = 1;
            await cache.AddTweet(model);

            var mockQueue = new Mock <IBackgroundTaskQueue>();

            TwitterStreamService service = new TwitterStreamService(mockOptions, cache, mockQueue.Object);

            var controller   = new TwitterStatsController(mockOptions, service, cache);
            var actionResult = controller.GetDomainListFromCollection();
            var resultObject = Helper.GetObjectResultContent <List <Entity> >(actionResult.Result);

            Assert.Equal(expected, resultObject.Count);
        }