mirror of
https://github.com/AtomUI/AtomUI.git
synced 2026-10-24 10:12:35 +08:00
40 lines
1.3 KiB
C#
40 lines
1.3 KiB
C#
using AtomUI.Controls;
|
|
using Avalonia;
|
|
using Shouldly;
|
|
using Xunit;
|
|
|
|
namespace AtomUI.Core.Tests.AppLifecycle;
|
|
|
|
public class ImageLoadingApplicationBuilderTests
|
|
{
|
|
[Fact]
|
|
public void Independent_UseAtomUI_Builders_Publish_Separate_Image_Loaders()
|
|
{
|
|
HeadlessTestApp.Run(() =>
|
|
{
|
|
var firstApplication = new Avalonia.Application();
|
|
var secondApplication = new Avalonia.Application();
|
|
try
|
|
{
|
|
firstApplication.UseAtomUI(builder => builder.UseImageLoading());
|
|
secondApplication.UseAtomUI(builder => builder.UseImageLoading());
|
|
|
|
var firstLoader = firstApplication.GetImageLoader();
|
|
var secondLoader = secondApplication.GetImageLoader();
|
|
|
|
firstLoader.ShouldNotBeSameAs(secondLoader);
|
|
firstLoader.Snapshot.ShouldBe(default(ImageLoaderSnapshot));
|
|
secondLoader.Snapshot.ShouldBe(default(ImageLoaderSnapshot));
|
|
}
|
|
finally
|
|
{
|
|
ApplicationScopeRegistry.Get(secondApplication)?.Dispose();
|
|
ApplicationScopeRegistry.Get(firstApplication)?.Dispose();
|
|
}
|
|
|
|
firstApplication.TryGetImageLoader().ShouldBeNull();
|
|
secondApplication.TryGetImageLoader().ShouldBeNull();
|
|
});
|
|
}
|
|
}
|