Excluding certain properties when asserting objects with FluentAssertion

It’s very common that we assert if two objects are equivalent in unit tests. Using FluentAssertion, this looks like the following

However, there are times where you want to exclude certain properties when comparing objects. This might be because the value of the property cannot be predicted or you just don’t want to include … [Read more…]

Json.net serialisation issue when returning Entity Framework models in Web API

It’s very typical for Entity Framework models to have circular references. For example:

This, however, will cause serialisation error when returning these EF models in Web API controller because it detects that there are circular references. The json serialiser does not know how to handle circular reference.

There are a few solutions to … [Read more…]