Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Writes bUnit v2 component tests for BlazorWebFormsComponents using BlazorWebFormsTestContext, Shouldly assertions, and JS interop mocking.
36% 82%+45 ptsof test cases passed
Passed 18 of 22 test cases with the skill, and 8 of 22 without it.
3 of 3 safety checks passed
Not used yet
This skill covers writing new bUnit v2 component tests for the BlazorWebFormsComponents library.
Not for migration. If you need to migrate existing tests from bUnit beta to v2, use the
bunit-test-migrationskill instead.
All BWFC component tests should inherit from BlazorWebFormsTestContext, which extends bUnit's BunitContext with pre-registered services:
public abstract class BlazorWebFormsTestContext : BunitContext
{
// Pre-configured:
// - JSInterop.Mode = JSRuntimeMode.Loose
// - LinkGenerator (mocked)
// - IHttpContextAccessor (mocked)
// - IWebHostEnvironment (mocked with temp paths)
// - IMemoryCache
// - CacheShim, ServerShim, ClientScriptShim
// - ILogger<T> (with optional xUnit output)
}
This base class ensures components that depend on WebFormsPageBase shims can render without additional setup.
Tests are .razor files organized by component name:
src/BlazorWebFormsComponents.Test/
├── Button/
│ ├── Click.razor
│ ├── Enabled.razor
│ └── Style.razor
├── GridView/
│ ├── Selection.razor
Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.