From 737d36fc76651523edeb12791dae774ae8bd4e49 Mon Sep 17 00:00:00 2001 From: Frederik Carlier Date: Tue, 18 Apr 2017 18:40:39 +0200 Subject: [PATCH] Move unit tests to .NET Core --- SharpAdbClient.Tests/ExceptionTester.cs | 2 +- .../Exceptions/AdbExceptionTests.cs | 2 +- .../CommandAbortingExceptionTests.cs | 2 +- .../Exceptions/DeviceNotFoundException.cs | 2 +- .../PermissionDeniedExceptionTests.cs | 2 +- .../ShellCommandUnresponsiveExceptionTests.cs | 2 +- .../Exceptions/UnknownOptionExceptionTests.cs | 2 +- .../Properties/AssemblyInfo.cs | 10 +- .../SharpAdbClient.Tests.csproj | 172 ------------------ SharpAdbClient.Tests/TcpSocketTests.cs | 14 +- appveyor.yml | 6 + 11 files changed, 17 insertions(+), 199 deletions(-) delete mode 100644 SharpAdbClient.Tests/SharpAdbClient.Tests.csproj diff --git a/SharpAdbClient.Tests/ExceptionTester.cs b/SharpAdbClient.Tests/ExceptionTester.cs index c6d5f28e..4e8dfec3 100644 --- a/SharpAdbClient.Tests/ExceptionTester.cs +++ b/SharpAdbClient.Tests/ExceptionTester.cs @@ -35,7 +35,7 @@ public static void TestMessageAndInnerConstructor(Func con Assert.AreEqual(inner, ex.InnerException); } -#if !NETCOREAPP1_0 +#if !NETCOREAPP1_1 public static void TestSerializationConstructor(Func constructor) { var info = new SerializationInfo(typeof(T), new FormatterConverter()); diff --git a/SharpAdbClient.Tests/Exceptions/AdbExceptionTests.cs b/SharpAdbClient.Tests/Exceptions/AdbExceptionTests.cs index ce5d80bd..c03ccb62 100644 --- a/SharpAdbClient.Tests/Exceptions/AdbExceptionTests.cs +++ b/SharpAdbClient.Tests/Exceptions/AdbExceptionTests.cs @@ -24,7 +24,7 @@ public void TestMessageAndInnerConstructor() ExceptionTester.TestMessageAndInnerConstructor((message, inner) => new AdbException(message, inner)); } -#if !NETCOREAPP1_0 +#if !NETCOREAPP1_1 [TestMethod] public void TestSerializationConstructor() { diff --git a/SharpAdbClient.Tests/Exceptions/CommandAbortingExceptionTests.cs b/SharpAdbClient.Tests/Exceptions/CommandAbortingExceptionTests.cs index 673905d8..e60cd58d 100644 --- a/SharpAdbClient.Tests/Exceptions/CommandAbortingExceptionTests.cs +++ b/SharpAdbClient.Tests/Exceptions/CommandAbortingExceptionTests.cs @@ -24,7 +24,7 @@ public void TestMessageAndInnerConstructor() ExceptionTester.TestMessageAndInnerConstructor((message, inner) => new CommandAbortingException(message, inner)); } -#if !NETCOREAPP1_0 +#if !NETCOREAPP1_1 [TestMethod] public void TestSerializationConstructor() { diff --git a/SharpAdbClient.Tests/Exceptions/DeviceNotFoundException.cs b/SharpAdbClient.Tests/Exceptions/DeviceNotFoundException.cs index 07bb1206..862c22b5 100644 --- a/SharpAdbClient.Tests/Exceptions/DeviceNotFoundException.cs +++ b/SharpAdbClient.Tests/Exceptions/DeviceNotFoundException.cs @@ -18,7 +18,7 @@ public void TestMessageAndInnerConstructor() ExceptionTester.TestMessageAndInnerConstructor((message, inner) => new DeviceNotFoundException(message, inner)); } -#if !NETCOREAPP1_0 +#if !NETCOREAPP1_1 [TestMethod] public void TestSerializationConstructor() { diff --git a/SharpAdbClient.Tests/Exceptions/PermissionDeniedExceptionTests.cs b/SharpAdbClient.Tests/Exceptions/PermissionDeniedExceptionTests.cs index 9f408e9f..d5a1ff01 100644 --- a/SharpAdbClient.Tests/Exceptions/PermissionDeniedExceptionTests.cs +++ b/SharpAdbClient.Tests/Exceptions/PermissionDeniedExceptionTests.cs @@ -24,7 +24,7 @@ public void TestMessageAndInnerConstructor() ExceptionTester.TestMessageAndInnerConstructor((message, inner) => new PermissionDeniedException(message, inner)); } -#if !NETCOREAPP1_0 +#if !NETCOREAPP1_1 [TestMethod] public void TestSerializationConstructor() { diff --git a/SharpAdbClient.Tests/Exceptions/ShellCommandUnresponsiveExceptionTests.cs b/SharpAdbClient.Tests/Exceptions/ShellCommandUnresponsiveExceptionTests.cs index 6c578b42..d3a06440 100644 --- a/SharpAdbClient.Tests/Exceptions/ShellCommandUnresponsiveExceptionTests.cs +++ b/SharpAdbClient.Tests/Exceptions/ShellCommandUnresponsiveExceptionTests.cs @@ -25,7 +25,7 @@ public void TestMessageAndInnerConstructor() ExceptionTester.TestMessageAndInnerConstructor((message, inner) => new ShellCommandUnresponsiveException(message, inner)); } -#if !NETCOREAPP1_0 +#if !NETCOREAPP1_1 [TestMethod] public void TestSerializationConstructor() { diff --git a/SharpAdbClient.Tests/Exceptions/UnknownOptionExceptionTests.cs b/SharpAdbClient.Tests/Exceptions/UnknownOptionExceptionTests.cs index 98e2cc54..f2019b2d 100644 --- a/SharpAdbClient.Tests/Exceptions/UnknownOptionExceptionTests.cs +++ b/SharpAdbClient.Tests/Exceptions/UnknownOptionExceptionTests.cs @@ -24,7 +24,7 @@ public void TestMessageAndInnerConstructor() ExceptionTester.TestMessageAndInnerConstructor((message, inner) => new UnknownOptionException(message, inner)); } -#if !NETCOREAPP1_0 +#if !NETCOREAPP1_1 [TestMethod] public void TestSerializationConstructor() { diff --git a/SharpAdbClient.Tests/Properties/AssemblyInfo.cs b/SharpAdbClient.Tests/Properties/AssemblyInfo.cs index 705f89c8..f2f096df 100644 --- a/SharpAdbClient.Tests/Properties/AssemblyInfo.cs +++ b/SharpAdbClient.Tests/Properties/AssemblyInfo.cs @@ -1,9 +1,3 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; -[assembly: AssemblyTitle ( "MADB Tests" )] -[assembly: AssemblyDescription ( "" )] - - -[assembly: Guid ( "4300994a-cbc1-43b0-bf87-119cd4cf71a3" )] \ No newline at end of file +[assembly: Guid("4300994a-cbc1-43b0-bf87-119cd4cf71a3")] \ No newline at end of file diff --git a/SharpAdbClient.Tests/SharpAdbClient.Tests.csproj b/SharpAdbClient.Tests/SharpAdbClient.Tests.csproj deleted file mode 100644 index a63f5c47..00000000 --- a/SharpAdbClient.Tests/SharpAdbClient.Tests.csproj +++ /dev/null @@ -1,172 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {2C43B828-BE5E-47B6-93BB-A624B6B36633} - Library - Properties - SharpAdbClient.Tests - SharpAdbClient.Tests - v4.5.1 - 512 - - - - - - - - - - - ..\ - true - - - true - - - SharpAdbClient.snk - - - true - bin\Debug\ - DEBUG;TRACE - full - AnyCPU - prompt - MinimumRecommendedRules.ruleset - false - - - bin\Release\ - TRACE - true - pdbonly - AnyCPU - prompt - MinimumRecommendedRules.ruleset - false - - - - - ..\packages\Moq.4.2.1510.2205\lib\net40\Moq.dll - True - - - - - - - - - - - - Properties\SharedAssemblyInfo.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - - - - - - {65473257-E70F-410B-9269-D0C0F771EA87} - Managed.Adb - - - - - - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - - - \ No newline at end of file diff --git a/SharpAdbClient.Tests/TcpSocketTests.cs b/SharpAdbClient.Tests/TcpSocketTests.cs index ae82b9f7..bc9a93ab 100644 --- a/SharpAdbClient.Tests/TcpSocketTests.cs +++ b/SharpAdbClient.Tests/TcpSocketTests.cs @@ -58,22 +58,12 @@ public void BufferSizeTest() socket.Dispose(); } - [TestMethod] - public void CreateSocketTest() - { - var winSocket = TcpSocket.CreateSocket(new IPEndPoint(IPAddress.Loopback, 0)); - Assert.AreEqual(AddressFamily.InterNetwork, winSocket.AddressFamily); - Assert.AreEqual(SocketType.Stream, winSocket.SocketType); - Assert.AreEqual(ProtocolType.Tcp, winSocket.ProtocolType); - - // Unix sockets cannot be created on Windows machines - } - [TestMethod] [ExpectedException(typeof(NotSupportedException))] public void CreateUnsupportedSocketTest() { - TcpSocket.CreateSocket(new CustomEndPoint()); + TcpSocket socket = new TcpSocket(); + socket.Connect(new CustomEndPoint()); } } } diff --git a/appveyor.yml b/appveyor.yml index 3cdc086b..1a91583b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -18,6 +18,12 @@ build_script: - cmd: dotnet build -c Release --version-suffix beta%APPVEYOR_BUILD_NUMBER% - cmd: dotnet pack -c Release --version-suffix beta%APPVEYOR_BUILD_NUMBER% +test_script: + - cmd: cd ..\SharpAdbClient.Tests\ + - cmd: dotnet restore + - cmd: dotnet build + - cmd: dotnet vstest bin\Debug\netcoreapp1.1\SharpAdbClient.Tests.dll /testcasefilter:TestCategory!=IntegrationTest /logger:Appveyor + on_success: - ps: Push-AppveyorArtifact "bin\Release\SharpAdbClient.2.1.0-beta$($env:APPVEYOR_BUILD_NUMBER).nupkg" - ps: Push-AppveyorArtifact "bin\Release\SharpAdbClient.2.1.0-beta$($env:APPVEYOR_BUILD_NUMBER).symbols.nupkg"