8 changed files with 90 additions and 67 deletions
@ -0,0 +1,5 @@ |
|||
<ProjectConfiguration> |
|||
<Settings> |
|||
<IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely> |
|||
</Settings> |
|||
</ProjectConfiguration> |
|||
@ -1,15 +0,0 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
<PropertyGroup> |
|||
<TargetFramework>netcoreapp3.1</TargetFramework> |
|||
</PropertyGroup> |
|||
<Import Project="..\..\build\UnitTests.NetCore.targets" /> |
|||
<Import Project="..\..\build\Moq.props" /> |
|||
<Import Project="..\..\build\XUnit.props" /> |
|||
<Import Project="..\..\build\Rx.props" /> |
|||
<Import Project="..\..\build\Microsoft.Reactive.Testing.props" /> |
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\src\Markup\Avalonia.Markup.Xaml.Loader\Avalonia.Markup.Xaml.Loader.csproj" /> |
|||
<ProjectReference Include="..\Avalonia.UnitTests\Avalonia.UnitTests.csproj" /> |
|||
<ProjectReference Include="..\..\src\Avalonia.ReactiveUI.Events\Avalonia.ReactiveUI.Events.csproj" /> |
|||
</ItemGroup> |
|||
</Project> |
|||
@ -1,44 +0,0 @@ |
|||
using System; |
|||
using System.Reactive.Linq; |
|||
using Avalonia.Controls; |
|||
using Avalonia.UnitTests; |
|||
using Xunit; |
|||
|
|||
namespace Avalonia.ReactiveUI.Events.UnitTests |
|||
{ |
|||
public class BasicControlEventsTest |
|||
{ |
|||
public class EventsControl : UserControl |
|||
{ |
|||
public bool IsAttached { get; private set; } |
|||
|
|||
public EventsControl() |
|||
{ |
|||
var attached = this |
|||
.Events() |
|||
.AttachedToVisualTree |
|||
.Select(args => true); |
|||
|
|||
this.Events() |
|||
.DetachedFromVisualTree |
|||
.Select(args => false) |
|||
.Merge(attached) |
|||
.Subscribe(marker => IsAttached = marker); |
|||
} |
|||
} |
|||
|
|||
[Fact] |
|||
public void Should_Generate_Events_Wrappers() |
|||
{ |
|||
var root = new TestRoot(); |
|||
var control = new EventsControl(); |
|||
Assert.False(control.IsAttached); |
|||
|
|||
root.Child = control; |
|||
Assert.True(control.IsAttached); |
|||
|
|||
root.Child = null; |
|||
Assert.False(control.IsAttached); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue