Dependency injection (DI) is a software design pattern that removes hard-coded dependencies from an object and makes it possible to change those dependencies, whether at run-time or compile-time. This pattern can be used as a simple way to load plugins dynamically or to choose stubs/mock objects in test environments vs. real objects in production environments. … Continue reading Lesson 2.5: Using Blazor Dependency Injection
Author: DarthPedro
Lesson 2.4: Testing the MVVM Components
Now that we've put together all of the MVVM components, we're going to take a quick look at the testing across these components. View Model Tests We have already looked at the Player unit test in Lesson 2.1. Now, let's create some tests for the GameSession view model. In the SimpleRPG.Game.Engine.Tests project, create the GameSessionTests … Continue reading Lesson 2.4: Testing the MVVM Components
Lesson 2.3: Connecting Player – GameSession – Game Screen
We are going to complete the MVVM cycle by defining the view for our game - the Game Screen - to display and interact with the GameSession view model and the Player class. As a reminder of the MVVM design pattern: Fig 1 - MVVM pattern diagram To enable the View portion of this pattern, … Continue reading Lesson 2.3: Connecting Player – GameSession – Game Screen
Lesson 2.2: Initial GameSession View Model
When building client applications, there are different design patterns for separating the user interface, operations, and data models. For our game project, we will be using the Model-View-ViewModel (MVVM) pattern. Model–view–viewmodel (MVVM) is a software design pattern that helps with the separation of the development of the graphical user interface (the view) from the development … Continue reading Lesson 2.2: Initial GameSession View Model
Lesson 2.1: Initial Player Class
As we start building our RPG, we need to consider how to design the layers of the game. It is a typical pattern to separate the user interface from the code that drives behavior. For a game, we would separate the game screens and UI from the the game engine. We want to put as … Continue reading Lesson 2.1: Initial Player Class
Lesson 1.11: The Wrap
We've put a lot of infrastructure in place for our initial Simple RPG game. This is a good spot to wrap up the first chapter of lessons. And logically these lessons are steps that we would need to do for any Blazor application or game that we create: Create a DevOps project and repository.Clone Git … Continue reading Lesson 1.11: The Wrap
Lesson 1.10: Building Game Splash Screen
After launching the game a few times, I have already gotten tired of seeing the default "Loading..." message on every startup. Luckily there is a way to build our own application splash screen that will display while the Blazor WebAssembly loads on the page. Let's revisit the "./wwwroot/index.html" file. We edited this file earlier to … Continue reading Lesson 1.10: Building Game Splash Screen
Lesson 1.9: Azure Build Pipeline
Now that we have a Blazor app and test projects, we will create an automated build that will build our code whenever changes are committed into Azure DevOps. Automated builds ensure that any code check-ins always build on clean systems and all of our tests continue to run and pass continuously. Automated builds are an … Continue reading Lesson 1.9: Azure Build Pipeline
Lesson 1.8: bUnit to Test Blazor Components
Testing source code is one part of what we need for our game. Since we're building on Blazor, we're going to need a way to test Blazor components as well. And while a lot of Blazor is just plain C# classes that extend and render controls. There is an infrastructure in place to render those … Continue reading Lesson 1.8: bUnit to Test Blazor Components
Lesson 1.7: Adding Unit Test Project
Before we get too far along in coding the Simple RPG game, we need to enable building and running unit tests for our project. I've followed various forms of TDD (test-driven development) over the years. And I'm not a purest about writing tests prior to writing code. But I do firmly believe in creating tests … Continue reading Lesson 1.7: Adding Unit Test Project