added XUnit2 testkit
fixed up the ResizerSpec tests
used the actual deathwatch to make the DeathWatchSpec better and not racy
adjusting teamcity output and exiting with 0 even if tests fail in multinode runner
removed the extra copy of Akka.Cluster.Tests so the fake script doesn't pick up three
Moved multinode tests to their own assembly so we don't have skipped tests and it matches up with what akka has a bit.
Fixed the ThrottlerTransportAdapterSpec
Updated the MultiNodeTests to support xunit 2.0
Fixed ActorRefSpec test to handle race condition.
test An_ActoRef_should_return_EmptyLocalActorRef_on_deserialize_if_not_present_in_actor_hierarchy_and_remoting_is_not_enabled
RoutingSpec.Router_in_general_must_evict_terminated_routees will now use poison pill and wait for the terminated msg.
fixed up how project gets required nugets and removed the repositories.config.
updated fake and used xunit2helper in fake script
This commit is contained in:
Joshua Benjamin 2015-04-16 23:28:52 -07:00
Родитель a786340ba7
Коммит 2834d913bb
103 изменённых файлов: 1793 добавлений и 393 удалений

1
.gitignore поставляемый
Просмотреть файл

@ -210,3 +210,4 @@ FakesAssemblies/
/src/.Akka.boltdata/Settings.json
/src/.Akka.boltdata/TestResults.json
resetdev.bat
/src/packages/repositories.config

Просмотреть файл

@ -4,9 +4,9 @@ pushd %~dp0
src\.nuget\NuGet.exe update -self
src\.nuget\NuGet.exe install FAKE -ConfigFile src\.nuget\Nuget.Config -OutputDirectory src\packages -ExcludeVersion -Version 3.4.1
src\.nuget\NuGet.exe install FAKE -ConfigFile src\.nuget\Nuget.Config -OutputDirectory src\packages -ExcludeVersion -Version 3.28.8
src\.nuget\NuGet.exe install xunit.runners -ConfigFile src\.nuget\Nuget.Config -OutputDirectory src\packages\FAKE -ExcludeVersion -Version 1.9.2
src\.nuget\NuGet.exe install xunit.runner.console -ConfigFile src\.nuget\Nuget.Config -OutputDirectory src\packages\FAKE -ExcludeVersion -Version 2.0.0
src\.nuget\NuGet.exe install nunit.runners -ConfigFile src\.nuget\Nuget.Config -OutputDirectory src\packages\FAKE -ExcludeVersion -Version 2.6.4
if not exist src\packages\SourceLink.Fake\tools\SourceLink.fsx (
@ -17,6 +17,4 @@ rem cls
set encoding=utf-8
src\packages\FAKE\tools\FAKE.exe build.fsx %*
popd
popd

Просмотреть файл

@ -4,6 +4,7 @@
open System
open System.IO
open System.Text
open Fake
open Fake.FileUtils
open Fake.MSTest
@ -58,6 +59,14 @@ let nugetExe = FullName @"src\.nuget\NuGet.exe"
let docDir = "bin" @@ "doc"
Target "RestorePackages" (fun _ ->
"./src/Akka.sln"
|> RestoreMSSolutionPackages (fun p ->
{ p with
OutputPath = "./src/packages"
Retries = 4 })
)
//--------------------------------------------------------------------------------
// Clean build results
@ -67,7 +76,6 @@ Target "Clean" <| fun _ ->
//--------------------------------------------------------------------------------
// Generate AssemblyInfo files with the version for release notes
open AssemblyInfoFile
Target "AssemblyInfo" <| fun _ ->
for file in !! "src/**/AssemblyInfo.fs" do
@ -182,6 +190,7 @@ Target "CopyOutput" <| fun _ ->
"contrib/dependencyinjection/Akka.DI.Ninject"
"contrib/testkits/Akka.TestKit.Xunit"
"contrib/testkits/Akka.TestKit.NUnit"
"contrib/testkits/Akka.TestKit.Xunit2"
]
|> List.iter copyOutput
@ -201,7 +210,7 @@ Target "CleanTests" <| fun _ ->
//--------------------------------------------------------------------------------
// Run tests
open XUnitHelper
open XUnit2Helper
Target "RunTests" <| fun _ ->
let msTestAssemblies = !! "src/**/bin/Release/Akka.TestKit.VsTest.Tests.dll"
let nunitTestAssemblies = !! "src/**/bin/Release/Akka.TestKit.NUnit.Tests.dll"
@ -219,9 +228,9 @@ Target "RunTests" <| fun _ ->
DisableShadowCopy = true;
OutputFile = testOutput + @"\NUnitTestResults.xml"})
let xunitToolPath = findToolInSubPath "xunit.console.clr4.exe" "src/packages/xunit.runners*"
let xunitToolPath = findToolInSubPath "xunit.console.exe" "src/packages/xunit.runner.console*/tools"
printfn "Using XUnit runner: %s" xunitToolPath
xUnit
xUnit2
(fun p -> { p with OutputDir = testOutput; ToolPath = xunitToolPath })
xunitTestAssemblies
@ -230,9 +239,9 @@ Target "RunTestsMono" <| fun _ ->
mkdir testOutput
let xunitToolPath = findToolInSubPath "xunit.console.clr4.exe" "src/packages/xunit.runners*"
let xunitToolPath = findToolInSubPath "xunit.console.exe" "src/packages/xunit.runner.console*/tools"
printfn "Using XUnit runner: %s" xunitToolPath
xUnit
xUnit2
(fun p -> { p with OutputDir = testOutput; ToolPath = xunitToolPath })
xunitTestAssemblies
@ -240,8 +249,14 @@ Target "MultiNodeTests" <| fun _ ->
let multiNodeTestPath = findToolInSubPath "Akka.MultiNodeTestRunner.exe" "bin/core/Akka.MultiNodeTestRunner*"
printfn "Using MultiNodeTestRunner: %s" multiNodeTestPath
let spec = getBuildParam "spec"
let args = new StringBuilder()
|> append "Akka.MultiNodeTests.dll"
|> append "-Dmultinode.enable-filesink=on"
|> appendIfNotNullOrEmpty spec "-Dmultinode.test-spec="
|> toText
let args = "Akka.Cluster.Tests.dll -Dmultinode.enable-filesink=on"
let result = ExecProcess(fun info ->
info.FileName <- multiNodeTestPath
info.WorkingDirectory <- (Path.GetDirectoryName (FullName multiNodeTestPath))
@ -308,7 +323,7 @@ let createNugetPackages _ =
let projectDir = Path.GetDirectoryName nuspec
let projectFile = (!! (projectDir @@ project + ".*sproj")) |> Seq.head
let releaseDir = projectDir @@ @"bin\Release"
let packages = projectDir @@ "packages.config"
let packages = projectDir @@ "packages.config"
let packageDependencies = if (fileExists packages) then (getDependencies packages) else []
let dependencies = packageDependencies @ getAkkaDependency project
let releaseVersion = getProjectVersion project
@ -511,7 +526,7 @@ Target "HelpDocs" <| fun _ ->
//--------------------------------------------------------------------------------
// build dependencies
"Clean" ==> "AssemblyInfo" ==> "Build" ==> "CopyOutput" ==> "BuildRelease"
"Clean" ==> "AssemblyInfo" ==> "RestorePackages" ==> "Build" ==> "CopyOutput" ==> "BuildRelease"
// tests dependencies
"CleanTests" ==> "RunTests"

Просмотреть файл

@ -3,4 +3,7 @@
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
<activePackageSource>
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
</activePackageSource>
</configuration>

Просмотреть файл

@ -194,6 +194,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Akka.Persistence.SqlServer"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Akka.Persistence.SqlServer.Tests", "contrib\persistence\Akka.Persistence.SqlServer.Tests\Akka.Persistence.SqlServer.Tests.csproj", "{5A3C24D7-0D1C-4974-BBB4-22AC792666DE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Akka.TestKit.Xunit2", "contrib\testkits\Akka.TestKit.Xunit2\Akka.TestKit.Xunit2.csproj", "{7DBD5C17-5E9D-40C4-9201-D092751532A7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Akka.MultiNodeTests", "core\Akka.MultiNodeTests\Akka.MultiNodeTests.csproj", "{F0781BEA-5BA0-4AF0-BB15-E3F209B681F5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug Mono|Any CPU = Debug Mono|Any CPU
@ -703,6 +707,22 @@ Global
{5A3C24D7-0D1C-4974-BBB4-22AC792666DE}.Release Mono|Any CPU.Build.0 = Release|Any CPU
{5A3C24D7-0D1C-4974-BBB4-22AC792666DE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5A3C24D7-0D1C-4974-BBB4-22AC792666DE}.Release|Any CPU.Build.0 = Release|Any CPU
{7DBD5C17-5E9D-40C4-9201-D092751532A7}.Debug Mono|Any CPU.ActiveCfg = Debug|Any CPU
{7DBD5C17-5E9D-40C4-9201-D092751532A7}.Debug Mono|Any CPU.Build.0 = Debug|Any CPU
{7DBD5C17-5E9D-40C4-9201-D092751532A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7DBD5C17-5E9D-40C4-9201-D092751532A7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7DBD5C17-5E9D-40C4-9201-D092751532A7}.Release Mono|Any CPU.ActiveCfg = Release|Any CPU
{7DBD5C17-5E9D-40C4-9201-D092751532A7}.Release Mono|Any CPU.Build.0 = Release|Any CPU
{7DBD5C17-5E9D-40C4-9201-D092751532A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7DBD5C17-5E9D-40C4-9201-D092751532A7}.Release|Any CPU.Build.0 = Release|Any CPU
{F0781BEA-5BA0-4AF0-BB15-E3F209B681F5}.Debug Mono|Any CPU.ActiveCfg = Debug|Any CPU
{F0781BEA-5BA0-4AF0-BB15-E3F209B681F5}.Debug Mono|Any CPU.Build.0 = Debug|Any CPU
{F0781BEA-5BA0-4AF0-BB15-E3F209B681F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F0781BEA-5BA0-4AF0-BB15-E3F209B681F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F0781BEA-5BA0-4AF0-BB15-E3F209B681F5}.Release Mono|Any CPU.ActiveCfg = Release|Any CPU
{F0781BEA-5BA0-4AF0-BB15-E3F209B681F5}.Release Mono|Any CPU.Build.0 = Release|Any CPU
{F0781BEA-5BA0-4AF0-BB15-E3F209B681F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F0781BEA-5BA0-4AF0-BB15-E3F209B681F5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -789,5 +809,7 @@ Global
{264C22A4-CAFC-41F6-B82C-4DDC5C196767} = {588C1513-FAB6-42C3-B6FC-3485F13620CF}
{BAC85686-AFC4-413E-98DC-5ED8F468BC63} = {264C22A4-CAFC-41F6-B82C-4DDC5C196767}
{5A3C24D7-0D1C-4974-BBB4-22AC792666DE} = {264C22A4-CAFC-41F6-B82C-4DDC5C196767}
{7DBD5C17-5E9D-40C4-9201-D092751532A7} = {7625FD95-4B2C-4A5B-BDD5-94B1493FAC8E}
{F0781BEA-5BA0-4AF0-BB15-E3F209B681F5} = {01167D3C-49C4-4CDE-9787-C176D139ACDD}
EndGlobalSection
EndGlobal

Просмотреть файл

@ -13,6 +13,7 @@
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<NuGetPackageImportStamp>a4af550d</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -38,22 +39,20 @@
<Reference Include="Microsoft.CSharp" />
<Reference Include="xunit">
<HintPath>..\..\..\packages\xunit.1.9.2\lib\net20\xunit.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\..\SharedAssemblyInfo.cs">
<Link>Properties\SharedAssemblyInfo.cs</Link>
</Compile>
<Compile Include="Internals\AkkaAssertEqualityComparerAdapter.cs" />
<Compile Include="Internals\AkkaAssertEqualityComparer.cs" />
<Compile Include="Internals\AkkaAssertEqualityComparerAdapter.cs" />
<Compile Include="Internals\AkkaEqualException.cs" />
<Compile Include="TestKit.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TestKit.cs" />
<Compile Include="XunitAssertions.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\core\Akka.TestKit\Akka.TestKit.csproj">
<Project>{0D3CBAD0-BBDB-43E5-AFC4-ED1D3ECDC224}</Project>
@ -64,6 +63,9 @@
<Name>Akka</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

Просмотреть файл

@ -6,7 +6,7 @@
<version>@build.number@</version>
<authors>@authors@</authors>
<owners>@authors@</owners>
<description>TestKit for writing tests for Akka.NET using xUnit.</description>
<description>TestKit for writing tests for Akka.NET using xUnit 1.9.2.</description>
<licenseUrl>https://github.com/akkadotnet/akka.net/blob/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/akkadotnet/akka.net</projectUrl>
<iconUrl>http://getakka.net/images/AkkaNetLogo.Normal.png</iconUrl>

Просмотреть файл

@ -23,11 +23,12 @@ namespace Akka.TestKit.Xunit.Internals
_args = args;
}
public AkkaEqualException(object expected, object actual, bool skipPositionCheck, string format = "", params object[] args)
public AkkaEqualException(object expected, object actual, bool skipPositionCheck, string format = "",
params object[] args)
: base(expected, actual, skipPositionCheck)
{
_format = format;
_args = args;
_format = format;
}
protected AkkaEqualException(SerializationInfo info, StreamingContext context)

Просмотреть файл

@ -0,0 +1,89 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props" Condition="Exists('..\..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{7DBD5C17-5E9D-40C4-9201-D092751532A7}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Akka.TestKit.Xunit2</RootNamespace>
<AssemblyName>Akka.TestKit.Xunit2</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<NuGetPackageImportStamp>6577902d</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="xunit.abstractions">
<HintPath>..\..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
</Reference>
<Reference Include="xunit.assert">
<HintPath>..\..\..\packages\xunit.assert.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.assert.dll</HintPath>
</Reference>
<Reference Include="xunit.core">
<HintPath>..\..\..\packages\xunit.extensibility.core.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\..\SharedAssemblyInfo.cs">
<Link>Properties\SharedAssemblyInfo.cs</Link>
</Compile>
<Compile Include="Internals\AkkaAssertEqualityComparer.cs" />
<Compile Include="Internals\AkkaAssertEqualityComparerAdapter.cs" />
<Compile Include="Internals\AkkaEqualException.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TestKit.cs" />
<Compile Include="XunitAssertions.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\core\Akka.TestKit\Akka.TestKit.csproj">
<Project>{0d3cbad0-bbdb-43e5-afc4-ed1d3ecdc224}</Project>
<Name>Akka.TestKit</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\core\Akka\Akka.csproj">
<Project>{5deddf90-37f0-48d3-a0b0-a5cbd8a7e377}</Project>
<Name>Akka</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
<Error Condition="!Exists('..\..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

Просмотреть файл

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>@project@</id>
<title>@project@@title@</title>
<version>@build.number@</version>
<authors>@authors@</authors>
<owners>@authors@</owners>
<description>TestKit for writing tests for Akka.NET using xUnit 2.0.</description>
<licenseUrl>https://github.com/akkadotnet/akka.net/blob/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/akkadotnet/akka.net</projectUrl>
<iconUrl>http://getakka.net/images/AkkaNetLogo.Normal.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<releaseNotes>@releaseNotes@</releaseNotes>
<copyright>@copyright@</copyright>
<tags>@tags@ xUnit</tags>
@dependencies@
@references@
</metadata>
</package>

Просмотреть файл

@ -0,0 +1,111 @@
//-----------------------------------------------------------------------
// <copyright file="AkkaAssertEqualityComparer.cs" company="Akka.NET Project">
// Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com>
// Copyright (C) 2013-2015 Akka.NET project <https://github.com/akkadotnet/akka.net>
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
namespace Akka.TestKit.Xunit2.Internals
{
/// <summary>
/// Default implementation of <see cref="IEqualityComparer{T}"/> used by the Akka's xUnit.net equality assertions.
/// Copy of xUnits code
/// https://github.com/xunit/xunit/blob/3e6ab94ca231a6d8c86e90d6e724631a0faa33b7/src/xunit.assert/Asserts/Sdk/AssertEqualityComparer.cs
/// <remarks>Note! Part of internal API. Breaking changes may occur without notice. Use at own risk.</remarks>
/// </summary>
/// <typeparam name="T">The type that is being compared.</typeparam>
public class AkkaAssertEqualityComparer<T> : IEqualityComparer<T>
{
static readonly IEqualityComparer DefaultInnerComparer = new AkkaAssertEqualityComparerAdapter<object>(new AkkaAssertEqualityComparer<object>());
static readonly TypeInfo NullableTypeInfo = typeof(Nullable<>).GetTypeInfo();
readonly Func<IEqualityComparer> innerComparerFactory;
readonly bool skipTypeCheck;
/// <summary>
/// Initializes a new instance of the <see cref="AkkaAssertEqualityComparer{T}" /> class.
/// </summary>
/// <param name="skipTypeCheck">Set to <c>true</c> to skip type equality checks.</param>
/// <param name="innerComparer">The inner comparer to be used when the compared objects are enumerable.</param>
public AkkaAssertEqualityComparer(bool skipTypeCheck = false, IEqualityComparer innerComparer = null)
{
this.skipTypeCheck = skipTypeCheck;
// Use a thunk to delay evaluation of DefaultInnerComparer
innerComparerFactory = () => innerComparer ?? DefaultInnerComparer;
}
/// <inheritdoc/>
public bool Equals(T x, T y)
{
var typeInfo = typeof(T).GetTypeInfo();
// Null?
if(!typeInfo.IsValueType || (typeInfo.IsGenericType && typeInfo.GetGenericTypeDefinition().GetTypeInfo().IsAssignableFrom(NullableTypeInfo)))
{
if(Object.Equals(x, default(T)))
return Object.Equals(y, default(T));
if(Object.Equals(y, default(T)))
return false;
}
// Same type?
if(!skipTypeCheck && x.GetType() != y.GetType())
return false;
// Implements IEquatable<T>?
var equatable = x as IEquatable<T>;
if(equatable != null)
return equatable.Equals(y);
// Implements IComparable<T>?
var comparableGeneric = x as IComparable<T>;
if(comparableGeneric != null)
return comparableGeneric.CompareTo(y) == 0;
// Implements IComparable?
var comparable = x as IComparable;
if(comparable != null)
return comparable.CompareTo(y) == 0;
// Enumerable?
var enumerableX = x as IEnumerable;
var enumerableY = y as IEnumerable;
if(enumerableX != null && enumerableY != null)
{
var enumeratorX = enumerableX.GetEnumerator();
var enumeratorY = enumerableY.GetEnumerator();
var equalityComparer = innerComparerFactory();
while(true)
{
bool hasNextX = enumeratorX.MoveNext();
bool hasNextY = enumeratorY.MoveNext();
if(!hasNextX || !hasNextY)
return (hasNextX == hasNextY);
if(!equalityComparer.Equals(enumeratorX.Current, enumeratorY.Current))
return false;
}
}
// Last case, rely on Object.Equals
return Object.Equals(x, y);
}
/// <inheritdoc/>
public int GetHashCode(T obj)
{
throw new NotImplementedException();
}
}
}

Просмотреть файл

@ -0,0 +1,47 @@
//-----------------------------------------------------------------------
// <copyright file="AkkaAssertEqualityComparerAdapter.cs" company="Akka.NET Project">
// Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com>
// Copyright (C) 2013-2015 Akka.NET project <https://github.com/akkadotnet/akka.net>
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.Collections;
using System.Collections.Generic;
namespace Akka.TestKit.Xunit2.Internals
{
/// <summary>
/// A class that wraps <see cref="IEqualityComparer{T}"/> to create <see cref="IEqualityComparer"/>.
/// Copy of xUnits class:
/// https://github.com/xunit/xunit/blob/3e6ab94ca231a6d8c86e90d6e724631a0faa33b7/src/xunit.assert/Asserts/Sdk/AssertEqualityComparerAdapter.cs
/// <remarks>Note! Part of internal API. Breaking changes may occur without notice. Use at own risk.</remarks>
/// </summary>
/// <typeparam name="T">The type that is being compared.</typeparam>
internal class AkkaAssertEqualityComparerAdapter<T> : IEqualityComparer
{
readonly IEqualityComparer<T> innerComparer;
/// <summary>
/// Initializes a new instance of the <see cref="AkkaAssertEqualityComparerAdapter{T}"/> class.
/// </summary>
/// <param name="innerComparer">The comparer that is being adapted.</param>
public AkkaAssertEqualityComparerAdapter(IEqualityComparer<T> innerComparer)
{
this.innerComparer = innerComparer;
}
/// <inheritdoc/>
public new bool Equals(object x, object y)
{
return innerComparer.Equals((T)x, (T)y);
}
/// <inheritdoc/>
public int GetHashCode(object obj)
{
throw new NotImplementedException();
}
}
}

Просмотреть файл

@ -0,0 +1,51 @@
//-----------------------------------------------------------------------
// <copyright file="AkkaEqualException.cs" company="Akka.NET Project">
// Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com>
// Copyright (C) 2013-2015 Akka.NET project <https://github.com/akkadotnet/akka.net>
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.Runtime.Serialization;
using Xunit.Sdk;
namespace Akka.TestKit.Xunit2.Internals
{
public class AkkaEqualException : EqualException
{
private readonly string _format;
private readonly object[] _args;
public AkkaEqualException(object expected, object actual, string format = "", params object[] args)
: base(expected, actual)
{
_format = format;
_args = args;
}
protected AkkaEqualException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
public override string Message
{
get
{
if(string.IsNullOrEmpty(_format))
return base.Message;
string message;
try
{
message = string.Format(_format, _args);
}
catch(Exception)
{
message = "[Could not string.Format(\"" + _format + "\", " + string.Join(", ", _args) + ")]";
}
return base.Message + " " + message;
}
}
}
}

Просмотреть файл

@ -0,0 +1,20 @@
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Akka.TestKit.Xunit2")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("Akka.TestKit.Xunit2")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a48eb1da-be56-4078-a5f7-29d8e2bcd590")]

