-
We are trying to get high mutation scores in our code so there'll be more questions from me :D So, it's a common practice to implement public override int GetHashCode()
{
unchecked
{
return (Property1.GetHashCode() * 397) ^ Property2.GetHashCode();
}
} Such pattern is recommended even by holy Jon Skeet here and here's the reason for 397 if you wonder :D Now apparently Stryker mutates in like this: public override int GetHashCode()
{
unchecked
{
return ~((Property1.GetHashCode() * 397) ^ Property2.GetHashCode());
}
} Do you have any particular recommendation on how to handle this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I am close to 100% with NFluent. I do have unit tests for the couple for If you do not want to test such methods, you can mark them with |
Beta Was this translation helpful? Give feedback.
I am close to 100% with NFluent. I do have unit tests for the couple for
GetHashCode
overrides, if that is your question.Those have to be updated sometimes as hashcode calculation may change across Net framework versions.
If you do not want to test such methods, you can mark them with
[ExcludeCoverage]
, this will disable mutation for this method.