With our current test project, we have several classes that we created to "mock" some simple behavior for our tests: MockGameSession, MockJSRuntime, and MockIconProvider. As we build out our game, we will need to mock more classes to help simplify our testing. Creating mock objects manually is repetitive and time consuming, so to increase our … Continue reading Lesson 2.7: Adding a Test Mocking Framework
Blog Feed
Lesson 2.6: Refactoring to PlayerComponent
One of the Blazor's strengths is being able to componentize UIs into smaller pieces that can be composed into a page. We haven't taken advantage of that yet in our game screen. So let's start to do that by refactoring our MainScreen page to pull out the Player Data table into its own component. This … Continue reading Lesson 2.6: Refactoring to PlayerComponent
Lesson 2.5: Using Blazor Dependency Injection
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
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