コード例 #1
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);
        }
コード例 #2
0
 public TwitterStatsController(IOptions <AppSettings> appSettings, TwitterStreamService twitterStreamService, TwitterStatCache cache)
 {
     this.appSettings          = appSettings.Value;
     this.twitterStreamService = twitterStreamService;
     this.cache = cache;
 }