Stream Updates and Refactoring a Visual Studio Extension

Today was a good stream, and I felt very productive during it.  We refactored the OptionsPage in the EpicBuildMusic project to allow it to be unit tested, and I even gave the folders, fixtures, and tests names so they made sense.  A replay of today’s stream is below:

I was tinkering with my stream settings, and didn’t have any audio for the first two minutes.  However, I did have some housekeeping items to share:

  • I have some new hardware that I’m going to test and start using after this stream.  It should help with stream quality and allow us to start interviewing / pair-programming during the stream.
  • I announced some follower-goals:
    • After 500 followers, I will host an 8-hour ASP.NET Core live streamed workshop.  If you want to learn all about ASP.NET Core from the team itself, you’ll want to follow me on Twitch and click that follow button.
    • After 1000 followers, I will host a stream where I will invite several of YOU to join me and we’ll work on your .NET projects together.

In Visual Studio, I showed the contents of the manifest file that is used by the extension to share information about the features delivered and requirements to use the EpicBuildMusic extension.

We also refactored our code a bit more and wrote some tests around the OptionsPage.  One item that we identified for additional changes was a check to determine if the music file selected exists on disk.  This lead to introducing an interface to abstract away the FileSystem.

Abstract the filesystem?  Yes, in unit-testing scenarios we should eliminate any external dependencies.  For this project, I introduced the IFileSystemHandler interface that would allow me to test for a file on disk:

public interface IFileSystemHandler {

    bool FileExists(string file);

  }

  public class FileSystemHandler : IFileSystemHandler
  {
    public bool FileExists(string fileToCheck)
    {
      return File.Exists(fileToCheck);
    }
  }

Now, I can mock the IFileSystemHandler in my test and force it to return the value that I want without actually touching the disk.  This is very important in continuous integration systems like VSTS, TeamCity, or AppVeyor where I don’t have control over the contents on disk and don’t want to leave any extra artifacts on disk.

The EpicBuildMusic project is completely open source, and I encouraged a few folks to take a look at some updates to improve the options page.  Hopefully, we’ll start localizing the options, and some of our followers can assist with a translation for our text.

I hope you join me on Tuesday morning, where I should have some changes ready to go, including hi-def video and perhaps a pair-programming partner.