Преглед изворни кода

Target netfwk471;netcoreap2.1 in tests

Lucas Trzesniewski пре 7 година
родитељ
комит
6048b6a9cc
37 измењених фајлова са 113 додато и 249 уклоњено
  1. 8 23
      src/Abc.Zebus.Testing/Abc.Zebus.Testing.csproj
  2. 6 6
      src/Abc.Zebus.Testing/Extensions/NUnitExtensions.cs
  3. 2 3
      src/Abc.Zebus.Testing/MessageSerializationTester.cs
  4. 0 33
      src/Abc.Zebus.Tests.TestExe/Abc.Zebus.Tests.TestExe.csproj
  5. 0 6
      src/Abc.Zebus.Tests.TestExe/App.config
  6. 0 9
      src/Abc.Zebus.Tests.TestExe/Program.cs
  7. 0 36
      src/Abc.Zebus.Tests.TestExe/Properties/AssemblyInfo.cs
  8. 7 24
      src/Abc.Zebus.Tests/Abc.Zebus.Tests.csproj
  9. 1 1
      src/Abc.Zebus.Tests/Core/BusManualTests.cs
  10. 1 1
      src/Abc.Zebus.Tests/Core/BusPerformanceTests.cs
  11. 1 1
      src/Abc.Zebus.Tests/Core/BusTests.Subscribe.cs
  12. 2 2
      src/Abc.Zebus.Tests/Core/BusTests.cs
  13. 4 4
      src/Abc.Zebus.Tests/Directory/PeerDirectoryClientTests.Performance.cs
  14. 2 2
      src/Abc.Zebus.Tests/Directory/PeerSubscriptionTreeTests.Performance.cs
  15. 4 4
      src/Abc.Zebus.Tests/Dispatch/DispatchQueueTests.cs
  16. 2 2
      src/Abc.Zebus.Tests/Dispatch/MessageDispatcherTests.CustomQueues.cs
  17. 1 1
      src/Abc.Zebus.Tests/Dispatch/SyncMessageHandlerInvokerTests.cs
  18. 2 2
      src/Abc.Zebus.Tests/Log4netConfigurator.cs
  19. 4 3
      src/Abc.Zebus.Tests/MessageIdTests.cs
  20. 2 2
      src/Abc.Zebus.Tests/Program.cs
  21. 1 1
      src/Abc.Zebus.Tests/Routing/BindingKeyPredicateBuilderTests.cs
  22. 1 1
      src/Abc.Zebus.Tests/Routing/BindingKeyTests.cs
  23. 8 10
      src/Abc.Zebus.Tests/Serialization/TestMessageSerializer.cs
  24. 1 1
      src/Abc.Zebus.Tests/SubscriptionTests.cs
  25. 1 1
      src/Abc.Zebus.Tests/Transport/TransportMessageReaderTests.cs
  26. 1 1
      src/Abc.Zebus.Tests/Transport/TransportMessageWriterTests.cs
  27. 1 1
      src/Abc.Zebus.Tests/Transport/ZmqTests.cs
  28. 1 1
      src/Abc.Zebus.Tests/Transport/ZmqTransportPerformanceTests.cs
  29. 6 6
      src/Abc.Zebus.Tests/Transport/ZmqTransportTests.cs
  30. 1 1
      src/Abc.Zebus.Tests/Util/Collections/FlushableBlockingCollectionPerformanceTests.cs
  31. 13 10
      src/Abc.Zebus.Tests/Util/Collections/FlushableBlockingCollectionTests.cs
  32. 3 16
      src/Abc.Zebus.Tests/Util/TypeUtilTests.cs
  33. 2 7
      src/Abc.Zebus.sln
  34. 0 14
      src/Abc.Zebus/Abc.Zebus.csproj
  35. 8 11
      src/Abc.Zebus/Util/Extensions/ExtendDictionary.cs
  36. 4 2
      src/Abc.Zebus/Util/Extensions/ExtendIEnumerable.cs
  37. 12 0
      src/Directory.Build.props

+ 8 - 23
src/Abc.Zebus.Testing/Abc.Zebus.Testing.csproj

@@ -1,42 +1,26 @@
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
-    <TargetFramework>net461</TargetFramework>
+    <TargetFramework>netstandard2.0</TargetFramework>
     <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
   </PropertyGroup>
 
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Debug\</OutputPath>
-    <DefineConstants>DEBUG;TRACE</DefineConstants>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>pdbonly</DebugType>
-    <Optimize>true</Optimize>
-    <OutputPath>bin\Release\</OutputPath>
-    <DefineConstants>TRACE</DefineConstants>
-  </PropertyGroup>
-
   <ItemGroup>
     <ProjectReference Include="..\Abc.Zebus\Abc.Zebus.csproj" />
   </ItemGroup>
 
   <ItemGroup>
-    <PackageReference Include="AutoFixture" Version="3.36.8" />
-    <PackageReference Include="CompareNETObjects" Version="3.03.0.0" />
-    <PackageReference Include="Moq" Version="4.2.1507.0118" />
+    <PackageReference Include="AutoFixture" Version="4.4.0" />
+    <PackageReference Include="CompareNETObjects" Version="4.54.0" />
+    <PackageReference Include="Moq" Version="4.8.3" />
     <PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
