Beispiel #1
0
        public void GivenOldCachedCommentExists_WhenBuildIdHasNotChanged_ThenNewCommentsAreNotRetrieved()
        {
            var commentsCache = new CommentsCache();
            var tfsJsonBuilds = GetTfsJsonBuilds(1, 2);

            commentsCache.FetchNewComments(tfsJsonBuilds, new TfsConnectionDetails(), GetCommentFunc("old comment")).Wait();
            commentsCache.FetchNewComments(tfsJsonBuilds, new TfsConnectionDetails(), GetCommentFunc("new comment")).Wait();
            Assert.AreEqual("old comment", commentsCache.GetCachedCommentForBuild(tfsJsonBuilds[0]));
        }
Beispiel #2
0
        public void Null_comments_are_handled_ok()
        {
            var commentsCache = new CommentsCache();
            var tfsJsonBuilds = GetTfsJsonBuilds(1, 2);

            commentsCache.FetchNewComments(tfsJsonBuilds, new TfsConnectionDetails(), GetCommentFunc(null)).Wait();
            Assert.AreEqual(null, commentsCache.GetCachedCommentForBuild(tfsJsonBuilds[0]));
        }
Beispiel #3
0
        public void GivenNoCachedCommentExists_WhenWeAsForComments_ThenTheyAreRetrieved()
        {
            var commentsCache = new CommentsCache();
            var tfsJsonBuilds = GetTfsJsonBuilds(1, 2);

            commentsCache.FetchNewComments(tfsJsonBuilds, new TfsConnectionDetails(), GetCommentFunc("some comment")).Wait();
            Assert.AreEqual("some comment", commentsCache.GetCachedCommentForBuild(tfsJsonBuilds[0]));
        }
Beispiel #4
0
        private CommentsCache GetCommentsCache(int buildDefinitionId, int buildId, string comment)
        {
            var commentsCache = new CommentsCache();

            var projects = GetTfsJsonBuilds(buildDefinitionId, buildId);

            commentsCache.FetchNewComments(projects, new TfsConnectionDetails(), GetCommentFunc(comment)).Wait();
            return(commentsCache);
        }