no dogma blog
no dogma blog
Blog Posts
Podcast
Polly Pluralsight Course
Photos
Contact
Support this Site
About
RSS
Light
Dark
Automatic
CSharp
Two Ways to Count the Number of Times a Mocked Method is Called With Moq
There are at least two ways to count the number of times a mocked method is called with Moq. The first is with the Verify method, the second is with the Callback method.
Jul 19, 2021
#
Mock
,
Moq
,
CSharp
,
Verify
,
Callback
Printing on the Spot in a Console
For the sheer fun of doing a little silly programming…
Jul 2, 2021
#
CSharp
,
console
Simple Example of C# 9 Lambda Discards
Discards can now be used with Lambdas in C# 9. Here is a simple example.
Jun 28, 2021
#
CSharp
,
dotNet6
,
dotNet
,
Lambda
,
Lambda Discard
Enum ToString(), Caching for Performance
Full source code available here. A while ago I was working on a program that had to convert enums values to strings as it saved data. When I removed the enum value from the data that was saved it went noticeably faster.
Jul 24, 2020
#
CSharp
,
Enum
,
ToString
Executing a Method on All Implementations of an Interface
Full source code available here. Have you ever wanted to execute a method on all implementations of an interface? Say you have an interface called IGenerator and four implementations of it – GeneratorA, GeneratorB, GeneratorC, and GeneratorD.
Jun 1, 2020
#
Activator
,
CSharp
,
CreateInstance
,
Interfaces
«
Cite
×