bUnit bUnit

    Show / Hide Table of Contents

    Class Fixture

    Inheritance
    System.Object
    TestContextBase
    RazorTestBase
    FixtureBase<Fixture>
    Fixture
    Implements
    System.IDisposable
    Microsoft.AspNetCore.Components.IComponent
    Inherited Members
    FixtureBase<Fixture>.DisplayName
    FixtureBase<Fixture>.ChildContent
    FixtureBase<Fixture>.Setup
    FixtureBase<Fixture>.SetupAsync
    FixtureBase<Fixture>.Test
    FixtureBase<Fixture>.TestAsync
    FixtureBase<Fixture>.SetParametersAsync(ParameterView)
    FixtureBase<Fixture>.Validate()
    FixtureBase<Fixture>.Run(Fixture)
    RazorTestBase.IsRunning
    RazorTestBase.Description
    RazorTestBase.Skip
    RazorTestBase.Timeout
    RazorTestBase.RunTest()
    RazorTestBase.IComponent.Attach(RenderHandle)
    RazorTestBase.TryRun<T>(Action<T>, T)
    RazorTestBase.TryRunAsync<T>(Func<T, Task>, T)
    TestContextBase.Renderer
    TestContextBase.Services
    TestContextBase.RenderTree
    TestContextBase.Dispose()
    TestContextBase.Dispose(Boolean)
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Bunit
    Assembly: Bunit.Web.dll
    Syntax
    public class Fixture : FixtureBase<Fixture>, IDisposable, IComponent

    Constructors

    | Improve this Doc View Source

    Fixture()

    Creates an instance of the Fixture type.

    Declaration
    public Fixture()

    Properties

    | Improve this Doc View Source

    JSInterop

    Gets bUnits JSInterop, that allows setting up handlers for Microsoft.JSInterop.IJSRuntime.InvokeAsync``1(System.String,System.Object[]) invocations that components under tests will issue during testing. It also makes it possible to verify that the invocations has happened as expected.

    Declaration
    public BunitJSInterop JSInterop { get; }
    Property Value
    Type Description
    BunitJSInterop

    Methods

    | Improve this Doc View Source

    GetComponentUnderTest()

    Gets (and renders) the markup/component defined in the <Fixture><ComponentUnderTest>...<ComponentUnderTest/><Fixture/> element.

    The HTML/component is only rendered the first this method is called.

    Declaration
    public IRenderedFragment GetComponentUnderTest()
    Returns
    Type Description
    IRenderedFragment

    A IRenderedFragmentBase

    | Improve this Doc View Source

    GetComponentUnderTest<TComponent>()

    Gets (and renders) the component of type TComponent defined in the <Fixture><ComponentUnderTest>...<ComponentUnderTest/><Fixture/> element.

    The HTML/component is only rendered the first this method is called.

    Declaration
    public IRenderedComponent<TComponent> GetComponentUnderTest<TComponent>()
    
        where TComponent : IComponent
    Returns
    Type Description
    IRenderedComponent<TComponent>

    A IRenderedComponentBase<TComponent>

    Type Parameters
    Name Description
    TComponent

    The type of component to render

    | Improve this Doc View Source

    GetFragment(String)

    Gets (and renders) the markup/component defined in the <Fixture><Fragment id="id" >...<Fragment/><Fixture/> element.

    If id is null/not provided, the component defined in the first <Fragment/> in the <Fixture/> element is returned.

    The HTML/component is only rendered the first this method is called.

    Declaration
    public IRenderedFragment GetFragment(string id = null)
    Parameters
    Type Name Description
    System.String id

    The id of the fragment where the HTML/component is defined in Razor syntax.

    Returns
    Type Description
    IRenderedFragment

    A IRenderedFragmentBase

    | Improve this Doc View Source

    GetFragment<TComponent>(String)

    Gets (and renders) the component of type TComponent defined in the <Fixture><Fragment id="id" >...<Fragment/><Fixture/> element.

    If id is null/not provided, the component defined in the first <Fragment/> in the <Fixture/> element is returned.

    The HTML/component is only rendered the first this method is called.

    Declaration
    public IRenderedComponent<TComponent> GetFragment<TComponent>(string id = null)
    
        where TComponent : IComponent
    Parameters
    Type Name Description
    System.String id

    The id of the fragment where the component is defined in Razor syntax.

    Returns
    Type Description
    IRenderedComponent<TComponent>

    A IRenderedComponentBase<TComponent>

    Type Parameters
    Name Description
    TComponent

    The type of component to render

    | Improve this Doc View Source

    Run()

    Declaration
    protected override Task Run()
    Returns
    Type Description
    System.Threading.Tasks.Task
    Overrides
    RazorTestBase.Run()

    Implements

    System.IDisposable
    Microsoft.AspNetCore.Components.IComponent

    Extension Methods

    JSRuntimeAssertExtensions.ShouldBeElementReferenceTo(Object, IElement)
    FakeAuthorizationExtensions.AddTestAuthorization(TestContextBase)

    Editorial support provided by Packt.

    • Improve this Doc
    • View Source
    Back to top Documentation updated on 1/20/2021 6:00:54 PM +00:00 in commit b61b4ab737.