-    <PackageReference Include="NUnit" Version="2.6.4" />
+    <PackageReference Include="NUnit" Version="3.10.1" />
     <PackageReference Include="protobuf-net" Version="2.3.13" />
     <PackageReference Include="structuremap" Version="4.6.1" />
-  </ItemGroup>
-
-  <ItemGroup>
-    <Reference Include="System.Management" />
+    <PackageReference Include="System.Management" Version="4.5.0" />
+    <PackageReference Include="System.Reflection.TypeExtensions" Version="4.5.0" />
   </ItemGroup>
 
   <ItemGroup>
@@ -50,4 +34,5 @@
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
   </ItemGroup>
+
 </Project>

+ 6 - 6
src/Abc.Zebus.Testing/Extensions/NUnitExtensions.cs

@@ -152,8 +152,8 @@ namespace Abc.Zebus.Testing.Extensions
         {
             foreach (var obj in actual)
             {
-                var empty = Tolerance.Empty;
-                if (NUnitEqualityComparer.Default.AreEqual(obj, expected, ref empty))
+                var empty = Tolerance.Default;
+                if (new NUnitEqualityComparer().AreEqual(obj, expected, ref empty))
                     return;
             }
 
@@ -176,8 +176,8 @@ namespace Abc.Zebus.Testing.Extensions
         {
             foreach (var obj in actual)
             {
-                var empty = Tolerance.Empty;
-                if (NUnitEqualityComparer.Default.AreEqual(obj, expected, ref empty))
+                var empty = Tolerance.Default;
+                if (new NUnitEqualityComparer().AreEqual(obj, expected, ref empty))
                     Assert.Fail("'{0}' is present in the enumerable", expected);
             }
         }
@@ -254,12 +254,12 @@ namespace Abc.Zebus.Testing.Extensions
 
         public static void ShouldContain(this string actual, string expected)
         {
-            Assert.That(actual, Is.StringContaining(expected));
+            Assert.That(actual, Does.Contain(expected));
         }
 
         public static void ShouldContainIgnoreCase(this string actual, string expected)
         {
-            Assert.That(actual, Is.StringContaining(expected).IgnoreCase);
+            Assert.That(actual, Does.Contain(expected).IgnoreCase);
         }
 
         public static void ShouldNotContain(this string actual, string expected)

+ 2 - 3
src/Abc.Zebus.Testing/MessageSerializationTester.cs

@@ -8,8 +8,8 @@ using Abc.Zebus.Testing.Comparison;
 using Abc.Zebus.Testing.Extensions;
 using Abc.Zebus.Util.Extensions;
 using NUnit.Framework;
-using Ploeh.AutoFixture;
-using Ploeh.AutoFixture.Kernel;
+using AutoFixture;
+using AutoFixture.Kernel;
 
 namespace Abc.Zebus.Testing
 {
@@ -69,7 +69,6 @@ namespace Abc.Zebus.Testing
 
             fixture.Inject(sourcing);
             fixture.Inject(new Uri(@"http://this.is.just.a.valid.url/"));
-            fixture.Customize(new MultipleCustomization());
             fixture.Inject('X');
 
             return fixture;

+ 0 - 33
src/Abc.Zebus.Tests.TestExe/Abc.Zebus.Tests.TestExe.csproj

@@ -1,33 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-  <PropertyGroup>
-    <TargetFramework>net461</TargetFramework>
-    <OutputType>Exe</OutputType>
-    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <PlatformTarget>AnyCPU</PlatformTarget>
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Debug\</OutputPath>
-    <DefineConstants>DEBUG;TRACE</DefineConstants>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <PlatformTarget>AnyCPU</PlatformTarget>
-    <DebugType>pdbonly</DebugType>
-    <Optimize>true</Optimize>
-    <OutputPath>bin\Release\</OutputPath>
-    <DefineConstants>TRACE</DefineConstants>
-  </PropertyGroup>
-
-  <ItemGroup>
-    <Reference Include="System.Data.DataSetExtensions" />
-    <Reference Include="Microsoft.CSharp" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="App.config" />
-  </ItemGroup>
-</Project>

+ 0 - 6
src/Abc.Zebus.Tests.TestExe/App.config

@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<configuration>
-    <startup> 
-        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
-    </startup>
-</configuration>

+ 0 - 9
src/Abc.Zebus.Tests.TestExe/Program.cs

@@ -1,9 +0,0 @@
-namespace Abc.Zebus.Tests.TestExe
-{
-    class Program
-    {
-        static void Main(string[] args)
-        {
-        }
-    }
-}

+ 0 - 36
src/Abc.Zebus.Tests.TestExe/Properties/AssemblyInfo.cs

@@ -1,36 +0,0 @@
-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("Abc.Zebus.Tests.TestExe")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("ABC arbitrage Asset Management")]
-[assembly: AssemblyProduct("Abc.Zebus.Tests.TestExe")]
-[assembly: AssemblyCopyright("Copyright © ABC arbitrage Asset Management 2016")]
-[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("32dddd8d-af51-47e6-a145-cf15fed45ba1")]
-
-// 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")]

+ 7 - 24
src/Abc.Zebus.Tests/Abc.Zebus.Tests.csproj

@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
-    <TargetFramework>net461</TargetFramework>
-    <OutputType>Exe</OutputType>
+    <TargetFrameworks>net471;netcoreapp2.1</TargetFrameworks>
+    <OutputType>Library</OutputType>
     <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
@@ -9,37 +9,23 @@
     <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
 
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Debug\</OutputPath>
-    <DefineConstants>DEBUG;TRACE</DefineConstants>
-    <UseVSHostingProcess>false</UseVSHostingProcess>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>pdbonly</DebugType>
-    <Optimize>true</Optimize>
-    <OutputPath>bin\Release\</OutputPath>
-    <DefineConstants>TRACE</DefineConstants>
-  </PropertyGroup>
-
   <ItemGroup>
     <EmbeddedResource Include="Transport\transport_message_1_4_1.bin" />
   </ItemGroup>
 
   <ItemGroup>
     <ProjectReference Include="..\Abc.Zebus.Testing\Abc.Zebus.Testing.csproj" />
-    <ProjectReference Include="..\Abc.Zebus.Tests.TestExe\Abc.Zebus.Tests.TestExe.csproj" />
     <ProjectReference Include="..\Abc.Zebus\Abc.Zebus.csproj" />
   </ItemGroup>
 
   <ItemGroup>
-    <PackageReference Include="CompareNETObjects" Version="3.03.0.0" />
+    <PackageReference Include="CompareNETObjects" Version="4.54.0" />
     <PackageReference Include="log4net" Version="2.0.8" />
-    <PackageReference Include="Moq" Version="4.2.1507.0118" />
+    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.2" />
+    <PackageReference Include="Moq" Version="4.8.3" />
     <PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
-    <PackageReference Include="NUnit" Version="2.6.4" />
+    <PackageReference Include="NUnit" Version="3.10.1" />
+    <PackageReference Include="NUnit3TestAdapter" Version="3.10.0" />
     <PackageReference Include="protobuf-net" Version="2.3.13" />
     <PackageReference Include="structuremap" Version="4.6.1" />
   </ItemGroup>
@@ -61,7 +47,4 @@
     </None>
   </ItemGroup>
 
-  <ItemGroup>
-    <Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
-  </ItemGroup>
 </Project>

+ 1 - 1
src/Abc.Zebus.Tests/Core/BusManualTests.cs

@@ -16,7 +16,7 @@ using Timeout = ABC.ServiceBus.Contracts.Timeout;
 namespace Abc.Zebus.Tests.Core
 {
     [TestFixture]
-    [Ignore]
+    [Explicit]
     [Category("ManualOnly")]
     public class BusManualTests
     {

+ 1 - 1
src/Abc.Zebus.Tests/Core/BusPerformanceTests.cs

@@ -15,7 +15,7 @@ using ProtoBuf;
 namespace Abc.Zebus.Tests.Core
 {
     [TestFixture]
-    [Ignore]
+    [Explicit]
     [Category("ManualOnly")]
     public class BusPerformanceTests
     {

+ 1 - 1
src/Abc.Zebus.Tests/Core/BusTests.Subscribe.cs

@@ -371,7 +371,7 @@ namespace Abc.Zebus.Tests.Core
             }
 
             [Test]
-            [Ignore("The implementation is non trivial and will be dealt with later")]
+            [Explicit("The implementation is non trivial and will be dealt with later")]
             public void subscriptions_sent_to_the_directory_should_always_be_more_recent_than_the_previous()
             {
                 const int threadCount = 10;

+ 2 - 2
src/Abc.Zebus.Tests/Core/BusTests.cs

@@ -13,7 +13,7 @@ using NUnit.Framework;
 
 namespace Abc.Zebus.Tests.Core
 {
-    [TestFixture, Timeout(20000)]
+    [TestFixture]
     public abstract partial class BusTests
     {
         private const string _environment = "Test";
@@ -89,4 +89,4 @@ namespace Abc.Zebus.Tests.Core
         {
         }
     }
-}
+}

+ 4 - 4
src/Abc.Zebus.Tests/Directory/PeerDirectoryClientTests.Performance.cs

@@ -12,7 +12,7 @@ namespace Abc.Zebus.Tests.Directory
     public partial class PeerDirectoryClientTests
     {
         [Test]
-        [Ignore]
+        [Explicit]
         [Category("ManualOnly")]
         public void MeasureUpdatePerformance()
         {
@@ -70,7 +70,7 @@ namespace Abc.Zebus.Tests.Directory
         }
 
         [Test]
-        [Ignore]
+        [Explicit]
         [Category("ManualOnly")]
         public void MeasureUpdatePerformanceWithManyBindingKeys()
         {
@@ -94,7 +94,7 @@ namespace Abc.Zebus.Tests.Directory
         }
 
         [Test]
-        [Ignore]
+        [Explicit]
         [Category("ManualOnly")]
         public void MeasureMemoryConsumption()
         {
@@ -136,7 +136,7 @@ namespace Abc.Zebus.Tests.Directory
             Console.WriteLine("Breakpoint here");
         }
 
-        [Test, Ignore("Performance test")]
+        [Test, Explicit("Performance test")]
         public void MeasureMemoryConsumptionForSingleFatPeer()
         {
             var subscriptions = new List<Subscription>();

+ 2 - 2
src/Abc.Zebus.Tests/Directory/PeerSubscriptionTreeTests.Performance.cs

@@ -12,7 +12,7 @@ namespace Abc.Zebus.Tests.Directory
     public partial class PeerSubscriptionTreeTests
     {
         [Test]
-        [Ignore]
+        [Explicit]
         [Category("ManualOnly")]
         [TestCase("a.e.f")]
         [TestCase("a.e")]
@@ -54,7 +54,7 @@ namespace Abc.Zebus.Tests.Directory
             });
         }
 
-        [Test, Ignore("Manual tests")]
+        [Test, Explicit("Manual tests")]
         public void MeasureStaticSubscriptionsPerformance()
         {
             var peers = Enumerable.Range(0, 100).Select(x => new Peer(new PeerId("Abc.Testing" + x), "tcp://testing:" + x)).ToList();

+ 4 - 4
src/Abc.Zebus.Tests/Dispatch/DispatchQueueTests.cs

@@ -277,7 +277,7 @@ namespace Abc.Zebus.Tests.Dispatch
             dispatch2.Result.Errors.ShouldNotBeEmpty();
         }
 
-        [Test, Timeout(5000)]
+        [Test]
         public void should_run_async_without_blocking_dispatcher_thread()
         {
             var tcs = new TaskCompletionSource<object>();
@@ -306,7 +306,7 @@ namespace Abc.Zebus.Tests.Dispatch
             secondMessage.DispatchQueueName.ShouldEqual(_dispatchQueue.Name);
         }
 
-        [Test, Timeout(5000)]
+        [Test]
         public void should_enqueue_async_continuations_on_dispatch_queue_when_requested()
         {
             _dispatchQueue.Start();
@@ -365,7 +365,7 @@ namespace Abc.Zebus.Tests.Dispatch
             Volatile.Read(ref secondMessageDispatchQueueAfterAwait).ShouldBeNull();
         }
 
-        [Test, Timeout(5000)]
+        [Test]
         public void should_propagate_async_exceptions_from_continuations()
         {
             var tcs = new TaskCompletionSource<object>();
@@ -398,7 +398,7 @@ namespace Abc.Zebus.Tests.Dispatch
             secondTask.Result.Errors.Count.ShouldEqual(1);
         }
 
-        [Test, Timeout(5000)]
+        [Test]
         public void should_internleave_sync_and_async_messages_properly()
         {
             var tcs = new TaskCompletionSource<object>();

+ 2 - 2
src/Abc.Zebus.Tests/Dispatch/MessageDispatcherTests.CustomQueues.cs

@@ -15,7 +15,7 @@ namespace Abc.Zebus.Tests.Dispatch
 {
     public partial class MessageDispatcherTests
     {
-        [Test, Timeout(3000)]
+        [Test]
         public void should_dispatch_message_to_queue_name()
         {
             _messageDispatcher.LoadMessageHandlerInvokers();
@@ -265,4 +265,4 @@ namespace Abc.Zebus.Tests.Dispatch
             }
         }
     }
-}
+}

+ 1 - 1
src/Abc.Zebus.Tests/Dispatch/SyncMessageHandlerInvokerTests.cs

@@ -114,7 +114,7 @@ namespace Abc.Zebus.Tests.Dispatch
             ReferenceEquals(handler1, handler2).ShouldBeTrue("references should be equal");
         }
 
-        [Test, Ignore("Manual test")]
+        [Test, Explicit("Manual test")]
         public void MeasureHandlerCreationPerformances()
         {
             var busMock = new Mock<IBus>();

+ 2 - 2
src/Abc.Zebus.Tests/Log4netConfigurator.cs

@@ -11,11 +11,11 @@ namespace Abc.Zebus.Tests
     [SetUpFixture]
     public class Log4netConfigurator
     {
-        [SetUp]
+        [OneTimeSetUp]
         public void Setup()
         {
             var configurationFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "log4net.config");
-            XmlConfigurator.Configure(new FileInfo(configurationFile));
+            XmlConfigurator.Configure(LoggerManager.GetRepository(typeof(Log4netConfigurator).Assembly), new FileInfo(configurationFile));
         }
 
         [UsedImplicitly]

+ 4 - 3
src/Abc.Zebus.Tests/MessageIdTests.cs

@@ -3,7 +3,6 @@ using System.Collections.Concurrent;
 using System.Collections.Generic;
 using System.IO;
 using System.Linq;
-using System.Threading;
 using System.Threading.Tasks;
 using Abc.Zebus.Testing.Extensions;
 using Abc.Zebus.Testing.Measurements;
@@ -15,6 +14,7 @@ namespace Abc.Zebus.Tests
     [TestFixture]
     public class MessageIdTests
     {
+#if NETFWK
         [Test]
         public void should_not_generate_identical_MessageIds_when_multiple_buses_are_started_in_different_app_domains_simultaneously()
         {
@@ -43,6 +43,7 @@ namespace Abc.Zebus.Tests
             var newAppDomain = AppDomain.CreateDomain("MyAppDomain", null, appDomainInfo);
             return (MessageIdProxy)newAppDomain.CreateInstanceAndUnwrap(typeof(MessageIdProxy).Assembly.FullName, "Abc.Zebus.Tests.MessageIdTests+MessageIdProxy");
         }
+#endif
 
         [Test]
         public void should_generate_unique_ids()
@@ -124,7 +125,7 @@ namespace Abc.Zebus.Tests
             }
         }
 
-        [Test, Ignore("Manual test")]
+        [Test, Explicit("Manual test")]
         public void MesurePerformances()
         {
             Measure.Execution(x =>
@@ -149,4 +150,4 @@ namespace Abc.Zebus.Tests
             }
         }
     }
-}
+}

