C# – Async/await with a Func delegate

To make a Func delegate awaitable, you have to make its out parameter a Task, like this: This Func accepts an int parameter and returns a Task. Since it returns a Task, it can be awaited. Notice that this isn’t returning a value. Normally you’d use an Action delegate if you didn’t want to return … Read more

C# – Using the DynamicData attribute in unit tests

The purpose of parameterized tests is to eliminate duplicated tests. There are two ways to pass parameters into a parameterized test: the DataRow attribute and the DynamicData attribute. With DataRow, the problem is you can only pass in constants and arrays. You can’t pass in reference types. When you try to pass in reference types, … Read more