It has been a long time since I last did a code kata. So long that it made me jump when I stumbled across an a older project while searching for something on the hard drive of my previous pc. This particiular project was an attempt to produce an integer to Roman Numeral converter. Originally writen in .Net Framework 4.5. A single class with a convert method. Then a second project with a sereis of tests using MS Test.

First thing first I put committed the entire project to github rather than just living on my hard disk.

Next up I upgraded the project to .net 5.0 (I would have used 6 but I only have Visual Studio 2019 installed on this computer). To do this I did the following.

  1. Remove the ‘packages.config’ file. .net core no longer uses packages. I didnt have anything special installed so this was safe to delete.
  2. Upgrade project files.
    dotnet new classlib -n RomanNumerals --force
    dotnet new xUnit -n RomanNumerals.Test --force

    This created new project files over the top of the old ones.

  3. Refactor the project so that the conversion is an extention method rather than having to create an instance of the class.
  4. Convert the MS Test Tests into one xUnit facts. This enabled me to replace a series of test into one theory with inline data infintately more readable!
  5. Add a github action to build the project and run the tests on commits to master.

You can take a look at the finished article here