How-To: Write First bUnit Test

bUnit is a testing library for Blazor components. Its goal is to make it easy to write comprehensive, stable unit tests for these components. We will learn the steps to create our first bUnit test from setup to rendering to validation. This first test will be very simple to allow us to focus on the mechanics of creating the … Continue reading How-To: Write First bUnit Test

How-to: Add bUnit Test Project to Blazor Solution

Having automated tests for our Blazor applications is very important. We can use xUnit (or any other) test framework to write unit tests for the C# classes in our app. However, some part of our logic (even if it's just the databinding logic) lives in Blazor components and pages. For those to be tested, we … Continue reading How-to: Add bUnit Test Project to Blazor Solution

Lesson 1.9: Unit Testing Commands

The detailed description for just one test and how to run it got longer than expected, so we are putting the remaining command tests in this separate lesson. We won't go over each test in excruciating detail in this lesson. Instead, we will only focus on the differences or uniqueness of particular tests. For detailed … Continue reading Lesson 1.9: Unit Testing Commands

Lesson 1.8: Our First Command Unit Test

Having created our unit test project in lesson 1.7, we are ready to start writing some tests. This lesson will focus on the mechanics of setting up our first test in xUnit, how to mock our IUniversityRepository dependency, and the strategy of which tests to write to cover all of the scenarios for our commands. … Continue reading Lesson 1.8: Our First Command Unit Test

Lesson 1.7: Setting Up Unit Test Project

Testing is an important part of any project or command-line app. Spectre.Console.Cli is designed very well to support unit testing of commands. Unit tests are isolated tests meant to test just the code and logic within a component, or a command in the case of CLI apps. Using interfaces for dependent components and dependency injection … Continue reading Lesson 1.7: Setting Up Unit Test Project

Lesson 5.6: Build Repository Pattern for Data Access

With our simple Azure Functions web service in place, we can now focus on providing more complex functionality from our service. We will focus on read-only service features for now, since we're reading game data and no persisting any data yet. We want to build a service that will return lists of elements based on … Continue reading Lesson 5.6: Build Repository Pattern for Data Access

Lesson 5.5: Create Web Service to Retrieve ItemTemplates

With a working Azure Functions project in place, we are ready to start moving code into our web service. We have various sources of game data: items, monsters, locations, quests, recipes, and traders. Each of these data sources would make a great web service. So let's start by creating a simple web service that loads … Continue reading Lesson 5.5: Create Web Service to Retrieve ItemTemplates

Lesson 4.12: Read Monster Data File

We are going to continue our move to data files by working on the monster data. We will follow the same design that we described in the last lesson. We will create a new JSON data file, create a couple of Data Transfer Objects to use in serialization, and update the MonsterFactory to load and … Continue reading Lesson 4.12: Read Monster Data File