public void PeerReviewSnapshotComment_setValidSnapshotSpan_GivenSnapshotSpan()
        {
            // given
            var span         = new Span();
            var snapshotSpan = new SnapshotSpan(textSnapshotMock.Object, span);

            // when
            var comment = new PeerReviewSnapshotComment(reviewServiceMock.Object, snapshotSpan, testFilePath);

            // then
            Assert.AreEqual(snapshotSpan, comment.SnapShotSpan);
        }
        public void PeerReviewSnapshotComment_setValidMessage_GivenSnapshotSpan()
        {
            // given
            var span         = new Span();
            var snapshotSpan = new SnapshotSpan(textSnapshotMock.Object, span);

            reviewServiceMock.Setup(service => service.GetCommentMessage(It.IsAny <SnapshotSpan>())).Returns("test message");

            // when
            var comment = new PeerReviewSnapshotComment(reviewServiceMock.Object, snapshotSpan, testFilePath);

            // then
            Assert.AreEqual("test message", comment.Message);
        }
        public void PeerReviewSnapshotComment_setValidSpan_GivenSnapshotSpan()
        {
            // given
            var span         = new Span(5, 20);
            var snapshotSpan = new SnapshotSpan(textSnapshotMock.Object, span);

            reviewServiceMock.Setup(service => service.GetLineSpan(It.IsAny <SnapshotSpan>())).Returns(span);

            // when
            var comment = new PeerReviewSnapshotComment(reviewServiceMock.Object, snapshotSpan, testFilePath);

            // then
            Assert.AreEqual(span, comment.Span);
        }
        public void Equals_returnTrue_GivenCommentWithSameValues()
        {
            // given
            var span         = new Span();
            var snapshotSpan = new SnapshotSpan(textSnapshotMock.Object, span);

            reviewServiceMock.Setup(service => service.GetCommentMessage(It.IsAny <SnapshotSpan>())).Returns("test message");

            var commentA = new PeerReviewSnapshotComment(reviewServiceMock.Object, snapshotSpan, testFilePath);
            var commentB = new PeerReviewSnapshotComment(reviewServiceMock.Object, snapshotSpan, testFilePath);

            // when & then
            Assert.True(commentA.Equals(commentB));
        }
Пример #5
0
        private IList <DexterOccurence> CreateDexterOccurences(PeerReviewSnapshotComment comment)
        {
            var commentText = textService.GetText(comment.SnapShotSpan);
            var occurences  = new List <DexterOccurence>();

            occurences.Add(new DexterOccurence()
            {
                StringValue = "DPR",
                Message     = GetCommentMessageInternal(commentText),
                StartLine   = textService.GetStartLineNumber(comment.SnapShotSpan),
                EndLine     = textService.GetEndLineNumber(comment.SnapShotSpan)
            });

            return(occurences);
        }
        public void PeerReviewSnapshotComment_setValidLines_GivenSnapshotSpan()
        {
            // given
            var span         = new Span();
            var snapshotSpan = new SnapshotSpan(textSnapshotMock.Object, span);

            reviewServiceMock.Setup(service => service.GetStartLineNumber(It.IsAny <SnapshotSpan>())).Returns(5);
            reviewServiceMock.Setup(service => service.GetEndLineNumber(It.IsAny <SnapshotSpan>())).Returns(10);

            // when
            var comment = new PeerReviewSnapshotComment(reviewServiceMock.Object, snapshotSpan, testFilePath);

            // then
            Assert.AreEqual(5, comment.StartLine);
            Assert.AreEqual(10, comment.EndLine);
        }