Mutations for Linq methods don't work
See original GitHub issueDescribe the bug This code with the Linq method doesn’t mutate.
public int TestLinq(int count)
{
var list = Enumerable.Range(1, count);
return list.Last();
}
Also I tried to move Linq method from return statement.
public int TestLinq(int count)
{
var list = Enumerable.Range(1, count);
var last = list.Last();
return last;
}
And also I tried another methods (First, FirstOrDefault). Unit test for this method.
[Test]
public void TestLinq_One_Equal()
{
var r = _sl.TestLinq(5);
Assert.AreEqual(5, r);
}
Expected behavior Linq method should be mutated Last to LastOrDefault (etc) and vice versa.
Desktop (please complete the following information):
- OS: Windows 10
- Type of project: core
- Framework Version: netcoreapp2.2
- Stryker Version: 0.11.0 (beta)
Additional context Others mutation for another methods works well.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (4 by maintainers)
Top Results From Across the Web
C# grouped objects aren't being mutated as expected
The issue is that I needed to execute the LINQ query first to materialise the objects before sending them off for mutation.
Read more >Why is my IEnumerable not being mutated when I assign it ...
In my 8 years experience with C# I though passing argument by reference is the default behavior and thus I never perform mutation...
Read more >Exciting new features for Stryker.NET
The following mutations have been added to the Linq mutator. Original, Mutated. MinBy(), MaxBy(). MaxBy(), MinBy().
Read more >Supported and Unsupported LINQ Methods (LINQ to Entities)
This article summarizes the standard query operators that are supported and unsupported in LINQ to Entities queries.
Read more >Insert, update, and delete data using mutations
This page describes how to insert, update, and delete data using mutations. A mutation represents a sequence of inserts, updates, and deletes that...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have to say that the
MutantOrchestator
is one of the most complex parts of stryker so I think this might be a hard bug to fix. I’ve created a branch where I’ve cleaned the mutant orchestrator tests (579_call_linq_mutator). This makes TDD possible to target this bug. Maybe that could help. I will try to tackle this too if I find time soon.Fixed by PR #624. Manually tested on real project, but specific test added to the codebase