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])); }
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])); }
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])); }