Open.CoreMDB Part 2 – Refactoring

Jamie Taylor

You’ll find an embedded player for the recording at the top of this post. This video is just over 90 minutes long, but it forms the ground work for what will become a full test drive developed piece of open source software that I’m calling Open.CoreMDB.

Recording Date

I originally recorded this on the July 15th, 2018.

The Purpose

The idea with part two in this series was to begin a full system refactor. In the first part, we’d built the entire system in one project

the src project

and leaving it like that would be a nightmare. So, the entire system was broken up into several parts:

  • Open.CoreMDB.Api
  • Open.CoreMDB.Data
  • Open.CoreMDB.Services
  • Open.CoreMDB.Shared

This way, we can work on individual parts of the system and keep them separated and loosely coupled.

leaving the entire source in one project would mean that the system was tightly coupled

We also started adding an API to the project. This took the form of an ASP.NET Core WebApi project, and has a single controller (ResourceController) with a single method (Get).

We also used VS Code’s built in task runner to build a task which would continuously run our unit tests

this gives us Live Unit Testing-like abilities

Essentially, whenever a change is made to anywhere in the code base, the unit tests are re-run and we see the immediate result of our code change.

The following is the task that we created:

"label": "test with coverage (continuous)",
"command": "dotnet",
"type": "process",

This task was based on some of the points raised in this blog post, by Scott Hanselman.

Issues in the Stream

From around the 1 hour mark onward, I started having trouble with xunit’s global CLI tool

i.e. the dotnet xunit command

After the stream, I found that the reason for this was because the xunit global CLI tooling has been deprecated and doesn’t support ASP.NET Core MVC. As such, what I should have done was continue to run my task for continuously running the unit tests.

Show Notes

I mentioned the following resources in this stream:

which includes a code of conduct for folks who wish to contribute

If this post has helped you out, please consider   Buy me a coffeeBuying me a coffee
Jamie Taylor
A .NET developer specialising in ASP.NET MVC websites and services, with a background in WinForms and Games Development. When not programming using .NET, he is either learning about .NET Core (and usually building something cross platform with it), speaking Japanese to anyone who'll listen, learning about languages, writing for his non-dev blog, or writing for a blog about video games (which he runs with his brother)