public void MutationShouldNotContainOriginalNodesPrefixInDescription() { // Arrange var prefix = new CommentGroupNode("This is a comment."); var startOfLineNode = new StartOfLineNode() { Prefix = prefix }; var childNodes = new List <RegexNode> { startOfLineNode, new CharacterNode('a'), new CharacterNode('b'), new CharacterNode('c') }; var rootNode = new ConcatenationNode(childNodes); var target = new AnchorRemovalMutator(); // Act var result = target.ApplyMutations(startOfLineNode, rootNode); // Assert var mutation = result.ShouldHaveSingleItem(); mutation.OriginalNode.ShouldBe(startOfLineNode); mutation.ReplacementNode.ShouldBeNull(); mutation.ReplacementPattern.ShouldBe("(?#This is a comment.)abc"); mutation.DisplayName.ShouldBe("Regex anchor removal mutation"); mutation.Description.ShouldBe("Anchor \"^\" was removed at offset 22."); }
public void ToStringShouldReturnCaret() { // Arrange var target = new StartOfLineNode(); // Act var result = target.ToString(); // Assert result.ShouldBe("^"); }
public void ToStringOnStartOfLineNodeWithPrefixShouldReturnCommentBeforeCaret() { // Arrange var comment = new CommentGroupNode("This is a comment."); var target = new StartOfLineNode() { Prefix = comment }; // Act var result = target.ToString(); // Assert result.ShouldBe("(?#This is a comment.)^"); }