From the course: Blazor: Getting Started
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Unit testing components with parameters and services - Blazor Tutorial
From the course: Blazor: Getting Started
Unit testing components with parameters and services
- [Instructor] Now, let's use a mock data service in a test. We'll open up the test project in the counter razor tests. We'll start down here with the fixture test first. The fixture and snapshot tests are only available for X unit at the time of this recording. The syntax allows for a little more flexibility, and it's easier to put a component within a component, but there's nothing that we're testing that we couldn't test with C-Sharp alone. The import.razor here works the same as it does in the client project. Since we're going to be testing our components, let's add beam.client here. Since we're also using our Idata service, we'll add that namespace as well and save. Let's go back to the test fixture. We'll ignore the snapshot test for a minute. We'll change the description to match what we're testing. We'll test, add a new frequency appears in the list and name the test, test frequency list add. I'll copy that…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
Debugging with Blazor7m 9s
-
(Locked)
Unit testing with Blazor8m 48s
-
(Locked)
Application changes for unit testing12m 4s
-
(Locked)
Unit testing components with parameters and services10m 4s
-
(Locked)
Forms and validation with Blazor10m 8s
-
(Locked)
Challenge: RayInput validation55s
-
(Locked)
Solution: RayInput validation3m 4s
-
-
-
-
-