+ 2 - 2
src/Abc.Zebus.Tests/Program.cs

@@ -14,7 +14,7 @@ namespace Abc.Zebus.Tests
 {
     public static class Program
     {
-        public static void Main(string[] args)
+        public static void MainLol(string[] args)
         {
             new Log4netConfigurator().Setup();
 
@@ -195,4 +195,4 @@ namespace Abc.Zebus.Tests
             }
         }
     }
-}
+}

+ 1 - 1
src/Abc.Zebus.Tests/Routing/BindingKeyPredicateBuilderTests.cs

@@ -26,7 +26,7 @@ namespace Abc.Zebus.Tests.Routing
             predicate(expectedResult.Message).ShouldEqual(expectedResult.Result);
         }
 
-        public ExpectedResult[] TestSources { get; } = {
+        public static ExpectedResult[] TestSources { get; } = {
             new ExpectedResult(new FakeRoutableCommand(1, "toto"), new BindingKey("1", "toto", "*"), true),
             new ExpectedResult(new FakeRoutableCommand(1, "toto"), new BindingKey("*", "toto", "*"), true),
             new ExpectedResult(new FakeRoutableCommand(1, "toto"), new BindingKey("1", "*", "*"), true),

+ 1 - 1
src/Abc.Zebus.Tests/Routing/BindingKeyTests.cs

@@ -49,7 +49,7 @@ namespace Abc.Zebus.Tests.Routing
         }
 
         [Test]
-        [Ignore]
+        [Explicit]
         [Category("ManualOnly")]
         public void MeasurePerformances()
         {

+ 8 - 10
src/Abc.Zebus.Tests/Serialization/TestMessageSerializer.cs

@@ -2,7 +2,6 @@
 using System.Collections.Generic;
 using System.IO;
 using Abc.Zebus.Serialization;
-using Abc.Zebus.Util.Extensions;
 
 namespace Abc.Zebus.Tests.Serialization
 {
@@ -12,7 +11,8 @@ namespace Abc.Zebus.Tests.Serialization
         private readonly Dictionary<MessageTypeId, Func<IMessage, Stream>> _serializationFuncs = new Dictionary<MessageTypeId, Func<IMessage, Stream>>();
         private readonly MessageSerializer _serializer = new MessageSerializer();
 
-        public void AddSerializationFuncFor<TMessage>(Func<TMessage, Stream> func) where TMessage : IMessage
+        public void AddSerializationFuncFor<TMessage>(Func<TMessage, Stream> func)
+            where TMessage : IMessage
         {
             _serializationFuncs.Add(MessageUtil.TypeId<TMessage>(), msg => func((TMessage)msg));
         }
@@ -22,15 +22,15 @@ namespace Abc.Zebus.Tests.Serialization
             _serializationExceptions.Add(messageTypeId, new Exception(exceptionMessage));
         }
 
-        public void AddSerializationExceptionFor<TMessage>(Exception exception) where TMessage : IMessage
+        public void AddSerializationExceptionFor<TMessage>(Exception exception)
+            where TMessage : IMessage
         {
             _serializationExceptions.Add(MessageUtil.TypeId<TMessage>(), exception);
         }
 
         public IMessage Deserialize(MessageTypeId messageTypeId, Stream stream)
         {
-            var exception = _serializationExceptions.GetValueOrDefault(messageTypeId);
-            if (exception != null)
+            if (_serializationExceptions.TryGetValue(messageTypeId, out var exception))
                 throw exception;
 
             return _serializer.Deserialize(messageTypeId, stream);
@@ -38,15 +38,13 @@ namespace Abc.Zebus.Tests.Serialization
 
         public Stream Serialize(IMessage message)
         {
-            var exception = _serializationExceptions.GetValueOrDefault(message.TypeId());
-            if (exception != null)
+            if (_serializationExceptions.TryGetValue(message.TypeId(), out var exception))
                 throw exception;
 
-            var serializationFunc = _serializationFuncs.GetValueOrDefault(message.TypeId());
-            if (serializationFunc != null)
+            if (_serializationFuncs.TryGetValue(message.TypeId(), out var serializationFunc))
                 return serializationFunc.Invoke(message);
 
             return _serializer.Serialize(message);
         }
     }
-}
+}

