Code Coverage and Nullable

Comparisons of Nullable<T> types and code coverage can give some unexpected, but logical results. Earlier this week I posted a small Puzzle showing the problem. The light blue shade of the return statements indicate that they have been executed. So both branches of the if statement have been covered. But the light pink shade of… Continue reading Code Coverage and Nullable

A Code Coverage Puzzle

A simple comparison is marked as not completely covered, although both branches of the if statement have been covered!?! How is that possible? This is a small function I’ve created, which is also covered by unit tests. The light blue shade of the return statements indicate that they have been executed. So both branches of… Continue reading A Code Coverage Puzzle

.NET == and .Equals()

Equality might look like a simple concept at a first glance, but looking deeper it isn’t. In C# objects can be compared with the == operator, with the Equals(Object) member, with the Object.Equals(Object, Object) method or using custom comparators that implement one of or more of the IEquatable<T>, IComparable, IStructuralEquatable or IStructuralComparable interfaces. There’s also… Continue reading .NET == and .Equals()