Просмотреть файл

@ -0,0 +1,125 @@
//-----------------------------------------------------------------------
// <copyright file="TestKit.cs" company="Akka.NET Project">
// Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com>
// Copyright (C) 2013-2015 Akka.NET project <https://github.com/akkadotnet/akka.net>
// </copyright>
//-----------------------------------------------------------------------
using System;
using Akka.Actor;
using Akka.Configuration;
namespace Akka.TestKit.Xunit2
{
/// <summary>
/// TestKit for xUnit.
/// </summary>
public class TestKit : TestKitBase , IDisposable
{
private static readonly XunitAssertions _assertions=new XunitAssertions();
private bool _isDisposed; //Automatically initialized to false;
/// <summary>
/// Create a new instance of the <see cref="TestKit"/> for xUnit class.
/// If no <paramref name="system"/> is passed in, a new system
/// with <see cref="DefaultConfig"/> will be created.
/// </summary>
/// <param name="system">Optional: The actor system.</param>
public TestKit(ActorSystem system = null)
: base(_assertions, system)
{
//Intentionally left blank
}
/// <summary>
/// Create a new instance of the <see cref="TestKit"/> for xUnit class.
/// A new system with the specified configuration will be created.
/// </summary>
/// <param name="config">The configuration to use for the system.</param>
/// <param name="actorSystemName">Optional: the name of the system. Default: "test"</param>
public TestKit(Config config, string actorSystemName=null)
: base(_assertions, config, actorSystemName)
{
//Intentionally left blank
}
/// <summary>
/// Create a new instance of the <see cref="TestKit"/> for xUnit class.
/// A new system with the specified configuration will be created.
/// </summary>
/// <param name="config">The configuration to use for the system.</param>
public TestKit(string config): base(_assertions, ConfigurationFactory.ParseString(config))
{
//Intentionally left blank
}
public new static Config DefaultConfig { get { return TestKitBase.DefaultConfig; } }
public new static Config FullDebugConfig { get { return TestKitBase.FullDebugConfig; } }
protected static XunitAssertions Assertions { get { return _assertions; } }
/// <summary>
/// This method is called when a test ends.
/// <remarks>If you override this, make sure you either call
/// base.AfterTest() or <see cref="TestKitBase.Shutdown(System.Nullable{System.TimeSpan},bool)">TestKitBase.Shutdown</see> to shut down
/// the system. Otherwise you'll leak memory.
/// </remarks>
/// </summary>
protected virtual void AfterAll()
{
Shutdown();
}
// Dispose ------------------------------------------------------------
//Destructor:
//~TestKit()
//{
// // Finalizer calls Dispose(false)
// Dispose(false);
//}
/// <summary>Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.</summary>
public void Dispose()
{
Dispose(true);
//Take this object off the finalization queue and prevent finalization code for this object
//from executing a second time.
GC.SuppressFinalize(this);
}
/// <summary>Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.</summary>
/// <param name="disposing">if set to <c>true</c> the method has been called directly or indirectly by a
/// user's code. Managed and unmanaged resources will be disposed.<br />
/// if set to <c>false</c> the method has been called by the runtime from inside the finalizer and only
/// unmanaged resources can be disposed.</param>
protected virtual void Dispose(bool disposing)
{
// If disposing equals false, the method has been called by the
// runtime from inside the finalizer and you should not reference
// other objects. Only unmanaged resources can be disposed.
try
{
//Make sure Dispose does not get called more than once, by checking the disposed field
if(!_isDisposed)
{
if(disposing)
{
AfterAll();
}
}
_isDisposed = true;
}
finally
{
// base.dispose(disposing);
}
}
}
}

Просмотреть файл

@ -0,0 +1,50 @@
//-----------------------------------------------------------------------
// <copyright file="XunitAssertions.cs" company="Akka.NET Project">
// Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com>
// Copyright (C) 2013-2015 Akka.NET project <https://github.com/akkadotnet/akka.net>
// </copyright>
//-----------------------------------------------------------------------
using System;
using Akka.TestKit.Xunit2.Internals;
using Xunit;
namespace Akka.TestKit.Xunit2
{
/// <summary>
/// Assertions for xUnit
/// </summary>
public class XunitAssertions : ITestKitAssertions
{
public void Fail(string format = "", params object[] args)
{
Assert.True(false, string.Format(format, args));
}
public void AssertTrue(bool condition, string format = "", params object[] args)
{
Assert.True(condition, string.Format(format, args));
}
public void AssertFalse(bool condition, string format = "", params object[] args)
{
Assert.False(condition, string.Format(format, args));
}
public void AssertEqual<T>(T expected, T actual, string format = "", params object[] args)
{
var comparer = new AkkaAssertEqualityComparer<T>();
if(!comparer.Equals(expected, actual))
throw new AkkaEqualException(expected, actual, format, args);
}
public void AssertEqual<T>(T expected, T actual, Func<T, T, bool> comparer, string format = "", params object[] args)
{
if(!comparer(expected, actual))
throw new AkkaEqualException(expected, actual, format, args);
}
}
}

Просмотреть файл

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="xunit" version="2.0.0" targetFramework="net45" />
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" />
<package id="xunit.assert" version="2.0.0" targetFramework="net45" />
<package id="xunit.core" version="2.0.0" targetFramework="net45" />
<package id="xunit.extensibility.core" version="2.0.0" targetFramework="net45" />
</packages>