+ 1 - 1
src/Abc.Zebus.Tests/SubscriptionTests.cs

@@ -234,7 +234,7 @@ namespace Abc.Zebus.Tests
         }
 
         [Test]
-        [Ignore]
+        [Explicit]
         [Category("ManualOnly")]
         [TestCase("a.b", "a.b.c.d")]
         [TestCase("d.*", "a.b.c.d")]

+ 1 - 1
src/Abc.Zebus.Tests/Transport/TransportMessageReaderTests.cs

@@ -96,7 +96,7 @@ namespace Abc.Zebus.Tests.Transport
             deserialized.WasPersisted.ShouldEqual(transportMessage.WasPersisted);
         }
 
-        [Test, Ignore("Manual test")]
+        [Test, Explicit("Manual test")]
         public void MeasureReadPerformance()
         {
             var transportMessage = TestDataBuilder.CreateTransportMessage<FakeCommand>();

+ 1 - 1
src/Abc.Zebus.Tests/Transport/TransportMessageWriterTests.cs

@@ -130,7 +130,7 @@ namespace Abc.Zebus.Tests.Transport
             deserialized2.WasPersisted.ShouldEqual(false);
         }
 
-        [Test, Ignore("Manual test")]
+        [Test, Explicit("Manual test")]
         public void MeasureWritePerformance()
         {
             var transportMessage = TestDataBuilder.CreateTransportMessage<FakeCommand>();

+ 1 - 1
src/Abc.Zebus.Tests/Transport/ZmqTests.cs

@@ -6,7 +6,7 @@ using ZeroMQ;
 namespace Abc.Zebus.Tests.Transport
 {
     [TestFixture]
-    [Ignore]
+    [Explicit]
     [Category("ManualOnly")]
     public class ZmqTests
     {

+ 1 - 1
src/Abc.Zebus.Tests/Transport/ZmqTransportPerformanceTests.cs

@@ -11,7 +11,7 @@ using NUnit.Framework;
 namespace Abc.Zebus.Tests.Transport
 {
     [TestFixture]
-    [Ignore]
+    [Explicit]
     [Category("ManualOnly")]
     public class ZmqTransportPerformanceTests
     {

+ 6 - 6
src/Abc.Zebus.Tests/Transport/ZmqTransportTests.cs

@@ -109,7 +109,7 @@ namespace Abc.Zebus.Tests.Transport
             transport2ReceivedMessages.Single().Id.ShouldEqual(message2.Id);
         }
 
-        [Test, Timeout(5000)]
+        [Test]
         public void should_send_messages()
         {
             var transport1ReceivedMessages = new ConcurrentBag<TransportMessage>();
@@ -218,7 +218,7 @@ namespace Abc.Zebus.Tests.Transport
             messageFromPersistence.PersistentPeerIds.ShouldBeEquivalentTo(new[] { receiverPeerId });
         }
 
-        [Test, Timeout(5000)]
+        [Test]
         public void should_write_WasPersisted_when_requested()
         {
             var sender = CreateAndStartZmqTransport();
@@ -237,7 +237,7 @@ namespace Abc.Zebus.Tests.Transport
             receivedMessages.Single(x => x.Id == otherMessage.Id).WasPersisted.ShouldEqual(false);
         }
 
-        [Test, Timeout(5000)]
+        [Test]
         public void should_send_message_to_both_persisted_and_non_persisted_peers()
         {
             var sender = CreateAndStartZmqTransport();
@@ -359,7 +359,7 @@ namespace Abc.Zebus.Tests.Transport
             }
         }
 
-        [Test, Timeout(5000)]
+        [Test]
         public void should_not_block_when_hitting_high_water_mark()
         {
             var senderTransport = CreateAndStartZmqTransport();
@@ -386,7 +386,7 @@ namespace Abc.Zebus.Tests.Transport
             }
         }
 
-        [Test, Timeout(5000)]
+        [Test]
         public void should_not_wait_blocked_peers_on_every_send()
         {
             var senderTransport = CreateAndStartZmqTransport();
@@ -615,4 +615,4 @@ namespace Abc.Zebus.Tests.Transport
             return transport;
         }
     }
-}
+}

