C# – How to match an anonymous type parameter in a mocked method

When an anonymous type is defined in one assembly, it won’t match an anonymous type defined in another assembly. This causes problems when you’re unit testing and trying to mock a method that has an an anonymous type parameter. For example, let’s say you’re trying to unit test the following method: To unit test this, … Read more