Cleanup Orphaned Git Tracking Branches
By Sean Grimes
| Jun 19, 2019
| git
A very common development strategy with Git is to create a new branch for every feature and bug you work on, then once the code passes code review, to then merge it to the correct shared branch. The problem then becomes that you end up with a bunch of branches over time that you no longer need. We can use some simple shell commands to clean up these branches.
Using Multiple Auth Handlers In ASP.NET Core
ASP.NET Core makes it extremely easy to configure authentication right out of the box with a choice from a plethora of different built-in authentication handlers. Everything from Single Sign On with Facebook to JWT to simple cookie authentication is available right out of the box. Where I found the ASP.NET Core documentation lacking was when attempting to use multiple authentication handlers at the same time. I was already using the JWT handler in my application, but I wanted to have my custom API key authentication handler run and handle authentication if no Authorization header was supplied as part of the request.
How to Load Balance SignalR Without Using Sticky Sessions
SignalR poses some small challenges when running in a load balanced environment. When you have multiple servers then some users will have SignalR connections open to one server and then some users will have SignalR connections open to another. The usual solution is to use a SignalR backplane so that all the servers in your cluster can see every SignalR message that was sent, then forward the message to the appropriate users connected to each server.
Hosting and Deploying a Blog Using Hugo, Docker and AWS ECS
One of the things that has been long overdue on my personal to-do list is to get back into blogging. With the general availability of the new .dev domain last week, I decided it was finally time to take the plunge after buying a fancy new vanity domain. This blog post will describe how I setup a new blog using Hugo for the static site, Docker and NGINX for deployment, and Amazon ECR and ECS for hosting.
Designing With Testability in Mind
Although there are some special considerations, designing for testability largely involves following well established software design principles. In this blog post I’ll cover these design principles and how they help with testability and also cover any special considerations that you’ll need to keep in mind.
Useful Software Design Principles Single Responsiblity Principle For those not familiar with the Single Responsiblity Principle (SRP), it was originally proposed by Uncle Bob Martin and states that a class should have a single responsibility or reason to change.
Writing Your First Unit Test
For the rest of the articles in this series, we’ll be using the excellent xUnit.net unit testing framework to write tests. This is the unit testing framework with the greatest amount of mindshare at the moment, with Microsoft having recently adopted it for the various ASP.NET projects that they have open sourced.
Before we begin, we’ll need to cover some simple concepts around how to write your tests. When writing a unit test, the thing being tested is called the System Under Test (or SUT for short).
Introduction to Unit Testing
Let’s be honest, manually testing software sucks. When developing a new feature, you’ll often have to manually test your changes multiple times to ensure everything is working. If you are a web developer, this usually means jumping through hoops in order to test your code through the UI. What you really want is a way to automate these tests and run them whenever you make a change. Even better would be a way to run these tests everytime someone else makes a change to the software as well.