+ 1 - 1
src/Abc.Zebus.Tests/Util/Collections/FlushableBlockingCollectionPerformanceTests.cs

@@ -10,7 +10,7 @@ using NUnit.Framework;
 
 namespace Abc.Zebus.Tests.Util.Collections
 {
-    [TestFixture, Ignore("Manual tests")]
+    [TestFixture, Explicit("Manual tests")]
     public class FlushableBlockingCollectionPerformanceTests
     {
         [Test]

+ 13 - 10
src/Abc.Zebus.Tests/Util/Collections/FlushableBlockingCollectionTests.cs

@@ -32,12 +32,13 @@ namespace Abc.Zebus.Tests.Util.Collections
             bc.CompleteAdding();
 
             consume.Wait();
-            var expectedItems = Enumerable.Range(0, 2000000).ToHashSet();
+            const int itemCount = 2000000;
 
-            consumedItems.Count.ShouldEqual(expectedItems.Count);
+            consumedItems.Count.ShouldEqual(itemCount);
             foreach (var item in consumedItems)
             {
-                expectedItems.Contains(item).ShouldBeTrue();
+                item.ShouldBeGreaterOrEqualThan(0);
+                item.ShouldBeLessThan(itemCount);
             }
         }
 
@@ -110,12 +111,13 @@ namespace Abc.Zebus.Tests.Util.Collections
             Console.WriteLine("{0} flushed items (#1)", flushedItems1.Count);
             Console.WriteLine("{0} flushed items (#2)", flushedItems2.Count);
 
-            var exectedItems = Enumerable.Range(0, writerItemCount * 3).ToHashSet();
+            const int expectedCount = writerItemCount * 3;
             var items = consumedItems.Concat(flushedItems1).Concat(flushedItems2).ToList();
-            items.Count.ShouldEqual(exectedItems.Count);
+            items.Count.ShouldEqual(expectedCount);
             foreach (var item in items)
             {
-                exectedItems.Contains(item).ShouldBeTrue();
+                item.ShouldBeGreaterOrEqualThan(0);
+                item.ShouldBeLessThan(expectedCount);
             }
         }
 
