Skip to content

Commit

Permalink
housekeeping: Added ReactiveUI.Splat.Tests (reactiveui#1991)
Browse files Browse the repository at this point in the history
  • Loading branch information
RLittlesII authored and glennawatson committed Apr 4, 2019
1 parent 87a180e commit 1573e1f
Show file tree
Hide file tree
Showing 4 changed files with 207 additions and 1 deletion.
3 changes: 2 additions & 1 deletion build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ if (IsRunningOnWindows())

var packageTestWhitelist = new List<FilePath>
{
MakeAbsolute(File("./src/ReactiveUI.Tests/ReactiveUI.Tests.csproj")),
MakeAbsolute(File("./src/ReactiveUI.Tests/ReactiveUI.Tests.csproj")),
MakeAbsolute(File("./src/ReactiveUI.Splat.Tests/ReactiveUI.Splat.Tests.csproj"))
};

if (IsRunningOnWindows())
Expand Down
19 changes: 19 additions & 0 deletions src/ReactiveUI.Splat.Tests/ReactiveUI.Splat.Tests.csproj
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>
128 changes: 128 additions & 0 deletions src/ReactiveUI.Splat.Tests/SplatAdapterTests.cs
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));
}
}
}
58 changes: 58 additions & 0 deletions src/ReactiveUI.sln
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReactiveUI.Fody.Helpers", "
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReactiveUI.Fody.Tests", "ReactiveUI.Fody.Tests\ReactiveUI.Fody.Tests.csproj", "{404B0F3F-7343-4E54-A863-F27B99FE788B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReactiveUI.Splat.Tests", "ReactiveUI.Splat.Tests\ReactiveUI.Splat.Tests.csproj", "{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Ad-Hoc|Any CPU = Ad-Hoc|Any CPU
Expand Down Expand Up @@ -700,6 +702,62 @@ Global
{404B0F3F-7343-4E54-A863-F27B99FE788B}.Release|x64.Build.0 = Release|Any CPU
{404B0F3F-7343-4E54-A863-F27B99FE788B}.Release|x86.ActiveCfg = Release|Any CPU
{404B0F3F-7343-4E54-A863-F27B99FE788B}.Release|x86.Build.0 = Release|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Ad-Hoc|Mixed Platforms.ActiveCfg = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Ad-Hoc|Mixed Platforms.Build.0 = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Ad-Hoc|x64.Build.0 = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Ad-Hoc|x86.Build.0 = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.AppStore|Any CPU.Build.0 = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.AppStore|ARM.ActiveCfg = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.AppStore|ARM.Build.0 = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.AppStore|iPhone.Build.0 = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.AppStore|Mixed Platforms.ActiveCfg = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.AppStore|Mixed Platforms.Build.0 = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.AppStore|x64.ActiveCfg = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.AppStore|x64.Build.0 = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.AppStore|x86.ActiveCfg = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.AppStore|x86.Build.0 = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Debug|ARM.ActiveCfg = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Debug|ARM.Build.0 = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Debug|iPhone.Build.0 = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Debug|x64.ActiveCfg = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Debug|x64.Build.0 = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Debug|x86.ActiveCfg = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Debug|x86.Build.0 = Debug|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Release|Any CPU.Build.0 = Release|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Release|ARM.ActiveCfg = Release|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Release|ARM.Build.0 = Release|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Release|iPhone.ActiveCfg = Release|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Release|iPhone.Build.0 = Release|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Release|x64.ActiveCfg = Release|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Release|x64.Build.0 = Release|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Release|x86.ActiveCfg = Release|Any CPU
{7ED6D69F-138F-40BD-9F37-3E4050E4D19B}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down

0 comments on commit 1573e1f

Please sign in to comment.