public void ShouldNotMutateStatementWithArguments(string method) { var target = new NegateConditionMutator(); var node = GenerateExpressions(method); var result = target.ApplyMutations(node).ToList(); result.Count.ShouldBe(0); }
public void MutatesStatementWithMethodCallWithNoArguments(string method) { var target = new NegateConditionMutator(); var node = GenerateExpressions(method); var result = target.ApplyMutations(node).ToList(); result.Count.ShouldBe(1); result.First().ReplacementNode.ToString().ShouldBe("!(Method())"); }
[InlineData("var y = x is object result ? result.ToString() : null;")] // can't mutate inline var declaration public void ShouldNotMutateThis(string method) { var target = new NegateConditionMutator(); SyntaxTree tree = CSharpSyntaxTree.ParseText(method); var expressionSyntax = tree.GetRoot().DescendantNodes().OfType <ConditionalExpressionSyntax>().Single(); var result = target.ApplyMutations(expressionSyntax.Condition).ToList(); result.ShouldBeEmpty(); }
public void MutatesStatementWithMethodCallWithNoArguments(string method) { var target = new NegateConditionMutator(); var node = GenerateExpressions(method); var result = target.ApplyMutations(node).ToList(); var mutation = result.ShouldHaveSingleItem(); mutation.ReplacementNode.ToString().ShouldBe("!(Method())"); mutation.DisplayName.ShouldBe("Negate expression"); }
public void ShouldBeMutationlevelStandard() { var target = new NegateConditionMutator(); target.MutationLevel.ShouldBe(MutationLevel.Standard); }