@@ -174,12 +176,13 @@ namespace Abc.Zebus.Tests.Util.Collections
             collection.CompleteAdding();
             consume.Wait();
 
-            var exectedItems = Enumerable.Range(0, 1500000).ToHashSet();
+            const int expectedCount = 1500000;
             var items = consumedItems.Concat(flushedItems1).Concat(flushedItems2).Concat(flushedItems3).ToList();
-            items.Count.ShouldEqual(exectedItems.Count);
+            items.Count.ShouldEqual(expectedCount);
             foreach (var item in items)
             {
-                exectedItems.Contains(item).ShouldBeTrue();
+                item.ShouldBeGreaterOrEqualThan(0);
+                item.ShouldBeLessThan(expectedCount);
             }
         }
 
@@ -233,4 +236,4 @@ namespace Abc.Zebus.Tests.Util.Collections
             consumedItems.Count.ShouldEqual(5000000);
         }
     }
-}
+}

+ 3 - 16
src/Abc.Zebus.Tests/Util/TypeUtilTests.cs

@@ -1,5 +1,4 @@
-using System.Reflection;
-using Abc.Zebus.Testing.Extensions;
+using Abc.Zebus.Testing.Extensions;
 using Abc.Zebus.Util;
 using NUnit.Framework;
 using NUnit.Framework.Constraints;
@@ -19,16 +18,7 @@ namespace Abc.Zebus.Tests.Util
         public void should_resolve_type_from_other_assemblies()
         {
             Assert.That(TypeUtil.Resolve(typeof(PrefixOperator).FullName), Is.EqualTo(typeof(PrefixOperator)));
-            Assert.That(TypeUtil.Resolve("System.Configuration.ConfigurationValidatorBase"), Is.Not.Null);
-        }
-
-        [Test]
-        public void should_resolve_type_from_exe_assembly()
-        {
-            // we have to ensure that the .exe is loaded in the current AppDomain
-            Assembly.LoadFile(PathUtil.InBaseDirectory("Abc.Zebus.Tests.TestExe.exe"));
-
-            Assert.That(TypeUtil.Resolve("Abc.Zebus.Tests.TestExe.Program"), Is.Not.Null);
+            Assert.That(TypeUtil.Resolve("System.String"), Is.Not.Null);
         }
 
         [Test]
@@ -62,17 +52,14 @@ namespace Abc.Zebus.Tests.Util
 
         public class NestedClass<T>
         {
-
         }
     }
 
     public class GenericClass<T, K>
     {
-
     }
 
     public class OtherClass
     {
-
     }
-}
+}

+ 2 - 7
src/Abc.Zebus.sln

@@ -14,15 +14,14 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "@ Solution Items", "@ Solut
 		..\build\Abc.Zebus.nuspec = ..\build\Abc.Zebus.nuspec
 		..\build\Abc.Zebus.Testing.nuspec = ..\build\Abc.Zebus.Testing.nuspec
 		..\build\build.cake = ..\build\build.cake
+		Directory.Build.props = Directory.Build.props
 		..\RELEASE_NOTES.md = ..\RELEASE_NOTES.md
 		SharedAssemblyInfo.cs = SharedAssemblyInfo.cs
 		SharedVersionInfo.cs = SharedVersionInfo.cs
 		..\version.yml = ..\version.yml
 	EndProjectSection
 EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Abc.Zebus.Tests.TestExe", "Abc.Zebus.Tests.TestExe\Abc.Zebus.Tests.TestExe.csproj", "{652017D8-EB34-4A79-B14F-DB0477E43915}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Abc.Zebus.Contracts", "Abc.Zebus.Contracts\Abc.Zebus.Contracts.csproj", "{507A4411-DB8A-4663-A491-CCA29854B890}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Abc.Zebus.Contracts", "Abc.Zebus.Contracts\Abc.Zebus.Contracts.csproj", "{507A4411-DB8A-4663-A491-CCA29854B890}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -42,10 +41,6 @@ Global
 		{4CE123DF-8021-411C-929B-53E5C5FC1E04}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{4CE123DF-8021-411C-929B-53E5C5FC1E04}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{4CE123DF-8021-411C-929B-53E5C5FC1E04}.Release|Any CPU.Build.0 = Release|Any CPU
-		{652017D8-EB34-4A79-B14F-DB0477E43915}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{652017D8-EB34-4A79-B14F-DB0477E43915}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{652017D8-EB34-4A79-B14F-DB0477E43915}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{652017D8-EB34-4A79-B14F-DB0477E43915}.Release|Any CPU.Build.0 = Release|Any CPU
 		{507A4411-DB8A-4663-A491-CCA29854B890}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{507A4411-DB8A-4663-A491-CCA29854B890}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{507A4411-DB8A-4663-A491-CCA29854B890}.Release|Any CPU.ActiveCfg = Release|Any CPU

+ 0 - 14
src/Abc.Zebus/Abc.Zebus.csproj

@@ -9,20 +9,6 @@
     <LangVersion>latest</LangVersion>
   </PropertyGroup>
 
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Debug\</OutputPath>
-    <DefineConstants>DEBUG;TRACE</DefineConstants>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>pdbonly</DebugType>
-    <Optimize>true</Optimize>
-    <OutputPath>bin\Release\</OutputPath>
-    <DefineConstants>TRACE</DefineConstants>
-  </PropertyGroup>
-
   <ItemGroup>
     <ProjectReference Include="..\Abc.Zebus.Contracts\Abc.Zebus.Contracts.csproj" />
   </ItemGroup>

+ 8 - 11
src/Abc.Zebus/Util/Extensions/ExtendDictionary.cs

@@ -14,20 +14,20 @@ namespace Abc.Zebus.Util.Extensions
 
         public static TValue GetValueOrAdd<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, Func<TKey, TValue> valueBuilder)
         {
-            TValue value;
-            if (!dictionary.TryGetValue(key, out value))
+            if (!dictionary.TryGetValue(key, out var value))
             {
                 value = valueBuilder(key);
                 dictionary.Add(key, value);
             }
+
             return value;
         }
 
         [Pure]
-        public static TValue? GetValueOrNull<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key) where TValue : struct
+        public static TValue? GetValueOrNull<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key)
+            where TValue : struct
         {
-            TValue value;
-            return dictionary.TryGetValue(key, out value) ? value : (TValue?)null;
+            return dictionary.TryGetValue(key, out var value) ? value : (TValue?)null;
         }
 
         [Pure]
@@ -39,20 +39,17 @@ namespace Abc.Zebus.Util.Extensions
         [Pure]
         public static TValue GetValueOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, TValue defaultValue)
         {
-            TValue value;
-            return dictionary.TryGetValue(key, out value) ? value : defaultValue;
+            return dictionary.TryGetValue(key, out var value) ? value : defaultValue;
         }
 
         public static TValue GetValueOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, [InstantHandle] Func<TKey, TValue> defaultValueBuilder)
         {
-            TValue value;
-            return dictionary.TryGetValue(key, out value) ? value : defaultValueBuilder(key);
+            return dictionary.TryGetValue(key, out var value) ? value : defaultValueBuilder(key);
         }
 
         public static bool Remove<TKey, TValue>(this ConcurrentDictionary<TKey, TValue> dictionary, TKey key)
         {
-            TValue value;
-            return dictionary.TryRemove(key, out value);
+            return dictionary.TryRemove(key, out _);
         }
 
         public static bool TryRemove<TKey, TValue>(this ConcurrentDictionary<TKey, TValue> dictionary, TKey key, TValue comparisonValue)

+ 4 - 2
src/Abc.Zebus/Util/Extensions/ExtendIEnumerable.cs

@@ -7,6 +7,7 @@ namespace Abc.Zebus.Util.Extensions
 {
     internal static class ExtendIEnumerable
     {
+#if !NETFWK
         [Pure]
         public static HashSet<T> ToHashSet<T>([InstantHandle] this IEnumerable<T> collection)
         {
@@ -18,6 +19,7 @@ namespace Abc.Zebus.Util.Extensions
         {
             return new HashSet<T>(collection, comparer);
         }
+#endif
 
         [Pure]
         public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> source)
@@ -34,7 +36,7 @@ namespace Abc.Zebus.Util.Extensions
         }
 
         [Pure]
-        public static IList<T> AsList<T>([InstantHandle] this IEnumerable<T> collection) 
+        public static IList<T> AsList<T>([InstantHandle] this IEnumerable<T> collection)
             => collection is IList<T> list ? list : collection.ToList();
 
         [Pure]
@@ -45,7 +47,7 @@ namespace Abc.Zebus.Util.Extensions
         }
 
         /// <summary>
-        /// Performs the specified <see cref="Action{T}"/> against every element of <see cref="IEnumerable{T}"/>
+        /// Performs the specified <see cref="Action{T}" /> against every element of <see cref="IEnumerable{T}" />
         /// </summary>
         /// <typeparam name="T"></typeparam>
         /// <param name="enumerable">Enumerable to extend</param>

+ 12 - 0
src/Directory.Build.props

@@ -0,0 +1,12 @@
+<Project>
+
+  <PropertyGroup>
+    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
+    <LangVersion>latest</LangVersion>
+  </PropertyGroup>
+
+  <PropertyGroup>
+    <DefineConstants Condition="'$(TargetFramework)' == 'net471'
+                     or '$(TargetFramework)' == 'net461'">$(DefineConstants);NETFWK</DefineConstants>
+  </PropertyGroup>
+</Project>