Просмотреть файл

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props" Condition="Exists('..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@ -12,6 +13,7 @@
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<NuGetPackageImportStamp>d8ea7d64</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -31,19 +33,33 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="FluentAssertions">
<HintPath>..\..\packages\FluentAssertions.3.3.0\lib\net45\FluentAssertions.dll</HintPath>
</Reference>
<Reference Include="FluentAssertions.Core">
<HintPath>..\..\packages\FluentAssertions.3.3.0\lib\net45\FluentAssertions.Core.dll</HintPath>
</Reference>
<Reference Include="Google.ProtocolBuffers.Serialization">
<HintPath>..\..\packages\Google.ProtocolBuffers.2.4.1.521\lib\net40\Google.ProtocolBuffers.Serialization.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="xunit">
<HintPath>..\..\packages\xunit.1.9.2\lib\net20\xunit.dll</HintPath>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="Google.ProtocolBuffers">
<HintPath>..\..\packages\Google.ProtocolBuffers.2.4.1.521\lib\net40\Google.ProtocolBuffers.dll</HintPath>
</Reference>
<Reference Include="System.Collections.Immutable">
<HintPath>..\..\packages\Microsoft.Bcl.Immutable.1.0.34\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
</Reference>
<Reference Include="xunit.abstractions">
<HintPath>..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
</Reference>
<Reference Include="xunit.assert">
<HintPath>..\..\packages\xunit.assert.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.assert.dll</HintPath>
</Reference>
<Reference Include="xunit.core">
<HintPath>..\..\packages\xunit.extensibility.core.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.dll</HintPath>
</Reference>
</ItemGroup>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
@ -63,24 +79,12 @@
<Compile Include="ClusterSpec.cs" />
<Compile Include="ClusterSpecBase.cs" />
<Compile Include="EWMASpec.cs" />
<Compile Include="FailureDetectorPuppet.cs" />
<Compile Include="GossipSpec.cs" />
<Compile Include="HeartbeatNodeRingSpec.cs" />
<Compile Include="MemberOrderingSpec.cs" />
<Compile Include="MetricsCollectorSpec.cs" />
<Compile Include="MetricsGossipSpec.cs" />
<Compile Include="MetricValuesSpec.cs" />
<Compile Include="MultiNode\ClusterDeathWatchSpec.cs" />
<Compile Include="MultiNode\ConvergenceSpec.cs" />
<Compile Include="MultiNode\InitialHeartbeatSpec.cs" />
<Compile Include="MultiNode\JoinInProgressSpec.cs" />
<Compile Include="MultiNode\JoinSeedNodeSpec.cs" />
<Compile Include="MultiNode\LeaderLeavingSpec.cs" />
<Compile Include="MultiNode\MultiNodeClusterSpec.cs" />
<Compile Include="MultiNode\MultiNodeFact.cs" />
<Compile Include="MultiNode\MultiNodeLoggingConfig.cs" />
<Compile Include="MultiNode\Routing\ClusterConsistentHashingGroupSpec.cs" />
<Compile Include="MultiNode\Routing\ClusterConsistentHashingRouterSpec.cs" />
<Compile Include="NodeMetricsSpec.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Proto\ClusterMessageSerializerSpec.cs" />
@ -91,9 +95,9 @@
<Compile Include="VectorClockSpec.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\contrib\testkits\Akka.TestKit.Xunit\Akka.TestKit.Xunit.csproj">
<Project>{11F4D4B8-7E07-4457-ABF2-609B3E7B2649}</Project>
<Name>Akka.TestKit.Xunit</Name>
<ProjectReference Include="..\..\contrib\testkits\Akka.TestKit.Xunit2\Akka.TestKit.Xunit2.csproj">
<Project>{7dbd5c17-5e9d-40c4-9201-d092751532a7}</Project>
<Name>Akka.TestKit.Xunit2</Name>
</ProjectReference>
<ProjectReference Include="..\Akka.Cluster\Akka.Cluster.csproj">
<Project>{6AB00F61-269A-4501-B06A-026707F000A7}</Project>
@ -126,6 +130,7 @@
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<ItemGroup />
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
<ItemGroup>
@ -152,6 +157,7 @@
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
<Error Condition="!Exists('..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

Просмотреть файл

@ -21,7 +21,7 @@ namespace Akka.Cluster.Tests
auto-down-unreachable-after = 0s
periodic-tasks-initial-delay = 120 s // turn off scheduled tasks
publish-stats-interval = 0 s # always, when it happens
failure-detector.implementation-class = ""Akka.Cluster.Tests.FailureDetectorPuppet, Akka.Cluster.Tests""
failure-detector.implementation-class = ""Akka.MultiNodeTests.FailureDetectorPuppet, Akka.MultiNodeTests""
}
akka.actor.provider = ""Akka.Cluster.ClusterActorRefProvider, Akka.Cluster""
akka.remote.helios.tcp.port = 0";

Просмотреть файл

@ -11,6 +11,8 @@ using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
using Xunit;
[assembly: AssemblyTitle("Akka.Cluster.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
@ -40,4 +42,5 @@ using System.Runtime.InteropServices;
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: CollectionBehavior(DisableTestParallelization = true)]

Просмотреть файл

@ -9,6 +9,7 @@ using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using Akka.Actor;
using FluentAssertions;
using Xunit;
namespace Akka.Cluster.Tests
@ -163,22 +164,13 @@ namespace Akka.Cluster.Tests
{nodeE, ImmutableHashSet.Create(nodeA)}
}.ToImmutableDictionary();
Assert.Equal<KeyValuePair<UniqueAddress, ImmutableHashSet<UniqueAddress>>>(expected, r.ObserversGroupedByUnreachable, new DictionaryOfHashsetComparer());
}
r.ObserversGroupedByUnreachable
.Should()
.HaveCount(3);
class DictionaryOfHashsetComparer : IEqualityComparer<KeyValuePair<UniqueAddress, ImmutableHashSet<UniqueAddress>>>
{
public bool Equals(KeyValuePair<UniqueAddress, ImmutableHashSet<UniqueAddress>> x, KeyValuePair<UniqueAddress, ImmutableHashSet<UniqueAddress>> y)
foreach (var pair in r.ObserversGroupedByUnreachable)
{
if (!x.Key.Equals(y.Key)) return false;
if (!x.Value.SequenceEqual(y.Value)) return false;
return true;
}
public int GetHashCode(KeyValuePair<UniqueAddress, ImmutableHashSet<UniqueAddress>> obj)
{
return obj.GetHashCode();
pair.Value.ShouldBeEquivalentTo(expected[pair.Key]);
}
}

Просмотреть файл

@ -1,6 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="FluentAssertions" version="3.3.0" targetFramework="net45" />
<package id="Google.ProtocolBuffers" version="2.4.1.521" targetFramework="net45" />
<package id="Microsoft.Bcl.Immutable" version="1.0.34" targetFramework="net45" />
<package id="xunit" version="1.9.2" targetFramework="net45" />
<package id="xunit" version="2.0.0" targetFramework="net45" />
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" />
<package id="xunit.assert" version="2.0.0" targetFramework="net45" />
<package id="xunit.core" version="2.0.0" targetFramework="net45" />
<package id="xunit.extensibility.core" version="2.0.0" targetFramework="net45" />
</packages>

Просмотреть файл

@ -18,6 +18,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyProduct("Akka.Cluster")]
[assembly: AssemblyCulture("")]
[assembly: InternalsVisibleTo("Akka.Cluster.Tests")]
[assembly: InternalsVisibleTo("Akka.MultiNodeTests")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from

Просмотреть файл

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props" Condition="Exists('..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -13,6 +14,7 @@
<Name>Akka.FSharp.Tests</Name>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<NuGetPackageImportStamp>802fc494</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -63,6 +65,7 @@
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
<Error Condition="!Exists('..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props'))" />
</Target>
<ItemGroup>
<Compile Include="Tests.fs" />
@ -82,9 +85,6 @@
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Numerics" />
<Reference Include="xunit">
<HintPath>..\..\packages\xunit.1.9.2\lib\net20\xunit.dll</HintPath>
</Reference>
<ProjectReference Include="..\..\contrib\testkits\Akka.TestKit.Xunit\Akka.TestKit.Xunit.csproj">
<Name>Akka.TestKit.Xunit</Name>
<Project>{11F4D4B8-7E07-4457-ABF2-609B3E7B2649}</Project>
@ -104,6 +104,18 @@
<Reference Include="FSharp.Core, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<Private>True</Private>
</Reference>
<Reference Include="xunit.abstractions">
<HintPath>..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="xunit.assert">
<HintPath>..\..\packages\xunit.assert.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.assert.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="xunit.core">
<HintPath>..\..\packages\xunit.extensibility.core.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

Просмотреть файл

@ -2,5 +2,9 @@
<packages>
<package id="FsCheck" version="0.9.4.0" targetFramework="net45" />
<package id="FsCheck.Xunit" version="0.4.1.0" targetFramework="net45" />
<package id="xunit" version="1.9.2" targetFramework="net45" />
<package id="xunit" version="2.0.0" targetFramework="net45" />
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" />
<package id="xunit.assert" version="2.0.0" targetFramework="net45" />
<package id="xunit.core" version="2.0.0" targetFramework="net45" />
<package id="xunit.extensibility.core" version="2.0.0" targetFramework="net45" />
</packages>

Просмотреть файл

@ -10,9 +10,9 @@ open System.Runtime.InteropServices
[<assembly: AssemblyCompanyAttribute("Akka.NET Team")>]
[<assembly: ComVisibleAttribute(false)>]
[<assembly: CLSCompliantAttribute(true)>]
[<assembly: AssemblyVersionAttribute("1.0.1.0")>]
[<assembly: AssemblyFileVersionAttribute("1.0.1.0")>]
[<assembly: AssemblyVersionAttribute("1.0.2.0")>]
[<assembly: AssemblyFileVersionAttribute("1.0.2.0")>]
do ()
module internal AssemblyVersionInformation =
let [<Literal>] Version = "1.0.1.0"
let [<Literal>] Version = "1.0.2.0"

Просмотреть файл

@ -56,9 +56,9 @@
<Compile Include="TestRunShutdownSpec.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\contrib\testkits\Akka.TestKit.Xunit\Akka.TestKit.Xunit.csproj">
<Project>{11F4D4B8-7E07-4457-ABF2-609B3E7B2649}</Project>
<Name>Akka.TestKit.Xunit</Name>
<ProjectReference Include="..\..\contrib\testkits\Akka.TestKit.Xunit2\Akka.TestKit.Xunit2.csproj">
<Project>{7dbd5c17-5e9d-40c4-9201-d092751532a7}</Project>
<Name>Akka.TestKit.Xunit2</Name>
</ProjectReference>
<ProjectReference Include="..\Akka.MultiNodeTestRunner.Shared\Akka.MultiNodeTestRunner.Shared.csproj">
<Project>{964F0EC5-FBE6-47C5-8AE6-145114D5DB8C}</Project>

Просмотреть файл

@ -36,11 +36,13 @@
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="xunit.abstractions">
<HintPath>..\..\packages\xunit.abstractions.2.0.0-beta4-build2738\lib\net35\xunit.abstractions.dll</HintPath>
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
</Reference>
<Reference Include="xunit.runner.utility">
<HintPath>..\..\packages\xunit.runner.utility.2.0.0-beta4-build2738\lib\net35\xunit.runner.utility.dll</HintPath>
<Reference Include="xunit.runner.utility.desktop, Version=2.1.0.2981, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\xunit.runner.utility.2.1.0-beta2-build2981\lib\net35\xunit.runner.utility.desktop.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
@ -60,14 +62,14 @@
<Project>{A8AA2D7E-3D35-44DF-AF92-80A2C39C1F4D}</Project>
<Name>Akka.Logger.NLog</Name>
</ProjectReference>
<ProjectReference Include="..\Akka.Cluster.Tests\Akka.Cluster.Tests.csproj">
<Project>{C8D6A95C-50BF-4416-A212-86B18B87220D}</Project>
<Name>Akka.Cluster.Tests</Name>
</ProjectReference>
<ProjectReference Include="..\Akka.MultiNodeTestRunner.Shared\Akka.MultiNodeTestRunner.Shared.csproj">
<Project>{964F0EC5-FBE6-47C5-8AE6-145114D5DB8C}</Project>
<Name>Akka.MultiNodeTestRunner.Shared</Name>
</ProjectReference>
<ProjectReference Include="..\Akka.MultiNodeTests\Akka.MultiNodeTests.csproj">
<Project>{f0781bea-5ba0-4af0-bb15-e3f209b681f5}</Project>
<Name>Akka.MultiNodeTests</Name>
</ProjectReference>
<ProjectReference Include="..\Akka.NodeTestRunner\Akka.NodeTestRunner.csproj">
<Project>{28520F30-2868-4BD3-9CAE-AC27226C24E3}</Project>
<Name>Akka.NodeTestRunner</Name>

Просмотреть файл

@ -14,7 +14,7 @@ using Xunit.Abstractions;
namespace Akka.MultiNodeTestRunner
{
class Discovery : IMessageSink, IDisposable
internal class Discovery : MarshalByRefObject, IMessageSink, IDisposable
{
public Dictionary<string, List<NodeTest>> Tests { get; set; }
@ -34,7 +34,7 @@ namespace Akka.MultiNodeTestRunner
if (testCaseDiscoveryMessage != null)
{
//TODO: Improve this
if(Regex.IsMatch(testCaseDiscoveryMessage.TestClass.Class.Name, @"\d+$"))
if (Regex.IsMatch(testCaseDiscoveryMessage.TestClass.Class.Name, @"\d+$"))
{
var details = GetTestDetails(testCaseDiscoveryMessage);
List<NodeTest> tests;
@ -44,9 +44,9 @@ namespace Akka.MultiNodeTestRunner
}
else
{
tests = new List<NodeTest>(new[] { details });
tests = new List<NodeTest>(new[] {details});
}
Tests[details.TestName] = tests;
Tests[details.TestName] = tests;
}
}
@ -74,5 +74,4 @@ namespace Akka.MultiNodeTestRunner
Finished.Dispose();
}
}
}
}

Просмотреть файл

@ -70,7 +70,7 @@ namespace Akka.MultiNodeTestRunner
{
using (var discovery = new Discovery())
{
controller.Find(false, discovery, new TestFrameworkOptions());
controller.Find(false, discovery, TestFrameworkOptions.ForDiscovery());
discovery.Finished.WaitOne();
foreach (var test in discovery.Tests.Reverse())

Просмотреть файл

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="xunit.abstractions" version="2.0.0-beta4-build2738" targetFramework="net45" />
<package id="xunit.runner.utility" version="2.0.0-beta4-build2738" targetFramework="net45" />
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" />
<package id="xunit.runner.utility" version="2.1.0-beta2-build2981" targetFramework="net45" />
</packages>

Просмотреть файл

@ -0,0 +1,121 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props" Condition="Exists('..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{F0781BEA-5BA0-4AF0-BB15-E3F209B681F5}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Akka.MultiNodeTests</RootNamespace>
<AssemblyName>Akka.MultiNodeTests</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<NuGetPackageImportStamp>1a218765</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Collections.Immutable">
<HintPath>..\..\packages\Microsoft.Bcl.Immutable.1.0.34\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="xunit.abstractions">
<HintPath>..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
</Reference>
<Reference Include="xunit.assert">
<HintPath>..\..\packages\xunit.assert.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.assert.dll</HintPath>
</Reference>
<Reference Include="xunit.core">
<HintPath>..\..\packages\xunit.extensibility.core.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="ClusterDeathWatchSpec.cs" />
<Compile Include="ConvergenceSpec.cs" />
<Compile Include="FailureDetectorPuppet.cs" />
<Compile Include="InitialHeartbeatSpec.cs" />
<Compile Include="JoinInProgressSpec.cs" />
<Compile Include="JoinSeedNodeSpec.cs" />
<Compile Include="LeaderLeavingSpec.cs" />
<Compile Include="MultiNodeClusterSpec.cs" />
<Compile Include="MultiNodeFact.cs" />
<Compile Include="MultiNodeLoggingConfig.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Routing\ClusterConsistentHashingGroupSpec.cs" />
<Compile Include="Routing\ClusterConsistentHashingRouterSpec.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\contrib\testkits\Akka.TestKit.Xunit2\Akka.TestKit.Xunit2.csproj">
<Project>{7dbd5c17-5e9d-40c4-9201-d092751532a7}</Project>
<Name>Akka.TestKit.Xunit2</Name>
</ProjectReference>
<ProjectReference Include="..\Akka.Cluster\Akka.Cluster.csproj">
<Project>{6ab00f61-269a-4501-b06a-026707f000a7}</Project>
<Name>Akka.Cluster</Name>
</ProjectReference>
<ProjectReference Include="..\Akka.Remote.TestKit\Akka.Remote.TestKit.csproj">
<Project>{e5957c3e-2b1e-469f-a680-7953b4dea31b}</Project>
<Name>Akka.Remote.TestKit</Name>
</ProjectReference>
<ProjectReference Include="..\Akka.Remote\Akka.Remote.csproj">
<Project>{EA4FF8FD-7C53-49C8-B9AA-02E458B3E6A7}</Project>
<Name>Akka.Remote</Name>
</ProjectReference>
<ProjectReference Include="..\Akka.TestKit\Akka.TestKit.csproj">
<Project>{0d3cbad0-bbdb-43e5-afc4-ed1d3ecdc224}</Project>
<Name>Akka.TestKit</Name>
</ProjectReference>
<ProjectReference Include="..\Akka.Tests.Shared.Internals\Akka.Tests.Shared.Internals.csproj">
<Project>{e636d23c-3432-4aa9-9a5d-5f29d33d3399}</Project>
<Name>Akka.Tests.Shared.Internals</Name>
</ProjectReference>
<ProjectReference Include="..\Akka\Akka.csproj">
<Project>{5deddf90-37f0-48d3-a0b0-a5cbd8a7e377}</Project>
<Name>Akka</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
<Error Condition="!Exists('..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

Просмотреть файл

@ -15,7 +15,7 @@ using Akka.TestKit;
using Akka.TestKit.TestActors;
using Xunit;
namespace Akka.Cluster.Tests.MultiNode
namespace Akka.MultiNodeTests
{
public class ClusterDeathWatchSpecConfig : MultiNodeConfig
{

Просмотреть файл

@ -8,13 +8,14 @@
using System;
using System.Linq;
using System.Threading;
using Akka.Actor;
using Akka.Cluster;
using Akka.Configuration;
using Akka.Remote.TestKit;
using Akka.TestKit;
using Xunit;
using Address = Akka.Actor.Address;
namespace Akka.Cluster.Tests.MultiNode
namespace Akka.MultiNodeTests
{
public class ConvergenceSpecConfig : MultiNodeConfig
{

Просмотреть файл

@ -10,7 +10,7 @@ using Akka.Event;
using Akka.Remote;
using Akka.Util;
namespace Akka.Cluster.Tests
namespace Akka.MultiNodeTests
{
/// <summary>
/// User controllable "puppet" failure detector.

Просмотреть файл

@ -7,12 +7,13 @@
using System;
using System.Linq;
using Akka.Cluster;
using Akka.Configuration;
using Akka.Remote.TestKit;
using Akka.Remote.Transport;
using Xunit;
namespace Akka.Cluster.Tests.MultiNode
namespace Akka.MultiNodeTests
{
public class InitialHeartbeatMultiNodeConfig : MultiNodeConfig
{

Просмотреть файл

@ -12,7 +12,7 @@ using Akka.Remote;
using Akka.Remote.TestKit;
using Xunit;
namespace Akka.Cluster.Tests.MultiNode
namespace Akka.MultiNodeTests
{
public class JoinInProgressMultiNodeConfig : MultiNodeConfig
{

Просмотреть файл

@ -11,7 +11,7 @@ using Akka.Actor;
using Akka.Configuration;
using Akka.Remote.TestKit;
namespace Akka.Cluster.Tests.MultiNode
namespace Akka.MultiNodeTests
{
public class JoinSeedNodeConfig : MultiNodeConfig
{

Просмотреть файл

@ -8,10 +8,11 @@
using System;
using System.Linq;
using Akka.Actor;
using Akka.Cluster;
using Akka.Remote.TestKit;
using Akka.TestKit;
namespace Akka.Cluster.Tests.MultiNode
namespace Akka.MultiNodeTests
{
public class LeaderLeavingSpecConfig : MultiNodeConfig
{

Просмотреть файл

@ -12,15 +12,16 @@ using System.Collections.Immutable;
using System.Linq;
using System.Text.RegularExpressions;
using Akka.Actor;
using Akka.Cluster;
using Akka.Configuration;
using Akka.Dispatch.SysMsg;
using Akka.Remote.TestKit;
using Akka.Remote.Transport;
using Akka.TestKit;
using Akka.TestKit.Xunit;
using Akka.TestKit.Xunit2;
using Xunit;
namespace Akka.Cluster.Tests.MultiNode
namespace Akka.MultiNodeTests
{
//TODO: WatchedByCoroner?
//@Aaronontheweb: Coroner is a JVM-specific instrument used to report deadlocks and other fun stuff.
@ -30,7 +31,7 @@ namespace Akka.Cluster.Tests.MultiNode
public static Config ClusterConfigWithFailureDetectorPuppet()
{
return ConfigurationFactory.ParseString(
@"akka.cluster.failure-detector.implementation-class = ""Akka.Cluster.Tests.FailureDetectorPuppet, Akka.Cluster.Tests""")
@"akka.cluster.failure-detector.implementation-class = ""Akka.MultiNodeTests.FailureDetectorPuppet, Akka.MultiNodeTests""")
.WithFallback(ClusterConfig());
}
@ -229,7 +230,7 @@ namespace Akka.Cluster.Tests.MultiNode
/// <summary>
/// Get the cluster node to use.
/// </summary>
public Cluster Cluster { get { return Cluster.Get(Sys); } }
public Cluster.Cluster Cluster { get { return Akka.Cluster.Cluster.Get(Sys); } }
/// <summary>
/// Use this method for the initial startup of the cluster node

Просмотреть файл

@ -8,7 +8,7 @@
using System;
using Xunit;
namespace Akka.Cluster.Tests.MultiNode
namespace Akka.MultiNodeTests
{
public class MultiNodeFactAttribute : FactAttribute
{

Просмотреть файл

@ -8,7 +8,7 @@
using Akka.Configuration;
using Akka.Remote.TestKit;
namespace Akka.Cluster.Tests.MultiNode
namespace Akka.MultiNodeTests
{
/// <summary>
/// Static <see cref="Config"/> provider that allows toggleable logging

Просмотреть файл

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Akka.MultiNodeTests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Akka.MultiNodeTests")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f44c16ff-d622-4c69-bb17-8da38e8aa2f4")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

Просмотреть файл

@ -15,7 +15,7 @@ using Akka.Remote.TestKit;
using Akka.Routing;
using Akka.TestKit;
namespace Akka.Cluster.Tests.MultiNode.Routing
namespace Akka.MultiNodeTests.Routing
{
public class ClusterConsistentHashingGroupSpecConfig : MultiNodeConfig
{

Просмотреть файл

@ -15,7 +15,7 @@ using Akka.Routing;
using Akka.TestKit;
using Xunit;
namespace Akka.Cluster.Tests.MultiNode.Routing
namespace Akka.MultiNodeTests.Routing
{
public class ConsistentHashingRouterMultiNodeConfig : MultiNodeConfig
{

Просмотреть файл

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl.Immutable" version="1.0.34" targetFramework="net45" />
<package id="xunit" version="2.0.0" targetFramework="net45" />
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" />
<package id="xunit.assert" version="2.0.0" targetFramework="net45" />
<package id="xunit.core" version="2.0.0" targetFramework="net45" />
<package id="xunit.extensibility.core" version="2.0.0" targetFramework="net45" />
</packages>

Просмотреть файл

@ -51,14 +51,17 @@
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="xunit.abstractions">
<HintPath>..\..\packages\xunit.abstractions.2.0.0-beta4-build2738\lib\net35\xunit.abstractions.dll</HintPath>
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
</Reference>
<Reference Include="xunit.runner.utility">
<HintPath>..\..\packages\xunit.runner.utility.2.0.0-beta4-build2738\lib\net35\xunit.runner.utility.dll</HintPath>
<Reference Include="xunit.runner.utility.desktop, Version=2.1.0.2981, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\xunit.runner.utility.2.1.0-beta2-build2981\lib\net35\xunit.runner.utility.desktop.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Discovery.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Sink.cs" />
@ -72,9 +75,9 @@
<Project>{A8AA2D7E-3D35-44DF-AF92-80A2C39C1F4D}</Project>
<Name>Akka.Logger.NLog</Name>
</ProjectReference>
<ProjectReference Include="..\Akka.Cluster.Tests\Akka.Cluster.Tests.csproj">
<Project>{C8D6A95C-50BF-4416-A212-86B18B87220D}</Project>
<Name>Akka.Cluster.Tests</Name>
<ProjectReference Include="..\Akka.MultiNodeTests\Akka.MultiNodeTests.csproj">
<Project>{f0781bea-5ba0-4af0-bb15-e3f209b681f5}</Project>
<Name>Akka.MultiNodeTests</Name>
</ProjectReference>
<ProjectReference Include="..\Akka.Remote.TestKit\Akka.Remote.TestKit.csproj">
<Project>{E5957C3E-2B1E-469F-A680-7953B4DEA31B}</Project>

Просмотреть файл

@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Xunit;
using Xunit.Abstractions;
namespace Akka.NodeTestRunner
{
[Serializable]
public class Discovery : TestMessageVisitor<IDiscoveryCompleteMessage>
{
private readonly string _assemblyName;
private readonly string _className;
public List<ITestCase> TestCases { get; private set; }
public Discovery(string assemblyName, string className)
{
_assemblyName = assemblyName;
_className = className;
TestCases = new List<ITestCase>();
}
protected override bool Visit(ITestCaseDiscoveryMessage discovery)
{
var name = discovery.TestAssembly.Assembly.AssemblyPath.Split('\\').Last();
if (!name.Equals(_assemblyName, StringComparison.OrdinalIgnoreCase))
return true;
var testName = discovery.TestClass.Class.Name;
if (testName.Equals(_className, StringComparison.OrdinalIgnoreCase))
{
TestCases.Add(discovery.TestCase);
}
return true;
}
}
}

Просмотреть файл

@ -26,44 +26,44 @@ namespace Akka.NodeTestRunner
using (var controller = new XunitFrontController(assemblyName))
{
using (var sink = new Sink(nodeIndex))
using (var discovery = new Discovery(assemblyName, typeName))
{
Thread.Sleep(10000);
try
using (var sink = new Sink(nodeIndex))
{
controller.RunTests(
new[]
{
new Xunit1TestCase(assemblyName, null, typeName, testName, displayName, null,
"MultiNodeTest")
}, sink, new TestFrameworkOptions());
}
catch (AggregateException ex)
{
var specFail = new SpecFail(nodeIndex, displayName);
specFail.FailureExceptionTypes.Add(ex.GetType().ToString());
specFail.FailureMessages.Add(ex.Message);
specFail.FailureStackTraces.Add(ex.StackTrace);
foreach (var innerEx in ex.Flatten().InnerExceptions)
Thread.Sleep(10000);
try
{
specFail.FailureExceptionTypes.Add(innerEx.GetType().ToString());
specFail.FailureMessages.Add(innerEx.Message);
specFail.FailureStackTraces.Add(innerEx.StackTrace);
controller.Find(true, discovery, TestFrameworkOptions.ForDiscovery());
discovery.Finished.WaitOne();
controller.RunTests(discovery.TestCases, sink, TestFrameworkOptions.ForExecution());
}
Console.WriteLine(specFail);
Environment.Exit(1); //signal failure
catch (AggregateException ex)
{
var specFail = new SpecFail(nodeIndex, displayName);
specFail.FailureExceptionTypes.Add(ex.GetType().ToString());
specFail.FailureMessages.Add(ex.Message);
specFail.FailureStackTraces.Add(ex.StackTrace);
foreach (var innerEx in ex.Flatten().InnerExceptions)
{
specFail.FailureExceptionTypes.Add(innerEx.GetType().ToString());
specFail.FailureMessages.Add(innerEx.Message);
specFail.FailureStackTraces.Add(innerEx.StackTrace);
}
Console.WriteLine(specFail);
Environment.Exit(1); //signal failure
}
catch (Exception ex)
{
var specFail = new SpecFail(nodeIndex, displayName);
specFail.FailureExceptionTypes.Add(ex.GetType().ToString());
specFail.FailureMessages.Add(ex.Message);
specFail.FailureStackTraces.Add(ex.StackTrace);
Console.WriteLine(specFail);
Environment.Exit(1); //signal failure
}
sink.Finished.WaitOne();
Environment.Exit(sink.Passed ? 0 : 1);
}
catch (Exception ex)
{
var specFail = new SpecFail(nodeIndex, displayName);
specFail.FailureExceptionTypes.Add(ex.GetType().ToString());
specFail.FailureMessages.Add(ex.Message);
specFail.FailureStackTraces.Add(ex.StackTrace);
Console.WriteLine(specFail);
Environment.Exit(1); //signal failure
}
sink.Finished.WaitOne();
Environment.Exit(sink.Passed ? 0 : 1);
}
}
}

Просмотреть файл

@ -14,7 +14,7 @@ using Xunit.Abstractions;
namespace Akka.NodeTestRunner
{
class Sink : IMessageSink, IDisposable
class Sink : MarshalByRefObject, IMessageSink, IDisposable
{
public bool Passed { get; private set; }
public ManualResetEvent Finished { get; private set; }

Просмотреть файл

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="xunit.abstractions" version="2.0.0-beta4-build2738" targetFramework="net45" />
<package id="xunit.runner.utility" version="2.0.0-beta4-build2738" targetFramework="net45" />
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" />
<package id="xunit.runner.utility" version="2.1.0-beta2-build2981" targetFramework="net45" />
</packages>

Просмотреть файл

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props" Condition="Exists('..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -13,6 +14,7 @@
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<NuGetPackageImportStamp>b3f6fdc7</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -37,8 +39,15 @@
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="xunit">
<HintPath>..\..\packages\xunit.1.9.2\lib\net20\xunit.dll</HintPath>
<Reference Include="System.Xml" />
<Reference Include="xunit.abstractions">
<HintPath>..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
</Reference>
<Reference Include="xunit.assert">
<HintPath>..\..\packages\xunit.assert.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.assert.dll</HintPath>
</Reference>
<Reference Include="xunit.core">
<HintPath>..\..\packages\xunit.extensibility.core.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
@ -75,6 +84,7 @@
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
<Error Condition="!Exists('..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

Просмотреть файл

@ -11,6 +11,8 @@ using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
using Xunit;
[assembly: AssemblyTitle("Akka.Persistence.TestKit.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
@ -40,4 +42,5 @@ using System.Runtime.InteropServices;
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: CollectionBehavior(DisableTestParallelization = true)]

Просмотреть файл

@ -1,4 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="xunit" version="1.9.2" targetFramework="net45" />
<package id="xunit" version="2.0.0" targetFramework="net45" />
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" />
<package id="xunit.assert" version="2.0.0" targetFramework="net45" />
<package id="xunit.core" version="2.0.0" targetFramework="net45" />
<package id="xunit.extensibility.core" version="2.0.0" targetFramework="net45" />
</packages>

Просмотреть файл

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props" Condition="Exists('..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -13,6 +14,7 @@
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<NuGetPackageImportStamp>f8afe7eb</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -38,8 +40,15 @@
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="xunit">
<HintPath>..\..\packages\xunit.1.9.2\lib\net20\xunit.dll</HintPath>
<Reference Include="System.Xml" />
<Reference Include="xunit.abstractions">
<HintPath>..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
</Reference>
<Reference Include="xunit.assert">
<HintPath>..\..\packages\xunit.assert.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.assert.dll</HintPath>
</Reference>
<Reference Include="xunit.core">
<HintPath>..\..\packages\xunit.extensibility.core.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
@ -52,9 +61,9 @@
<Compile Include="Snapshot\SnapshotStoreSpec.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\contrib\testkits\Akka.TestKit.Xunit\Akka.TestKit.Xunit.csproj">
<Project>{11F4D4B8-7E07-4457-ABF2-609B3E7B2649}</Project>
<Name>Akka.TestKit.Xunit</Name>
<ProjectReference Include="..\..\contrib\testkits\Akka.TestKit.Xunit2\Akka.TestKit.Xunit2.csproj">
<Project>{7dbd5c17-5e9d-40c4-9201-d092751532a7}</Project>
<Name>Akka.TestKit.Xunit2</Name>
</ProjectReference>
<ProjectReference Include="..\Akka.Persistence\Akka.Persistence.csproj">
<Project>{FCA84DEA-C118-424B-9EB8-34375DFEF18A}</Project>
@ -80,6 +89,7 @@
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
<Error Condition="!Exists('..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

Просмотреть файл

@ -9,7 +9,7 @@ using System;
using Akka.Actor;
using Akka.Configuration;
using Akka.TestKit;
using Akka.TestKit.Xunit;
using Akka.TestKit.Xunit2;
using Akka.Util.Internal;
namespace Akka.Persistence.TestKit

Просмотреть файл

@ -1,4 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="xunit" version="1.9.2" targetFramework="net45" />
<package id="xunit" version="2.0.0" targetFramework="net45" />
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" />
<package id="xunit.assert" version="2.0.0" targetFramework="net45" />
<package id="xunit.core" version="2.0.0" targetFramework="net45" />
<package id="xunit.extensibility.core" version="2.0.0" targetFramework="net45" />
</packages>

Просмотреть файл

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props" Condition="Exists('..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -13,6 +14,7 @@
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<NuGetPackageImportStamp>fb9ab2f3</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -37,8 +39,15 @@
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="xunit">
<HintPath>..\..\packages\xunit.1.9.2\lib\net20\xunit.dll</HintPath>
<Reference Include="System.Xml" />
<Reference Include="xunit.abstractions">
<HintPath>..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
</Reference>
<Reference Include="xunit.assert">
<HintPath>..\..\packages\xunit.assert.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.assert.dll</HintPath>
</Reference>
<Reference Include="xunit.core">
<HintPath>..\..\packages\xunit.extensibility.core.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
@ -56,14 +65,14 @@
<Compile Include="SnapshotSpec.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\contrib\testkits\Akka.TestKit.Xunit2\Akka.TestKit.Xunit2.csproj">
<Project>{7dbd5c17-5e9d-40c4-9201-d092751532a7}</Project>
<Name>Akka.TestKit.Xunit2</Name>
</ProjectReference>
<ProjectReference Include="..\Akka.Persistence\Akka.Persistence.csproj">
<Project>{FCA84DEA-C118-424B-9EB8-34375DFEF18A}</Project>
<Name>Akka.Persistence</Name>
</ProjectReference>
<ProjectReference Include="..\..\contrib\testkits\Akka.TestKit.Xunit\Akka.TestKit.Xunit.csproj">
<Project>{11F4D4B8-7E07-4457-ABF2-609B3E7B2649}</Project>
<Name>Akka.TestKit.Xunit</Name>
</ProjectReference>
<ProjectReference Include="..\Akka.TestKit\Akka.TestKit.csproj">
<Project>{0D3CBAD0-BBDB-43E5-AFC4-ED1D3ECDC224}</Project>
<Name>Akka.TestKit</Name>
@ -90,6 +99,7 @@
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
<Error Condition="!Exists('..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

Просмотреть файл

@ -11,6 +11,8 @@ using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
using Xunit;
[assembly: AssemblyTitle("Akka.Persistence.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
@ -40,4 +42,5 @@ using System.Runtime.InteropServices;
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
//[assembly: CollectionBehavior(DisableTestParallelization = true)]

Просмотреть файл

@ -1,4 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="xunit" version="1.9.2" targetFramework="net45" />
<package id="xunit" version="2.0.0" targetFramework="net45" />
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" />
<package id="xunit.assert" version="2.0.0" targetFramework="net45" />
<package id="xunit.core" version="2.0.0" targetFramework="net45" />
<package id="xunit.extensibility.core" version="2.0.0" targetFramework="net45" />
</packages>

Просмотреть файл

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props" Condition="Exists('..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -13,6 +14,7 @@
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<NuGetPackageImportStamp>bbb6736c</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -34,15 +36,21 @@
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="xunit">
<HintPath>..\..\packages\xunit.1.9.2\lib\net20\xunit.dll</HintPath>
</Reference>
<Reference Include="System.Collections.Immutable">
<HintPath>..\..\packages\Microsoft.Bcl.Immutable.1.0.34\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
</Reference>
<Reference Include="Helios">
<HintPath>..\..\packages\Helios.1.4.0\lib\net45\Helios.dll</HintPath>
</Reference>
<Reference Include="xunit.abstractions">
<HintPath>..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
</Reference>
<Reference Include="xunit.assert">
<HintPath>..\..\packages\xunit.assert.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.assert.dll</HintPath>
</Reference>
<Reference Include="xunit.core">
<HintPath>..\..\packages\xunit.extensibility.core.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="BarrierSpec.cs" />
@ -50,9 +58,9 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\contrib\testkits\Akka.TestKit.Xunit\Akka.TestKit.Xunit.csproj">
<Project>{11F4D4B8-7E07-4457-ABF2-609B3E7B2649}</Project>
<Name>Akka.TestKit.Xunit</Name>
<ProjectReference Include="..\..\contrib\testkits\Akka.TestKit.Xunit2\Akka.TestKit.Xunit2.csproj">
<Project>{7dbd5c17-5e9d-40c4-9201-d092751532a7}</Project>
<Name>Akka.TestKit.Xunit2</Name>
</ProjectReference>
<ProjectReference Include="..\Akka.Remote.TestKit\Akka.Remote.TestKit.csproj">
<Project>{E5957C3E-2B1E-469F-A680-7953B4DEA31B}</Project>
@ -88,6 +96,7 @@
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
<Error Condition="!Exists('..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

Просмотреть файл

@ -11,6 +11,8 @@ using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
using Xunit;
[assembly: AssemblyTitle("Akka.Remote.TestKit.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
@ -40,4 +42,5 @@ using System.Runtime.InteropServices;
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: CollectionBehavior(DisableTestParallelization = true)]

Просмотреть файл

@ -2,5 +2,9 @@
<packages>
<package id="Helios" version="1.4.0" targetFramework="net45" />
<package id="Microsoft.Bcl.Immutable" version="1.0.34" targetFramework="net45" />
<package id="xunit" version="1.9.2" targetFramework="net45" />
<package id="xunit" version="2.0.0" targetFramework="net45" />
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" />
<package id="xunit.assert" version="2.0.0" targetFramework="net45" />
<package id="xunit.core" version="2.0.0" targetFramework="net45" />
<package id="xunit.extensibility.core" version="2.0.0" targetFramework="net45" />
</packages>

Просмотреть файл

@ -40,6 +40,7 @@
<Reference Include="System.Collections.Immutable">
<HintPath>..\..\packages\Microsoft.Bcl.Immutable.1.0.34\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
</Reference>
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
@ -83,9 +84,9 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\contrib\testkits\Akka.TestKit.Xunit\Akka.TestKit.Xunit.csproj">
<Project>{11F4D4B8-7E07-4457-ABF2-609B3E7B2649}</Project>
<Name>Akka.TestKit.Xunit</Name>
<ProjectReference Include="..\..\contrib\testkits\Akka.TestKit.Xunit2\Akka.TestKit.Xunit2.csproj">
<Project>{7dbd5c17-5e9d-40c4-9201-d092751532a7}</Project>
<Name>Akka.TestKit.Xunit2</Name>
</ProjectReference>
<ProjectReference Include="..\Akka.Remote\Akka.Remote.csproj">
<Project>{EA4FF8FD-7C53-49C8-B9AA-02E458B3E6A7}</Project>

Просмотреть файл

@ -17,7 +17,7 @@ using Akka.Configuration;
using Akka.Configuration.Hocon;
using Akka.Event;
using Akka.TestKit;
using Akka.TestKit.Xunit;
using Akka.TestKit.Xunit2;
using Akka.Util.Internal;
using Helios.Topology;

Просмотреть файл

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props" Condition="Exists('..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@ -12,6 +13,7 @@
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<NuGetPackageImportStamp>338f57d2</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -53,15 +55,21 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="xunit">
<HintPath>..\..\packages\xunit.1.9.2\lib\net20\xunit.dll</HintPath>
</Reference>
<Reference Include="Google.ProtocolBuffers">
<HintPath>..\..\packages\Google.ProtocolBuffers.2.4.1.521\lib\net40\Google.ProtocolBuffers.dll</HintPath>
</Reference>
<Reference Include="Google.ProtocolBuffers.Serialization">
<HintPath>..\..\packages\Google.ProtocolBuffers.2.4.1.521\lib\net40\Google.ProtocolBuffers.Serialization.dll</HintPath>
</Reference>
<Reference Include="xunit.abstractions">
<HintPath>..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
</Reference>
<Reference Include="xunit.assert">
<HintPath>..\..\packages\xunit.assert.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.assert.dll</HintPath>
</Reference>
<Reference Include="xunit.core">
<HintPath>..\..\packages\xunit.extensibility.core.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.dll</HintPath>
</Reference>
</ItemGroup>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
@ -94,9 +102,9 @@
<Compile Include="Transport\ThrottlerTransportAdapterSpec.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\contrib\testkits\Akka.TestKit.Xunit\Akka.TestKit.Xunit.csproj">
<Project>{11F4D4B8-7E07-4457-ABF2-609B3E7B2649}</Project>
<Name>Akka.TestKit.Xunit</Name>
<ProjectReference Include="..\..\contrib\testkits\Akka.TestKit.Xunit2\Akka.TestKit.Xunit2.csproj">
<Project>{7dbd5c17-5e9d-40c4-9201-d092751532a7}</Project>
<Name>Akka.TestKit.Xunit2</Name>
</ProjectReference>
<ProjectReference Include="..\Akka.Remote\Akka.Remote.csproj">
<Project>{EA4FF8FD-7C53-49C8-B9AA-02E458B3E6A7}</Project>
@ -143,6 +151,12 @@
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

Просмотреть файл

@ -11,6 +11,8 @@ using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
using Xunit;
[assembly: AssemblyTitle("Akka.Remote.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
@ -40,4 +42,4 @@ using System.Runtime.InteropServices;
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly, DisableTestParallelization = true)]

Просмотреть файл

@ -96,6 +96,7 @@ namespace Akka.Remote.Tests
}
}
".Replace("${masterSysName}", "Master" + sysName).Replace("${sysName}", sysName).Replace("${port}", port.ToString())).WithFallback(Sys.Settings.Config);
masterActorSystem = ActorSystem.Create("Master" + sysName, conf);
intendedRemoteAddress = Address.Parse("akka.tcp://${sysName}@localhost:${port}"

Просмотреть файл

@ -34,6 +34,8 @@ namespace Akka.Remote.Tests.Serialization
public DaemonMsgCreateSerializerSpec()
: base(@"akka.actor.provider = ""Akka.Remote.RemoteActorRefProvider, Akka.Remote""")
{
Akka.Serialization.Serialization.CurrentTransportInformation = null;
ser = Sys.Serialization;
supervisor = Sys.ActorOf(Props.Create<MyActor>(), "supervisor");
}

Просмотреть файл

@ -5,13 +5,13 @@
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.Linq;
using System.Threading.Tasks;
using Akka.Actor;
using Akka.Remote.Transport;
using Akka.TestKit;
using Google.ProtocolBuffers;
using System;
using System.Linq;
using System.Threading.Tasks;
using Xunit;
namespace Akka.Remote.Tests.Transport

Просмотреть файл

@ -211,19 +211,14 @@ namespace Akka.Remote.Tests.Transport
var received = ReceiveOne(TimeSpan.Zero);
if (received != null && received.Equals(new ThrottlingTester.Lost("BlackHole 3")))
return true;
else
{
here.Tell(new ThrottlingTester.Lost("BlackHole 3"));
return false;
}
here.Tell(new ThrottlingTester.Lost("BlackHole 3"));
return false;
}, TimeSpan.FromSeconds(15));
here.Tell("Cleanup");
FishForMessage(o =>
{
if (o.Equals("Cleanup")) return true;
return false;
}, TimeSpan.FromSeconds(5));
FishForMessage(o => o.Equals("Cleanup"), TimeSpan.FromSeconds(5));
}
#endregion

Просмотреть файл

@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Google.ProtocolBuffers" version="2.4.1.521" targetFramework="net45" />
<package id="xunit" version="1.9.2" targetFramework="net45" />
<package id="xunit" version="2.0.0" targetFramework="net45" />
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" />
<package id="xunit.assert" version="2.0.0" targetFramework="net45" />
<package id="xunit.core" version="2.0.0" targetFramework="net45" />
<package id="xunit.extensibility.core" version="2.0.0" targetFramework="net45" />
</packages>

Просмотреть файл

@ -31,4 +31,4 @@ using System.Runtime.InteropServices;
[assembly: InternalsVisibleTo("Akka.Remote.Tests")]
[assembly: InternalsVisibleTo("Akka.Cluster")]
[assembly: InternalsVisibleTo("Akka.Cluster.Tests")]
[assembly: InternalsVisibleTo("Akka.MultiNodeTests")]

Просмотреть файл

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props" Condition="Exists('..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@ -12,6 +13,7 @@
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<NuGetPackageImportStamp>71eec8b3</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -32,8 +34,14 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="xunit">
<HintPath>..\..\packages\xunit.1.9.2\lib\net20\xunit.dll</HintPath>
<Reference Include="xunit.abstractions">
<HintPath>..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
</Reference>
<Reference Include="xunit.assert">
<HintPath>..\..\packages\xunit.assert.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.assert.dll</HintPath>
</Reference>
<Reference Include="xunit.core">
<HintPath>..\..\packages\xunit.extensibility.core.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.dll</HintPath>
</Reference>
</ItemGroup>
<Choose>
@ -61,24 +69,28 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TestActorRefTests\WorkerActor.cs" />
<Compile Include="TestActorRefTests\WrappedTerminated.cs" />
<Compile Include="TestEventListenerTests\AllTestForEventFilterBase.cs" />
<Compile Include="TestEventListenerTests\AllTestForEventFilterBase_Instances.cs" />
<Compile Include="TestEventListenerTests\ConfigTests.cs" />
<Compile Include="TestEventListenerTests\CustomEventFilterTests.cs" />
<Compile Include="TestEventListenerTests\DeadLettersEventFilterTests.cs" />
<Compile Include="TestEventListenerTests\EventFilterTestBase.cs" />
<Compile Include="Xunit2\TestEventListenerTests\AllTestForEventFilterBase.cs" />
<Compile Include="Xunit2\TestEventListenerTests\AllTestForEventFilterBase_Instances.cs" />
<Compile Include="Xunit2\TestEventListenerTests\ConfigTests.cs" />
<Compile Include="Xunit2\TestEventListenerTests\CustomEventFilterTests.cs" />
<Compile Include="Xunit2\TestEventListenerTests\DeadLettersEventFilterTests.cs" />
<Compile Include="Xunit2\TestEventListenerTests\EventFilterTestBase.cs" />
<Compile Include="Xunit2\TestKitBaseTests\AwaitAssertTests.cs" />
<Compile Include="Xunit2\TestKitBaseTests\RemainingTests.cs" />
<Compile Include="Xunit2\TestKit_Config_Tests.cs" />
<Compile Include="TestEventListenerTests\ExceptionEventFilterTests.cs" />
<Compile Include="TestEventListenerTests\ForwardAllEventsTestEventListener.cs" />
<Compile Include="TestKitBaseTests\AwaitAssertTests.cs" />
<Compile Include="TestKitBaseTests\DilatedTests.cs" />
<Compile Include="TestKitBaseTests\ExpectTests.cs" />
<Compile Include="TestKitBaseTests\ReceiveTests.cs" />
<Compile Include="TestKitBaseTests\RemainingTests.cs" />
<Compile Include="TestKit_Config_Tests.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\contrib\testkits\Akka.TestKit.Xunit2\Akka.TestKit.Xunit2.csproj">
<Project>{7dbd5c17-5e9d-40c4-9201-d092751532a7}</Project>
<Name>Akka.TestKit.Xunit2</Name>
</ProjectReference>
<ProjectReference Include="..\..\contrib\testkits\Akka.TestKit.Xunit\Akka.TestKit.Xunit.csproj">
<Project>{11F4D4B8-7E07-4457-ABF2-609B3E7B2649}</Project>
<Project>{11f4d4b8-7e07-4457-abf2-609b3e7b2649}</Project>
<Name>Akka.TestKit.Xunit</Name>
</ProjectReference>
<ProjectReference Include="..\Akka.Tests.Shared.Internals\Akka.Tests.Shared.Internals.csproj">
@ -94,12 +106,13 @@
<Name>Akka.TestKit</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup />
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
<ItemGroup>
@ -126,6 +139,7 @@
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
<Error Condition="!Exists('..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

Просмотреть файл

@ -11,6 +11,8 @@ using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
using Xunit;
[assembly: AssemblyTitle("Akka.TestKit.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
@ -36,3 +38,4 @@ using System.Runtime.InteropServices;
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly, DisableTestParallelization = true)]

Просмотреть файл

@ -0,0 +1,224 @@
//-----------------------------------------------------------------------
// <copyright file="AllTestForEventFilterBase.cs" company="Akka.NET Project">
// Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com>
// Copyright (C) 2013-2015 Akka.NET project <https://github.com/akkadotnet/akka.net>
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.Threading.Tasks;
using Akka.Event;
using Xunit;
using Xunit.Sdk;
namespace Akka.TestKit.Tests.Xunit2.TestEventListenerTests
{
public abstract class AllTestForEventFilterBase<TLogEvent> : EventFilterTestBase where TLogEvent : LogEvent
{
// ReSharper disable ConvertToLambdaExpression
protected AllTestForEventFilterBase(string config)
: base(config)
{
LogLevel = Logging.LogLevelFor<TLogEvent>();
}
protected LogLevel LogLevel { get; private set; }
protected void LogMessage(string message)
{
Log.Log(LogLevel, message);
}
protected override void SendRawLogEventMessage(object message)
{
PublishMessage(message, "test");
}
protected abstract void PublishMessage(object message, string source);
[Fact]
public void SingleMessageIsIntercepted()
{
EventFilter.ForLogLevel(LogLevel).ExpectOne(() => LogMessage("whatever"));
TestSuccessful = true;
}
[Fact]
public void CanInterceptMessagesWhenStartIsSpecified()
{
EventFilter.ForLogLevel(LogLevel, start: "what").ExpectOne(() => LogMessage("whatever"));
TestSuccessful = true;
}
[Fact]
public void DoNotInterceptMessagesWhenStartDoesNotMatch()
{
EventFilter.ForLogLevel(LogLevel, start: "what").ExpectOne(() =>
{
LogMessage("let-me-thru");
LogMessage("whatever");
});
ExpectMsg<TLogEvent>(err => (string)err.Message == "let-me-thru");
TestSuccessful = true;
}
[Fact]
public void CanInterceptMessagesWhenMessageIsSpecified()
{
EventFilter.ForLogLevel(LogLevel, message: "whatever").ExpectOne(() => LogMessage("whatever"));
TestSuccessful = true;
}
[Fact]
public void DoNotInterceptMessagesWhenMessageDoesNotMatch()
{
EventFilter.ForLogLevel(LogLevel, message: "whatever").ExpectOne(() =>
{
LogMessage("let-me-thru");
LogMessage("whatever");
});
ExpectMsg<TLogEvent>(err => (string)err.Message == "let-me-thru");
TestSuccessful = true;
}
[Fact]
public void CanInterceptMessagesWhenContainsIsSpecified()
{
EventFilter.ForLogLevel(LogLevel, contains: "ate").ExpectOne(() => LogMessage("whatever"));
TestSuccessful = true;
}
[Fact]
public void DoNotInterceptMessagesWhenContainsDoesNotMatch()
{
EventFilter.ForLogLevel(LogLevel, contains: "eve").ExpectOne(() =>
{
LogMessage("let-me-thru");
LogMessage("whatever");
});
ExpectMsg<TLogEvent>(err => (string)err.Message == "let-me-thru");
TestSuccessful = true;
}
[Fact]
public void CanInterceptMessagesWhenSourceIsSpecified()
{
EventFilter.ForLogLevel(LogLevel, source: GetType().FullName).ExpectOne(() => LogMessage("whatever"));
TestSuccessful = true;
}
[Fact]
public void DoNotInterceptMessagesWhenSourceDoesNotMatch()
{
EventFilter.ForLogLevel(LogLevel, source: "expected-source").ExpectOne(() =>
{
PublishMessage("message", source: "expected-source");
PublishMessage("message", source: "let-me-thru");
});
ExpectMsg<TLogEvent>(err => err.LogSource == "let-me-thru");
TestSuccessful = true;
}
[Fact]
public void SpecifiedNumbersOfMessagesanBeIntercepted()
{
EventFilter.ForLogLevel(LogLevel).Expect(2, () =>
{
LogMessage("whatever");
LogMessage("whatever");
});
TestSuccessful = true;
}
[Fact]
public void MessagesCanBeMuted()
{
EventFilter.ForLogLevel(LogLevel).Mute(() =>
{
LogMessage("whatever");
LogMessage("whatever");
});
TestSuccessful = true;
}
[Fact]
public void MessagesCanBeMutedFromNowOn()
{
var unmutableFilter = EventFilter.ForLogLevel(LogLevel).Mute();
LogMessage("whatever");
LogMessage("whatever");
unmutableFilter.Unmute();
TestSuccessful = true;
}
[Fact]
public void MessagesCanBeMutedFromNowOnWithUsing()
{
using(EventFilter.ForLogLevel(LogLevel).Mute())
{
LogMessage("whatever");
LogMessage("whatever");
}
TestSuccessful = true;
}
[Fact]
public void MakeSureAsyncWorks()
{
EventFilter.ForLogLevel(LogLevel).Expect(1, TimeSpan.FromMilliseconds(100), () =>
{
Task.Delay(TimeSpan.FromMilliseconds(10)).ContinueWith(t => { LogMessage("whatever"); });
});
}
[Fact]
public void ChainManyFilters()
{
EventFilter
.ForLogLevel(LogLevel,message:"Message 1").And
.ForLogLevel(LogLevel,message:"Message 3")
.Expect(2,() =>
{
LogMessage("Message 1");
LogMessage("Message 2");
LogMessage("Message 3");
});
ExpectMsg<TLogEvent>(m => (string) m.Message == "Message 2");
}
[Fact]
public void ShouldTimeoutIfTooFewMessages()
{
var exception = XAssert.Throws<TrueException>(() =>
{
EventFilter.ForLogLevel(LogLevel).Expect(2, TimeSpan.FromMilliseconds(50), () =>
{
LogMessage("whatever");
});
});
Assert.Contains("timeout", exception.Message, StringComparison.OrdinalIgnoreCase);
}
[Fact]
public void ShouldLogWhenNotMuting()
{
const string message = "This should end up in the log since it's not filtered";
LogMessage(message);
ExpectMsg<TLogEvent>( msg => (string)msg.Message == message);
}
// ReSharper restore ConvertToLambdaExpression
}
}

Просмотреть файл

@ -0,0 +1,52 @@
//-----------------------------------------------------------------------
// <copyright file="AllTestForEventFilterBase_Instances.cs" company="Akka.NET Project">
// Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com>
// Copyright (C) 2013-2015 Akka.NET project <https://github.com/akkadotnet/akka.net>
// </copyright>
//-----------------------------------------------------------------------
using Akka.Event;
namespace Akka.TestKit.Tests.Xunit2.TestEventListenerTests
{
public class EventFilterDebugTests : AllTestForEventFilterBase<Debug>
{
public EventFilterDebugTests() : base("akka.loglevel=DEBUG"){}
protected override void PublishMessage(object message, string source)
{
Sys.EventStream.Publish(new Debug(source,GetType(),message));
}
}
public class EventFilterInfoTests : AllTestForEventFilterBase<Info>
{
public EventFilterInfoTests() : base("akka.loglevel=INFO") { }
protected override void PublishMessage(object message, string source)
{
Sys.EventStream.Publish(new Info(source, GetType(), message));
}
}
public class EventFilterWarningTests : AllTestForEventFilterBase<Warning>
{
public EventFilterWarningTests() : base("akka.loglevel=WARNING") { }
protected override void PublishMessage(object message, string source)
{
Sys.EventStream.Publish(new Warning(source, GetType(), message));
}
}
public class EventFilterErrorTests : AllTestForEventFilterBase<Error>
{
public EventFilterErrorTests() : base("akka.loglevel=ERROR") { }
protected override void PublishMessage(object message, string source)
{
Sys.EventStream.Publish(new Error(null, source, GetType(), message));
}
}
}

Просмотреть файл

@ -0,0 +1,24 @@
//-----------------------------------------------------------------------
// <copyright file="ConfigTests.cs" company="Akka.NET Project">
// Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com>
// Copyright (C) 2013-2015 Akka.NET project <https://github.com/akkadotnet/akka.net>
// </copyright>
//-----------------------------------------------------------------------
using System.Linq;
using Xunit;
namespace Akka.TestKit.Tests.Xunit2.TestEventListenerTests
{
public class ConfigTests : TestKit.Xunit2.TestKit
{
[Fact]
public void TestEventListener_is_in_config_by_default()
{
var configLoggers = Sys.Settings.Config.GetStringList("akka.loggers");
configLoggers.Any(logger => logger.Contains("Akka.TestKit.TestEventListener")).ShouldBeTrue();
configLoggers.Any(logger => logger.Contains("Akka.Event.DefaultLogger")).ShouldBeFalse();
}
}
}

Просмотреть файл

@ -0,0 +1,43 @@
//-----------------------------------------------------------------------
// <copyright file="CustomEventFilterTests.cs" company="Akka.NET Project">
// Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com>
// Copyright (C) 2013-2015 Akka.NET project <https://github.com/akkadotnet/akka.net>
// </copyright>
//-----------------------------------------------------------------------
using Akka.Event;
using Xunit;
namespace Akka.TestKit.Tests.Xunit2.TestEventListenerTests
{
public class CustomEventFilterTests : EventFilterTestBase
{
// ReSharper disable ConvertToLambdaExpression
public CustomEventFilterTests() : base("akka.loglevel=ERROR") { }
protected override void SendRawLogEventMessage(object message)
{
Sys.EventStream.Publish(new Error(null, "CustomEventFilterTests", GetType(), message));
}
[Fact]
public void CustomFilterShouldMatch()
{
EventFilter.Custom(logEvent => logEvent is Error && (string) logEvent.Message == "whatever").ExpectOne(() =>
{
Log.Error("whatever");
});
}
[Fact]
public void CustomFilterShouldMatch2()
{
EventFilter.Custom<Error>(logEvent => (string)logEvent.Message == "whatever").ExpectOne(() =>
{
Log.Error("whatever");
});
}
// ReSharper restore ConvertToLambdaExpression
}
}

Просмотреть файл

@ -0,0 +1,45 @@
//-----------------------------------------------------------------------
// <copyright file="DeadLettersEventFilterTests.cs" company="Akka.NET Project">
// Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com>
// Copyright (C) 2013-2015 Akka.NET project <https://github.com/akkadotnet/akka.net>
// </copyright>
//-----------------------------------------------------------------------
using Akka.Actor;
using Akka.Event;
using Akka.TestKit.TestActors;
using Xunit;
namespace Akka.TestKit.Tests.Xunit2.TestEventListenerTests
{
public class DeadLettersEventFilterTests : EventFilterTestBase
{
private readonly IActorRef _deadActor;
// ReSharper disable ConvertToLambdaExpression
public DeadLettersEventFilterTests() : base("akka.loglevel=ERROR")
{
_deadActor = Sys.ActorOf(BlackHoleActor.Props, "dead-actor");
Watch(_deadActor);
Sys.Stop(_deadActor);
ExpectTerminated(_deadActor);
}
protected override void SendRawLogEventMessage(object message)
{
Sys.EventStream.Publish(new Error(null, "DeadLettersEventFilterTests", GetType(), message));
}
[Fact]
public void ShouldBeAbleToFilterDeadLetters()
{
EventFilter.DeadLetter().ExpectOne(() =>
{
_deadActor.Tell("whatever");
});
}
// ReSharper restore ConvertToLambdaExpression
}
}

Просмотреть файл

@ -0,0 +1,54 @@
// <copyright file="EventFilterTestBase.cs" company="Akka.NET Project">
// Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com>
// Copyright (C) 2013-2015 Akka.NET project <https://github.com/akkadotnet/akka.net>
// </copyright>
//-----------------------------------------------------------------------
using Akka.Event;
using Akka.Testkit.Tests.TestEventListenerTests;
namespace Akka.TestKit.Tests.Xunit2.TestEventListenerTests
{
public abstract class EventFilterTestBase : TestKit.Xunit2.TestKit
{
/// <summary>
/// Used to signal that the test was successful and that we should ensure no more messages were logged
/// </summary>
protected bool TestSuccessful;
protected EventFilterTestBase(string config)
: base(@"akka.loggers = [""" + typeof(ForwardAllEventsTestEventListener).AssemblyQualifiedName + @"""], " + (string.IsNullOrEmpty(config) ? "" : config))
{
//We send a ForwardAllEventsTo containing message to the TestEventListenerToForwarder logger (configured as a logger above).
//It should respond with an "OK" message when it has received the message.
var initLoggerMessage = new ForwardAllEventsTestEventListener.ForwardAllEventsTo(TestActor);
// ReSharper disable once DoNotCallOverridableMethodsInConstructor
SendRawLogEventMessage(initLoggerMessage);
ExpectMsg("OK");
//From now on we know that all messsages will be forwarded to TestActor
}
protected abstract void SendRawLogEventMessage(object message);
protected override void AfterAll()
{
//After every test we make sure no uncatched messages have been logged
if(TestSuccessful)
{
EnsureNoMoreLoggedMessages();
}
base.AfterAll();
}
private void EnsureNoMoreLoggedMessages()
{
//We log a Finished message. When it arrives to TestActor we know no other message has been logged.
//If we receive something else it means another message was logged, and ExpectMsg will fail
const string message = "<<Finished>>";
SendRawLogEventMessage(message);
ExpectMsg<LogEvent>(err => (string) err.Message == message,hint: "message to be \"" + message + "\"");
}
}
}

Просмотреть файл

@ -0,0 +1,37 @@
//-----------------------------------------------------------------------
// <copyright file="AwaitAssertTests.cs" company="Akka.NET Project">
// Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com>
// Copyright (C) 2013-2015 Akka.NET project <https://github.com/akkadotnet/akka.net>
// </copyright>
//-----------------------------------------------------------------------
using System;
using Xunit;
using Xunit.Sdk;
namespace Akka.TestKit.Tests.Xunit2.TestKitBaseTests
{
public class AwaitAssertTests : TestKit.Xunit2.TestKit
{
public AwaitAssertTests() : base("akka.test.timefactor=2")
{
}
[Fact]
public void AwaitAssert_must_not_throw_any_exception_when_assertion_is_valid()
{
AwaitAssert(() => Assert.Equal("foo", "foo"));
}
[Fact]
public void AwaitAssert_must_throw_exception_when_assertion_is_invalid()
{
Within(TimeSpan.FromMilliseconds(300), TimeSpan.FromSeconds(1), () =>
{
Assert.Throws<EqualException>(() =>
AwaitAssert(() => Assert.Equal("foo", "bar"), TimeSpan.FromMilliseconds(500), TimeSpan.FromMilliseconds(300)));
});
}
}
}

Просмотреть файл

@ -0,0 +1,22 @@
//-----------------------------------------------------------------------
// <copyright file="RemainingTests.cs" company="Akka.NET Project">
// Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com>
// Copyright (C) 2013-2015 Akka.NET project <https://github.com/akkadotnet/akka.net>
// </copyright>
//-----------------------------------------------------------------------
using System;
using Xunit;
namespace Akka.TestKit.Tests.Xunit2.TestKitBaseTests
{
public class RemainingTests : TestKit.Xunit2.TestKit
{
[Fact]
public void Throw_if_remaining_is_called_outside_Within()
{
Assert.Throws<InvalidOperationException>(() => Remaining);
}
}
}

Просмотреть файл

@ -0,0 +1,32 @@
//-----------------------------------------------------------------------
// <copyright file="TestKit_Config_Tests.cs" company="Akka.NET Project">
// Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com>
// Copyright (C) 2013-2015 Akka.NET project <https://github.com/akkadotnet/akka.net>
// </copyright>
//-----------------------------------------------------------------------
using System;
using Xunit;
namespace Akka.TestKit.Tests.Xunit2
{
// ReSharper disable once InconsistentNaming
public class TestKit_Config_Tests : TestKit.Xunit2.TestKit
{
[Fact]
public void DefaultValues_should_be_correct()
{
TestKitSettings.DefaultTimeout.ShouldBe(TimeSpan.FromSeconds(5));
TestKitSettings.SingleExpectDefault.ShouldBe(TimeSpan.FromSeconds(3));
TestKitSettings.TestEventFilterLeeway.ShouldBe(TimeSpan.FromSeconds(3));
TestKitSettings.TestTimeFactor.ShouldBe(1);
var callingThreadDispatcherTypeName = typeof(CallingThreadDispatcherConfigurator).FullName + ", " + typeof(CallingThreadDispatcher).Assembly.GetName().Name;
Sys.Settings.Config.GetString("akka.test.calling-thread-dispatcher.type").ShouldBe(callingThreadDispatcherTypeName);
Sys.Settings.Config.GetString("akka.test.test-actor.dispatcher.type").ShouldBe(callingThreadDispatcherTypeName);
CallingThreadDispatcher.Id.ShouldBe("akka.test.calling-thread-dispatcher");
}
}
}

Просмотреть файл

@ -1,4 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="xunit" version="1.9.2" targetFramework="net45" />
<package id="xunit" version="2.0.0" targetFramework="net45" />
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" />
<package id="xunit.assert" version="2.0.0" targetFramework="net45" />
<package id="xunit.core" version="2.0.0" targetFramework="net45" />
<package id="xunit.extensibility.core" version="2.0.0" targetFramework="net45" />
</packages>

Просмотреть файл

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props" Condition="Exists('..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -13,6 +14,7 @@
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<NuGetPackageImportStamp>39789108</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -35,8 +37,16 @@
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="xunit">
<HintPath>..\..\packages\xunit.1.9.2\lib\net20\xunit.dll</HintPath>
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="xunit.abstractions">
<HintPath>..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
</Reference>
<Reference Include="xunit.assert">
<HintPath>..\..\packages\xunit.assert.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.assert.dll</HintPath>
</Reference>
<Reference Include="xunit.core">
<HintPath>..\..\packages\xunit.extensibility.core.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
@ -56,9 +66,9 @@
<None Include="README.md" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\contrib\testkits\Akka.TestKit.Xunit\Akka.TestKit.Xunit.csproj">
<Project>{11F4D4B8-7E07-4457-ABF2-609B3E7B2649}</Project>
<Name>Akka.TestKit.Xunit</Name>
<ProjectReference Include="..\..\contrib\testkits\Akka.TestKit.Xunit2\Akka.TestKit.Xunit2.csproj">
<Project>{7dbd5c17-5e9d-40c4-9201-d092751532a7}</Project>
<Name>Akka.TestKit.Xunit2</Name>
</ProjectReference>
<ProjectReference Include="..\Akka.TestKit\Akka.TestKit.csproj">
<Project>{0D3CBAD0-BBDB-43E5-AFC4-ED1D3ECDC224}</Project>
@ -76,6 +86,7 @@
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
<Error Condition="!Exists('..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

Просмотреть файл

@ -17,7 +17,7 @@ using Xunit.Sdk;
// ReSharper disable once CheckNamespace
namespace Akka.TestKit
{
public abstract class AkkaSpec : TestKit.Xunit.TestKit //AkkaSpec is not part of TestKit
public abstract class AkkaSpec : Xunit2.TestKit //AkkaSpec is not part of TestKit
{
private static Regex _nameReplaceRegex = new Regex("[^a-zA-Z0-9]", RegexOptions.Compiled);
private static readonly Config _akkaSpecConfig = ConfigurationFactory.ParseString(@"

Просмотреть файл

@ -8,7 +8,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Akka.TestKit.Xunit;
using Akka.TestKit.Xunit2;
using Xunit;
// ReSharper disable once CheckNamespace

Просмотреть файл

@ -1,4 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="xunit" version="1.9.2" targetFramework="net45" />
<package id="xunit" version="2.0.0" targetFramework="net45" />
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" />
<package id="xunit.assert" version="2.0.0" targetFramework="net45" />
<package id="xunit.core" version="2.0.0" targetFramework="net45" />
<package id="xunit.extensibility.core" version="2.0.0" targetFramework="net45" />
</packages>

Просмотреть файл

@ -8,6 +8,7 @@
using System;
using System.Threading;
using Akka.Actor;
using Akka.Actor.Internal;
using Akka.Serialization;
using Akka.TestKit;
using Akka.TestKit.TestActors;
@ -73,6 +74,7 @@ namespace Akka.Tests.Actor
public void An_ActorRef_should_not_allow_actors_to_be_created_outside_an_ActorOf()
{
Shutdown();
InternalCurrentActorCellKeeper.Current = null;
Intercept<ActorInitializationException>(() =>
{
new BlackHoleActor();
@ -105,20 +107,37 @@ namespace Akka.Tests.Actor
}
[Fact]
public void An_ActoRef_should_return_EmptyLocalActorRef_on_deserialize_if_not_present_in_actor_hierarchy_and_remoting_is_not_enabled()
public void
An_ActoRef_should_return_EmptyLocalActorRef_on_deserialize_if_not_present_in_actor_hierarchy_and_remoting_is_not_enabled
()
{
var aref = ActorOf<BlackHoleActor>("non-existing");
var aserializer = Sys.Serialization.FindSerializerForType(typeof(IActorRef));
var aserializer = Sys.Serialization.FindSerializerForType(typeof (IActorRef));
var binary = aserializer.ToBinary(aref);
Watch(aref);
aref.Tell(PoisonPill.Instance);
VerifyActorTermination(aref);
ExpectMsg<Terminated>();
var bserializer = Sys.Serialization.FindSerializerForType(typeof (IActorRef));
var bref = (IActorRef)bserializer.FromBinary(binary, typeof(IActorRef));
bref.GetType().ShouldBe(typeof(EmptyLocalActorRef));
bref.Path.ShouldBe(aref.Path);
AwaitCondition(() =>
{
var bref = (IActorRef) bserializer.FromBinary(binary, typeof (IActorRef));
try
{
bref.GetType().ShouldBe(typeof (EmptyLocalActorRef));
bref.Path.ShouldBe(aref.Path);
return true;
}
catch (Exception)
{
return false;
}
});
}
[Fact]

Просмотреть файл

@ -7,6 +7,7 @@
using System;
using System.Collections.Generic;
using System.Threading;
using Akka.Actor;
using Akka.Actor.Internal;
using Akka.Dispatch;
@ -54,25 +55,18 @@ namespace Akka.Tests.Actor
[Fact]
public void Bug209_any_user_messages_following_a_Terminate_message_should_be_forwarded_to_DeadLetterMailbox()
{
var actor = (LocalActorRef)Sys.ActorOf(Props.Empty, "killed-actor");
var actor = (LocalActorRef) Sys.ActorOf(Props.Empty, "killed-actor");
Watch(actor);
Sys.EventStream.Subscribe(TestActor, typeof (DeadLetter));
Sys.EventStream.Subscribe(TestActor, typeof(DeadLetter));
actor.Tell(PoisonPill.Instance);
ExpectMsg<Terminated>();
var mailbox = actor.Cell.Mailbox;
//Wait for the mailbox to become idle after processed all initial messages.
AwaitCondition(() =>
!mailbox.HasUnscheduledMessages && mailbox.Status == Mailbox.MailboxStatus.Idle);
//Suspend the mailbox and post Terminate and a user message
mailbox.Suspend();
mailbox.Post(actor, new Envelope() { Message = Terminate.Instance, Sender = TestActor });
mailbox.Post(actor, new Envelope() { Message = "SomeUserMessage", Sender = TestActor });
//Resume the mailbox, which will also schedule
mailbox.Resume();
actor.Tell(new Envelope { Message = "SomeUserMessage", Sender = TestActor });
ExpectMsg<DeadLetter>(d => ((Envelope)d.Message).Message.Equals("SomeUserMessage"));
//The actor should Terminate, exchange the mailbox to a DeadLetterMailbox and forward the user message to the DeadLetterMailbox
ExpectMsg<DeadLetter>(d => (string)d.Message == "SomeUserMessage");
actor.Cell.Mailbox.ShouldBe(Sys.Mailboxes.DeadLetterMailbox);
}

Просмотреть файл

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\xunit.runner.visualstudio.2.0.0-rc1-build1030\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\..\packages\xunit.runner.visualstudio.2.0.0-rc1-build1030\build\net20\xunit.runner.visualstudio.props')" />
<Import Project="..\..\packages\xunit.runner.visualstudio.2.0.0\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\..\packages\xunit.runner.visualstudio.2.0.0\build\net20\xunit.runner.visualstudio.props')" />
<Import Project="..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props" Condition="Exists('..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@ -13,7 +14,7 @@
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<NuGetPackageImportStamp>86a30492</NuGetPackageImportStamp>
<NuGetPackageImportStamp>1318f3e8</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -54,18 +55,29 @@
<Optimize>false</Optimize>
</PropertyGroup>
<ItemGroup>
<Reference Include="FluentAssertions">
<HintPath>..\..\packages\FluentAssertions.3.3.0\lib\net45\FluentAssertions.dll</HintPath>
</Reference>
<Reference Include="FluentAssertions.Core">
<HintPath>..\..\packages\FluentAssertions.3.3.0\lib\net45\FluentAssertions.Core.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web" />
<Reference Include="xunit">
<HintPath>..\..\packages\xunit.1.9.2\lib\net20\xunit.dll</HintPath>
</Reference>
<Reference Include="xunit.extensions">
<HintPath>..\..\packages\xunit.extensions.1.9.2\lib\net20\xunit.extensions.dll</HintPath>
</Reference>
<Reference Include="fastJSON">
<HintPath>..\..\packages\fastJSON.2.0.27.1\lib\net40\fastjson.dll</HintPath>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
</Reference>
<Reference Include="xunit.assert">
<HintPath>..\..\packages\xunit.assert.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.assert.dll</HintPath>
</Reference>
<Reference Include="xunit.core">
<HintPath>..\..\packages\xunit.extensibility.core.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.dll</HintPath>
</Reference>
</ItemGroup>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
@ -154,9 +166,9 @@
<Compile Include="Util\TypeExtensionsTests.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\contrib\testkits\Akka.TestKit.Xunit\Akka.TestKit.Xunit.csproj">
<Project>{11F4D4B8-7E07-4457-ABF2-609B3E7B2649}</Project>
<Name>Akka.TestKit.Xunit</Name>
<ProjectReference Include="..\..\contrib\testkits\Akka.TestKit.Xunit2\Akka.TestKit.Xunit2.csproj">
<Project>{7dbd5c17-5e9d-40c4-9201-d092751532a7}</Project>
<Name>Akka.TestKit.Xunit2</Name>
</ProjectReference>
<ProjectReference Include="..\Akka.Tests.Shared.Internals\Akka.Tests.Shared.Internals.csproj">
<Project>{E636D23C-3432-4AA9-9A5D-5F29D33D3399}</Project>
@ -205,7 +217,8 @@
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\xunit.runner.visualstudio.2.0.0-rc1-build1030\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\xunit.runner.visualstudio.2.0.0-rc1-build1030\build\net20\xunit.runner.visualstudio.props'))" />
<Error Condition="!Exists('..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props'))" />
<Error Condition="!Exists('..\..\packages\xunit.runner.visualstudio.2.0.0\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\xunit.runner.visualstudio.2.0.0\build\net20\xunit.runner.visualstudio.props'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

Просмотреть файл

@ -11,6 +11,8 @@ using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
using Xunit;
[assembly: AssemblyTitle("Akka.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
@ -41,3 +43,4 @@ using System.Runtime.InteropServices;
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly, DisableTestParallelization = true)]

Просмотреть файл

@ -12,6 +12,7 @@ using Akka.Actor;
using Akka.Routing;
using Akka.TestKit;
using Xunit;
using FluentAssertions;
namespace Akka.Tests.Routing
{
@ -159,7 +160,7 @@ namespace Akka.Tests.Routing
(RouteeSize(router)).ShouldBe(resizer.LowerBound);
Action<int, TimeSpan, int?> loop = (loops, span, expectedBound) =>
Action<int, TimeSpan, int?> loopTillAppropriateSize = (loops, span, expectedBound) =>
{
for (var i = 0; i < loops; i++)
{
@ -172,23 +173,14 @@ namespace Akka.Tests.Routing
//sending too quickly will result in skipped resize due to many resizeInProgress conflicts
Thread.Sleep(TimeSpan.FromMilliseconds(20));
}
var max = TimeSpan.FromMilliseconds((span.TotalMilliseconds*loops)/resizer.LowerBound) +
TimeSpan.FromSeconds(2);
Within(max, () =>
{
for (var i = 0; i < loops; i++) ExpectMsg("done");
return true;
});
};
// 2 more should go through without triggering more
loop(2, TimeSpan.FromMilliseconds(200), null);
loopTillAppropriateSize(2, TimeSpan.FromMilliseconds(200), null);
RouteeSize(router).ShouldBe(resizer.LowerBound);
// a whole bunch should max it out
loop(100, TimeSpan.FromMilliseconds(500), resizer.UpperBound);
loopTillAppropriateSize(200, TimeSpan.FromMilliseconds(500), resizer.UpperBound);
RouteeSize(router).ShouldBe(resizer.UpperBound);
}
@ -216,7 +208,7 @@ namespace Akka.Tests.Routing
var router = Sys.ActorOf(Props.Create<BackoffActor>().WithRouter(new RoundRobinPool(0, resizer)));
// put some pressure on the router
for (var i = 0; i < 50; i++)
for (var i = 0; i < 200; i++)
{
router.Tell(150);
if (RouteeSize(router) > 2)
@ -230,22 +222,20 @@ namespace Akka.Tests.Routing
Thread.Sleep(300);
// let it cool down
AwaitCondition(() =>
AwaitAssert(() =>
{
router.Tell(0); //trigger resize
Thread.Sleep(20);
return RouteeSize(router) < z;
}, null, TimeSpan.FromMilliseconds(500));
RouteeSize(router).Should().BeLessThan(z);
}, null, TimeSpan.FromSeconds(1));
});
}
#region Internal methods
private int RouteeSize(IActorRef router)
private static int RouteeSize(IActorRef router)
{
var routeesTask = router.Ask<Routees>(new GetRoutees(), TestKitSettings.DefaultTimeout);
routeesTask.Wait(TestKitSettings.DefaultTimeout);
return routeesTask.Result.Members.Count();
return ((RoutedActorRef) router).Children.Count();
}
#endregion

Просмотреть файл

@ -66,16 +66,12 @@ namespace Akka.Tests.Routing
[Fact]
public void RoundRobin_should_not_throw_IndexOutOfRangeException_when_counter_wraps_to_be_negative()
{
Assert.DoesNotThrow(
() =>
{
var routees = new[] {Routee.NoRoutee, Routee.NoRoutee, Routee.NoRoutee};
var routingLogic = new RoundRobinRoutingLogic(int.MaxValue - 5);
for (var i = 0; i < 10; i++)
{
routingLogic.Select(i, routees);
}
});
var routees = new[] {Routee.NoRoutee, Routee.NoRoutee, Routee.NoRoutee};
var routingLogic = new RoundRobinRoutingLogic(int.MaxValue - 5);
for (var i = 0; i < 10; i++)
{
routingLogic.Select(i, routees);
}
}
}
}

Просмотреть файл

@ -72,12 +72,13 @@ namespace Akka.Tests.Routing
Watch(router);
Watch(c2);
Sys.Stop(c2);
c2.Tell(PoisonPill.Instance);
ExpectMsg<Terminated>();
AwaitCondition(() => ((RoutedActorRef) router).Children.Count() == 1);
ExpectTerminated(c2).ExistenceConfirmed.ShouldBe(true);
router.Tell("", TestActor);
var msg1 = ExpectMsg<IActorRef>();
msg1.ShouldBe(c1);
@ -85,9 +86,6 @@ namespace Akka.Tests.Routing
router.Tell("", TestActor);
var msg2 = ExpectMsg<IActorRef>();
msg2.ShouldBe(c1);
Sys.Stop(c1);
ExpectTerminated(router).ExistenceConfirmed.ShouldBe(true);
}
public class TestResizer : Resizer

Просмотреть файл

@ -87,16 +87,12 @@ namespace Akka.Tests.Routing
[Fact]
public void SmallestMail_should_not_throw_IndexOutOfRangeException_when_counter_wraps_to_be_negative()
{
Assert.DoesNotThrow(
() =>
{
var routees = new[] {Routee.NoRoutee, Routee.NoRoutee, Routee.NoRoutee};
var routingLogic = new SmallestMailboxRoutingLogic(int.MaxValue - 5);
for (var i = 0; i < 10; i++)
{
routingLogic.Select(i, routees);
}
});
var routees = new[] {Routee.NoRoutee, Routee.NoRoutee, Routee.NoRoutee};
var routingLogic = new SmallestMailboxRoutingLogic(int.MaxValue - 5);
for (var i = 0; i < 10; i++)
{
routingLogic.Select(i, routees);
}
}
}
}

Просмотреть файл

@ -1,7 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="fastJSON" version="2.0.27.1" targetFramework="net45" />
<package id="xunit" version="1.9.2" targetFramework="net45" />
<package id="xunit.extensions" version="1.9.2" targetFramework="net45" />
<package id="xunit.runner.visualstudio" version="2.0.0-rc1-build1030" targetFramework="net45" />
<package id="FluentAssertions" version="3.3.0" targetFramework="net45" />
<package id="xunit" version="2.0.0" targetFramework="net45" />
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" />
<package id="xunit.assert" version="2.0.0" targetFramework="net45" />
<package id="xunit.core" version="2.0.0" targetFramework="net45" />
<package id="xunit.extensibility.core" version="2.0.0" targetFramework="net45" />
<package id="xunit.extensions" version="2.0.0" targetFramework="net45" />
<package id="xunit.runner.visualstudio" version="2.0.0" targetFramework="net45" />
</packages>

Просмотреть файл

@ -48,7 +48,7 @@ namespace Akka.Actor
protected void ReceivedTerminated(Terminated t)
{
if (!_state.ContainsTerminated(t.ActorRef))
if (!_state.ContainsTerminated(t.ActorRef))
return;
_state = _state.RemoveTerminated(t.ActorRef); // here we know that it is the SAME ref which was put in
@ -163,12 +163,12 @@ namespace Akka.Actor
if (watcheeSelf && !watcherSelf)
{
if (!_state.ContainsWatchedBy(watcher)) MaintainAddressTerminatedSubscription(() =>
{
//_watchedBy.Add(watcher);
_state = _state.AddWatchedBy(watcher);
{
//_watchedBy.Add(watcher);
_state = _state.AddWatchedBy(watcher);
if (System.Settings.DebugLifecycle) Publish(new Debug(Self.Path.ToString(), Actor.GetType(), string.Format("now watched by {0}", watcher)));
}, watcher);
if (System.Settings.DebugLifecycle) Publish(new Debug(Self.Path.ToString(), Actor.GetType(), string.Format("now watched by {0}", watcher)));
}, watcher);
}
else if (!watcheeSelf && watcherSelf)
{
@ -243,9 +243,9 @@ namespace Akka.Actor
block();
var has = HasNonLocalAddress();
if (had && !has)
if (had && !has)
UnsubscribeAddressTerminated();
else if (!had && has)
else if (!had && has)
SubscribeAddressTerminated();
}
else
@ -256,7 +256,7 @@ namespace Akka.Actor
private static bool IsNonLocal(IActorRef @ref)
{
if (@ref == null)
if (@ref == null)
return true;
var a = @ref as IInternalActorRef;

Просмотреть файл

@ -34,4 +34,4 @@ using System.Runtime.InteropServices;
[assembly: InternalsVisibleTo("Akka.Cluster")]
[assembly: InternalsVisibleTo("Akka.Cluster.Tests")]
[assembly: InternalsVisibleTo("Akka.MultiNodeTestRunner.Shared.Tests")]
[assembly: InternalsVisibleTo("Akka.MultiNodeTests")]

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше