コード例 #1
0
        public void IsAcceptableReplacement_NotReplace_ReturnsFalse()
        {
            // Arrange
            var span   = GetSpan(SourceLocation.Zero, "Hello {world}.");
            var change = new SourceChange(new SourceSpan(0, 5), string.Empty);

            // Act
            var result = CodeBlockEditHandler.IsAcceptableReplacement(span, change);

            // Assert
            Assert.False(result);
        }
コード例 #2
0
        public void IsAcceptableReplacement_AcceptableReplacement_ReturnsTrue()
        {
            // Arrange
            var span   = GetSpan(SourceLocation.Zero, "Hello {world}.");
            var change = new SourceChange(new SourceSpan(0, 5), "H3ll0");

            // Act
            var result = CodeBlockEditHandler.IsAcceptableReplacement(span, change);

            // Assert
            Assert.True(result);
        }
コード例 #3
0
        public void IsAcceptableReplacement_ChangeContainsInvalidContent_ReturnsFalse()
        {
            // Arrange
            var span   = GetSpan(SourceLocation.Zero, "Hello {world}.");
            var change = new SourceChange(new SourceSpan(0, 0), "{");

            // Act
            var result = CodeBlockEditHandler.IsAcceptableReplacement(span, change);

            // Assert
            Assert.False(result);
        }
コード例 #4
0
        public void IsAcceptableReplacement_ChangeToComment_ReturnsFalse()
        {
            // Arrange
            var span   = GetSpan(SourceLocation.Zero, "Hello @");
            var change = new SourceChange(new SourceSpan(6, 1), "@*");

            // Act
            var result = CodeBlockEditHandler.IsAcceptableReplacement(span, change);

            // Assert
            Assert.False(result);
        }