A cross-platform UI framework for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

27 lines
642 B

using System;
using System.Threading;
using Avalonia.Controls;
using Avalonia.Threading;
using Xunit;
namespace Avalonia.UnitTests;
[Collection("Scoped Not Parallel")]
public class ScopedTestBase : IDisposable
{
private readonly IDisposable _scope;
public ScopedTestBase()
{
AvaloniaLocator.Current = AvaloniaLocator.CurrentMutable = new AvaloniaLocator();
Dispatcher.ResetBeforeUnitTests();
Control.ResetLoadedQueueForUnitTests();
_scope = AvaloniaLocator.EnterScope();
}
public virtual void Dispose()
{
Dispatcher.ResetForUnitTests();
_scope.Dispose();
}
}