Publications
NCheck V2.3
Updated NCheck, my test object comparison helper, to version 2.3 which…
- Introduces a new technique to wire up conventions
- Supports multi-threading e.g. test fixtures using NUnit Parallelizable
Customizing the CheckerFactory
The CheckerFactory has a number conventions which are used to automatically construct Checkers for each class; these conventions can be overridden by the developer if they don’t suit a particular scenario.
We support…
- Type conventions: Applied to all instances of a particular type
- Property conventions: Applied to properties which satisfy a function e.g. matching a particular name
- Comparer conventions: Operates on a type or property convention and changes Value comparison from object.Equals to a specified comparer; useful for values such putting error bound on floating point comparison.
The suggested technique for this is to introduce an extension class to hold the factory methods
NCheck V2.2
Updated NCheck, my test object comparison helper, to version 2.2 which extends ICheckerFactory to support Compare<T> - this allows us to override checkers on a per-test basis which I’ve found useful on some of my current projects.
Customizing the CheckerFactory
The CheckerFactory has a number conventions which are used to automatically construct Checkers for each class; these conventions can be overridden by the developer if they don’t suit a particular scenario.
NCheck V2
Just release V2 of NCheck, my test object comparison helper which tidies up a few things that simplify custom comparisons and excluding properties.
- Reworked the
ITypeCompareTargter/IPropertyCompareTargeterinto a more genericIConvention<Source, Target> - Introduced custom comparers and use convention-based registration for them.
- Retired Exclude, you can now use
Compare(x => x.PropertyName).Ignore, unifies the syntax compared to other options.
NCheck: A object comparison helper
With unit testing one of the precepts is to check one thing in your test, but when you have objects this is difficult to express, since you want to check that the your business process has updated all of the expected properties (positive testing) and also that has not modified things that are not expected to have changed (negative testing).
This becomes even more problematic when you have an object graph, e.g. Order –> OrderLine –> Product where you have to navigate the graph, and reporting accurately where any errors is also a major issue as you need to track property names, collection indexes, etc. etc.
CsvReader now on GitHub
A number of years ago Sebastien Lorion wrote a very good CSV parser for .NET with the code and an accompanying article on Code Project - A Fast CSV Reader. I’d used this in a number of projects but recently I needed to make some changes to the code for my trading system project, and there wasn’t a public repository available; there’s a version on NuGet but it doesn’t point back to the source.