forked from reactiveui/ReactiveUI
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
housekeeping: Added ReactiveUI.Splat.Tests (reactiveui#1991)
- Loading branch information
1 parent
87a180e
commit 1573e1f
Showing
4 changed files
with
207 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp2.2</TargetFramework> | ||
|
||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Splat.Autofac" Version="7.*" /> | ||
<PackageReference Include="Splat.DryIoc" Version="7.*" /> | ||
<PackageReference Include="Splat.Ninject" Version="7.*" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\ReactiveUI\ReactiveUI.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Autofac; | ||
using DryIoc; | ||
using Ninject; | ||
using Shouldly; | ||
using Splat; | ||
using Splat.Autofac; | ||
using Splat.DryIoc; | ||
using Splat.Ninject; | ||
using Xunit; | ||
|
||
namespace ReactiveUI.Splat.Tests | ||
{ | ||
public class SplatAdapterTests | ||
{ | ||
/// <summary> | ||
/// Shoulds register ReactiveUI binding type converters. | ||
/// </summary> | ||
[Fact] | ||
public void DryIocDependencyResolver_Should_Register_ReactiveUI_BindingTypeConverters() | ||
{ | ||
// Invoke RxApp which initializes the ReactiveUI platform. | ||
var scheduler = RxApp.MainThreadScheduler; | ||
var container = new Container(); | ||
container.UseDryIocDependencyResolver(); | ||
|
||
var converters = container.Resolve<IEnumerable<IBindingTypeConverter>>().ToList(); | ||
|
||
converters.ShouldNotBeNull(); | ||
converters.ShouldContain(x => x.GetType() == typeof(StringConverter)); | ||
converters.ShouldContain(x => x.GetType() == typeof(EqualityTypeConverter)); | ||
} | ||
|
||
/// <summary> | ||
/// Shoulds register ReactiveUI creates command bindings. | ||
/// </summary> | ||
[Fact] | ||
public void DryIocDependencyResolver_Should_Register_ReactiveUI_CreatesCommandBinding() | ||
{ | ||
// Invoke RxApp which initializes the ReactiveUI platform. | ||
var scheduler = RxApp.MainThreadScheduler; | ||
var container = new Container(); | ||
container.UseDryIocDependencyResolver(); | ||
|
||
var converters = container.Resolve<IEnumerable<ICreatesCommandBinding>>().ToList(); | ||
|
||
converters.ShouldNotBeNull(); | ||
converters.ShouldContain(x => x.GetType() == typeof(CreatesCommandBindingViaEvent)); | ||
converters.ShouldContain(x => x.GetType() == typeof(CreatesCommandBindingViaCommandParameter)); | ||
} | ||
|
||
/// <summary> | ||
/// Shoulds register ReactiveUI binding type converters. | ||
/// </summary> | ||
[Fact] | ||
public void AutofacDependencyResolver_Should_Register_ReactiveUI_BindingTypeConverters() | ||
{ | ||
// Invoke RxApp which initializes the ReactiveUI platform. | ||
var scheduler = RxApp.MainThreadScheduler; | ||
var builder = new ContainerBuilder(); | ||
var container = builder.Build(); | ||
Locator.SetLocator(new AutofacDependencyResolver(container)); | ||
|
||
var converters = container.Resolve<IEnumerable<IBindingTypeConverter>>().ToList(); | ||
|
||
converters.ShouldNotBeNull(); | ||
converters.ShouldContain(x => x.GetType() == typeof(StringConverter)); | ||
converters.ShouldContain(x => x.GetType() == typeof(EqualityTypeConverter)); | ||
} | ||
|
||
/// <summary> | ||
/// Shoulds register ReactiveUI creates command bindings. | ||
/// </summary> | ||
[Fact] | ||
public void AutofacDependencyResolver_Should_Register_ReactiveUI_CreatesCommandBinding() | ||
{ | ||
// Invoke RxApp which initializes the ReactiveUI platform. | ||
var scheduler = RxApp.MainThreadScheduler; | ||
var builder = new ContainerBuilder(); | ||
var container = builder.Build(); | ||
Locator.SetLocator(new AutofacDependencyResolver(container)); | ||
|
||
var converters = container.Resolve<IEnumerable<ICreatesCommandBinding>>().ToList(); | ||
|
||
converters.ShouldNotBeNull(); | ||
converters.ShouldContain(x => x.GetType() == typeof(CreatesCommandBindingViaEvent)); | ||
converters.ShouldContain(x => x.GetType() == typeof(CreatesCommandBindingViaCommandParameter)); | ||
} | ||
|
||
/// <summary> | ||
/// Shoulds register ReactiveUI binding type converters. | ||
/// </summary> | ||
[Fact] | ||
public void NinjectDependencyResolver_Should_Register_ReactiveUI_BindingTypeConverters() | ||
{ | ||
// Invoke RxApp which initializes the ReactiveUI platform. | ||
var scheduler = RxApp.MainThreadScheduler; | ||
var container = new StandardKernel(); | ||
container.UseNinjectDependencyResolver(); | ||
|
||
var converters = container.GetAll<IBindingTypeConverter>().ToList(); | ||
|
||
converters.ShouldNotBeNull(); | ||
converters.ShouldContain(x => x.GetType() == typeof(StringConverter)); | ||
converters.ShouldContain(x => x.GetType() == typeof(EqualityTypeConverter)); | ||
} | ||
|
||
/// <summary> | ||
/// Shoulds register ReactiveUI creates command bindings. | ||
/// </summary> | ||
[Fact] | ||
public void NinjectDependencyResolver_Should_Register_ReactiveUI_CreatesCommandBinding() | ||
{ | ||
// Invoke RxApp which initializes the ReactiveUI platform. | ||
var scheduler = RxApp.MainThreadScheduler; | ||
var container = new StandardKernel(); | ||
container.UseNinjectDependencyResolver(); | ||
|
||
var converters = container.GetAll<ICreatesCommandBinding>().ToList(); | ||
|
||
converters.ShouldNotBeNull(); | ||
converters.ShouldContain(x => x.GetType() == typeof(CreatesCommandBindingViaEvent)); | ||
converters.ShouldContain(x => x.GetType() == typeof(CreatesCommandBindingViaCommandParameter)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters