public void ShouldMutateIfLevelIsEqual() { var originalNode = SyntaxFactory.BinaryExpression(SyntaxKind.AddExpression, SyntaxFactory.LiteralExpression(SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal(1)), SyntaxFactory.LiteralExpression(SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal(8))); var target = new ExampleMutator(MutationLevel.Complete); Should.Throw <NotImplementedException>(() => target.Mutate(originalNode, new StrykerOptions(mutationLevel: MutationLevel.Complete.ToString()))); }
public void Mutator_ShouldNotCallApplyMutations_OnWrongType() { // the type ReturnStatementSyntax should NOT be mutated var originalNode = SyntaxFactory.ReturnStatement(SyntaxFactory.LiteralExpression(SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal(1))); var target = new ExampleMutator(MutationLevel.Basic); var result = target.Mutate(originalNode, new StrykerOptions()); result.ShouldBeEmpty(); }
public void Mutator_ShouldCallApplyMutations_OnExpectedType() { // the type BinaryExpressionSyntax should be mutated by the examplemutator var originalNode = SyntaxFactory.BinaryExpression(SyntaxKind.AddExpression, SyntaxFactory.LiteralExpression(SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal(1)), SyntaxFactory.LiteralExpression(SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal(8))); var target = new ExampleMutator(MutationLevel.Basic); Should.Throw <NotImplementedException>(() => target.Mutate(originalNode, new StrykerOptions())); }
public void ShouldNotMutateIfMutationLevelIsLow() { var originalNode = SyntaxFactory.BinaryExpression(SyntaxKind.AddExpression, SyntaxFactory.LiteralExpression(SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal(1)), SyntaxFactory.LiteralExpression(SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal(8))); // The mutator is of level Expert var target = new ExampleMutator(MutationLevel.Complete); // The options level is Beginner target.Mutate(originalNode, new StrykerOptions(mutationLevel: MutationLevel.Standard.ToString())); // ApplyMutations should not have been called }