Jack Histon's Blog

Welcome to my blog !


Automating The Arrange Phase With AutoFixture

Published at November 2, 2017 ·  3 min read

In a previous article, we refactored a unit test in two ways. The builder and fixture patterns encapsulated an object’s creation, which simplified the arrange phase of a unit test. These two patterns produced a lot of boiler-plate code. It would be nice to never have to create an arrange phase in the first place. AutoFixture tries to produce unit tests with no arrange phase. As the AutoFixture GitHub page describes:...

Extending The Razor View Engine With View Location Expanders

Published at October 24, 2017 ·  3 min read

In a previous post, I dived into view results, and how the razor view engine executes a razor view. Part of the post discussed a feature called view location expanders. An expander does what its name describes. It expands on locating a view within your application, that is, a way to change how your .cshtml files are located. View Localisation A good example of a view location expander, is the built-in LanguageViewLocationExpander....

MSBuild Maintenance Made Easy With Shared Properties

Published at October 12, 2017 ·  3 min read

The New MSBuild MSBuild is the build engine for .NET and Visual Studio. It is written in such a way to be composable, allowing you to combine project files. If you have ever used Visual Studio, then you have indirectly used MSBuild. When you open Visual Studio, it is using MSBuild to restore, build, and manage your projects. Recently, a new version of MSBuild has hit the streets. This came out along with Visual Studio 2017, and has changed design....

ASP.NET Core 2.0 - Repository Overview: Action Results

Published at October 8, 2017 ·  9 min read

In This Series ASP.NET Core MVC - Repository Overview: Model Binding ASP.NET MVC Core - Repository Overview: Value Providers ASP.NET Core 2.0 - Repository Overview: Action Discovery ASP.NET Core 2.0 - Repository Overview: Action Selection ASP.NET Core 2.0 - Repository Overview: Razor Pages ASP.NET Core 2.0 - Repository Overview: Action Results Contents Introduction What is the View Result Returning a view result Executing a view result The Executor Finding and Compiling your View View Location Expanders View Locator Cache Generating an IRazorView Cache Invalidation Rendering the Razor Page Creating a Custom Action Result Summary Introduction This series tries to explain the underlying mechanisms of ASP....

2 Simple Ways To Improve Your Unit Tests

Published at October 3, 2017 ·  6 min read

Over the past 20 years, testing has become a cornerstone of software development. To turn software development into a true profession, we need to create robust, secure, safe, and efficient systems. The simplest tool in our toolbox starts us on this road: the unit test. Like an accountant, the unit test is a fantastic way for us to perform double-entry bookkeeping. The unit test double checks our work is correct, and makes sure we keep it from morphing into something we did not want....

How to Create Bogus Data in C#

Published at October 1, 2017 ·  6 min read

Programmers are lazy. We love tools that automate our lives. Why not automate data? A time-consuming but necessary part of a programmers job is seeding data into a database. Demonstrations, load performance, styling, testing, all need a way to generate data. A rudimentary way of doing this is by hand. Spending days, sometimes weeks, inputting data into a system until it represents a realistic go-live scenario. Once you begin to realise doing it by hand is inefficient, you decide to create a seeding application that does it for you....

Trust Your Data, Not Your Mind

Published at September 27, 2017 ·  7 min read

When you add decor to your home, previous decor can look worse. You paint one wall a bright blue, but at the same time, the shine of the wall next to it dulls a little. Your codebase is a never-ending cycle of refactoring. Small improvements to one part, makes you see small improvements for another part. Shining a light on a piece of your code, shines problems on code around it....

ASP.NET Core 2.0 - Repository Overview: Razor Pages

Published at September 24, 2017 ·  17 min read

Previously in this Series ASP.NET Core MVC - Repository Overview: Model Binding ASP.NET MVC Core - Repository Overview: Value Providers ASP.NET Core 2.0 - Repository Overview: Action Discovery ASP.NET Core 2.0 - Repository Overview: Action Selection Contents Introduction What is Razor Pages? How to setup Razor Pages Creating your first Razor Page The RazorProjectPageRouteModelProvider Class Razor Pages and Forms The code-behind file The Razor Page Application Model Dealing with Multiple Handlers Getting rid of the handler query parameter Summary Introduction This article is the fifth in a series I’m dedicating to reviewing the code and design of the ASP....

Making a Master Puppeteer

Published at September 13, 2017 ·  4 min read

There are many ways to test a program. From starting miniscule with unit testing, to more grandiose UI testing. Puppeteer falls firmly in the latter category. Puppeteer advertises itself as a Node library which provides a high-level API to control headless Chrome over the DevTools Protocol That is a lot of words. Puppeteer is a walking advertisement of the true potential the Chrome DevTools Protocol has to offer....