BlazorPro.BlazorSize.UnitTesting 6.0.0

Install-Package BlazorPro.BlazorSize.UnitTesting -Version 6.0.0
dotnet add package BlazorPro.BlazorSize.UnitTesting --version 6.0.0
<PackageReference Include="BlazorPro.BlazorSize.UnitTesting" Version="6.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BlazorPro.BlazorSize.UnitTesting --version 6.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: BlazorPro.BlazorSize.UnitTesting, 6.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install BlazorPro.BlazorSize.UnitTesting as a Cake Addin
#addin nuget:?package=BlazorPro.BlazorSize.UnitTesting&version=6.0.0

// Install BlazorPro.BlazorSize.UnitTesting as a Cake Tool
#tool nuget:?package=BlazorPro.BlazorSize.UnitTesting&version=6.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Requires BlazorSize 5.0 +

BlazorSize will use a FakeMediaQueryService for test cases.

Example:

<h1>Sample.razor</h1>
<MediaQuery Media="@Breakpoints.SmallDown">
    <Matched>
        MATCHES
    </Matched>
    <Unmatched>
        DOES NOT MATCH
    </Unmatched>
</MediaQuery>

Use SetActiveBreakPoint to toggle the media query under test.

[Fact]
public void Shows_Correct_Content_Based_On_MediaQuery()
{
    // Arrange
    using var ctx = new TestContext();
    
    // Resolve FakeMediaQueryService
    var blazorSizeState = ctx.AddBlazorSize(); 

    // Determine what breakpoint to respond to
    blazorSizeState.SetActiveBreakPoint(Breakpoints.LargeDown);

    // Act
    var cut = ctx.RenderComponent<Sample>();

    // Assert
    cut.MarkupMatches("DOES NOT MATCH");

    // Change breakpoint
    blazorSizeState.SetActiveBreakPoint(Breakpoints.SmallDown);

    // Assert
    cut.MarkupMatches("MATCHES");
}

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
6.0.0 69 11/10/2021
6.0.0-pre2 56 10/5/2021

6.0.0 Added support for bUnit.