示例#1
0
        public static IFeature Create(ICommandParser commandParser)
        {
            var time      = new Time();
            var jiraApi   = new CachedJiraApi(time, new JiraApi());
            var processor = new CompositeMessageProcessor(
                new JiraBugProcessor(commandParser, jiraApi),
                new JiraLabelSuggester(commandParser, jiraApi));

            return(new BasicFeature("jira", "track jira tickets mentioned in chat", "", processor));
        }
        public void CanCacheJiraApi()
        {
            var cached    = new CachedJiraApi(new Time(), new JiraApi());
            var stopwatch = new Stopwatch();

            stopwatch.Start();
            var bug          = cached.FromId("SDC-1604").Result;
            var uncachedTime = stopwatch.Elapsed;

            stopwatch.Reset();
            bug = cached.FromId("SDC-1604").Result;
            var cachedTime = stopwatch.Elapsed;

            Assert.Greater(uncachedTime.TotalMilliseconds, 10);
            Assert.Less(cachedTime.TotalMilliseconds, 10);
        }