26 lines
631 B
C#
26 lines
631 B
C#
using Bunit;
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
|
|
namespace AyCode.Blazor.Components.Tests;
|
|
|
|
/// <summary>
|
|
/// Base class for bUnit tests using MSTest.
|
|
/// Provides BunitContext setup and teardown.
|
|
/// </summary>
|
|
public abstract class BunitTestContext : TestContextWrapper
|
|
{
|
|
[TestInitialize]
|
|
public void Setup() => Context = new BunitContext();
|
|
|
|
[TestCleanup]
|
|
public void TearDown() => Context?.Dispose();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Wrapper for bUnit BunitContext to work with MSTest lifecycle.
|
|
/// </summary>
|
|
public abstract class TestContextWrapper
|
|
{
|
|
protected BunitContext? Context { get; set; }
|
|
}
|