Programming

Writing up dependency injection container for your component tests

ASP.NET Core has in-built dependency injection container and it’s pretty good enough to use. I use TestApiFactory class to use it without too much set up, but this time, I had to wire up service provider myself, as thses tests run against Service Fabric worker process which is an executable.

Read
Programming

Outbox Pattern in API and Messaging

Outbox is a simple relational database table that temporarily store all the events the service raises.

Read
Programming

Strongly Typed Identifier

GUID or UUID is the almost standard identifier for entity objects these days. It used be INT and I still do love INT as id type, but the trend is GUID

Read
Programming

Visualize your dependeicnes with graphviz

Graphviz uses simple markdown-like syntax to draw complex graphs. Initially I tried mermaid but it was more for flowchart, where things flow in one way. Graphviz was able to express complex web of objects much better.

Read
Programming

Use Moq CallBack to Verify Object Parameter

Our repositories accept domain models as parameter to save them to the database. Moq's verify works greatly if the method has primitive types like string, int, and bool, not so good at showing error message if the paramter is an object.

Read