In Blazor, sometimes our page code becomes large and cumbersome. Rather than keep all of the HTML markup and C# code in the same .razor file, we can split our markup and code into separate files. Blazor supports creating code-behind files for the .razor file (similar to other .NET technologies like WinForms, ASP.NET, WPF, etc). … Continue reading How-To: Use Blazor Code-Behind File
Author: DarthPedro
Lesson 6.6: Create Table Storage Repository
Now that we have our game data in Azure Table Storage, we need a mechanism for loading that data into our services. To support this, we will implement a new instance IReadableRepository that encapsulates all of the logic for fetching data from Table Storage. The TableStorageReadRepository will follow the pattern that we developed for InMemoryReadRepository … Continue reading Lesson 6.6: Create Table Storage Repository
How-To: Write bUnit Tests for Pages with Parameters
Page routing parameters allow developers to pass data to pages in their URL. bUnit allows us to pass routing parameters to pages, so that we can validate their behavior with test data. These parameters are set as part of the TestContext rendering process. This works exactly the same way as testing component parameters. First, we must have … Continue reading How-To: Write bUnit Tests for Pages with Parameters
Lesson 6.5: Create Azure Tables with Game Data
As we did with blob storage, we need to setup a storage account and the individual tables in Azure Table storage. In this lesson, we will focus on the steps needed to setup the account and tables through the Azure Portal. Then, we will add all of our game data to the appropriate tables. We … Continue reading Lesson 6.5: Create Azure Tables with Game Data
App-Idea 7: CSV to JSON Converter
Our next app-idea is the build the CSV to JSON Converter. This allows us to go back from a CSV definition to a JSON file format (the inverse of App-Idea 6). We allow users to input free-from text in CSV format or load the data from a CSV file. Then provide a conversion function to … Continue reading App-Idea 7: CSV to JSON Converter
How-To: Write bUnit Tests for Components with EventCallbacks
Component callbacks allow developers to build Blazor components that fire events to their parent components/pages to notify them of state changes. The parent components can then respond to those changes as well. bUnit supports EventCallbacks as parameters on those components, so that we can validate their behavior. First, we must have a Blazor project and … Continue reading How-To: Write bUnit Tests for Components with EventCallbacks
How-To: Write bUnit Tests for Components with Parameters
Component parameters allow developers to build interactive and reusable Blazor components. bUnit provides us a couple of mechanisms for passing parameters to components, so that we can validate their behavior with test data. These parameters are set as part of the TestContext rendering process. First, we must have a Blazor project and corresponding test project. … Continue reading How-To: Write bUnit Tests for Components with Parameters
App-Idea 6: JSON to CSV Converter (Part 3)
In this article, we will wrap up the JSON to CSV Converter, which allows users to enter text in a simplified JSON format and converts it into a comma-separated value (CSV) format. This app-idea has more complex requirements, so we will cover this application in 3 parts: In part 1, we focused on the basic … Continue reading App-Idea 6: JSON to CSV Converter (Part 3)
App-Idea 6: JSON to CSV Converter (Part 2)
We will continue to enhance the JSON to CSV Converter, which allows users to enter text in a simplified JSON format and converts it into a comma-separated value (CSV) format. This app-idea has more complex requirements, so we will cover this application in 3 parts: In part 1, we focused on the basic conversion functionality … Continue reading App-Idea 6: JSON to CSV Converter (Part 2)
How-To: Write bUnit Test for Component
bUnit is a testing library for Blazor components. Its goal is to make it easy to write comprehensive, stable unit tests for components. We will learn the steps to create a bUnit test class from setup to rendering to validation. This test will focus on testing a static component with a simple rendering operation. First, we must have a … Continue reading How-To: Write bUnit Test for Component