From d6887a70f1f5127ff83488f3b38ede1417d64585 Mon Sep 17 00:00:00 2001 From: "Andres G. Aragoneses" Date: Fri, 4 Nov 2016 00:10:14 +0800 Subject: [PATCH] Tests: add NUnit support What's an open source project that cannot be tested in an open source platform? The best open source .NET IDE that works in Linux (MonoDevelop) doesn't have support for VisualStudio Testing framework, but it has support for NUnit. By abstracting a bit the TLSharp.Tests assembly we can have two different wrappers, one for NUnit tests and other for VisualStudio tests, so no one can be left behind. --- .../TLSharp.Tests.NUnit.csproj | 54 +++++++++ TLSharp.Tests.NUnit/Test.cs | 72 ++++++++++++ TLSharp.Tests.NUnit/packages.config | 4 + TLSharp.Tests.VS/Properties/AssemblyInfo.cs | 36 ++++++ TLSharp.Tests.VS/TLSharp.Tests.VS.csproj | 103 ++++++++++++++++++ TLSharp.Tests.VS/TLSharpTestsVs.cs | 71 ++++++++++++ TLSharp.Tests/TLSharp.Tests.csproj | 42 +------ TLSharp.Tests/TLSharpTests.cs | 53 +++++---- TLSharp.sln | 12 ++ 9 files changed, 384 insertions(+), 63 deletions(-) create mode 100644 TLSharp.Tests.NUnit/TLSharp.Tests.NUnit.csproj create mode 100644 TLSharp.Tests.NUnit/Test.cs create mode 100644 TLSharp.Tests.NUnit/packages.config create mode 100644 TLSharp.Tests.VS/Properties/AssemblyInfo.cs create mode 100644 TLSharp.Tests.VS/TLSharp.Tests.VS.csproj create mode 100644 TLSharp.Tests.VS/TLSharpTestsVs.cs diff --git a/TLSharp.Tests.NUnit/TLSharp.Tests.NUnit.csproj b/TLSharp.Tests.NUnit/TLSharp.Tests.NUnit.csproj new file mode 100644 index 0000000..e947f4e --- /dev/null +++ b/TLSharp.Tests.NUnit/TLSharp.Tests.NUnit.csproj @@ -0,0 +1,54 @@ + + + + Debug + AnyCPU + {E90B705B-19FA-43BA-B952-69957976D12C} + Library + TLSharp.Tests.NUnit + TLSharp.Tests.NUnit + v4.5 + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + false + + + full + true + bin\Release + prompt + 4 + false + + + + + ..\packages\NUnit.2.6.4\lib\nunit.framework.dll + + + + + + + + app.config + + + + + + + + + {DE5C0467-EE99-4734-95F2-EFF7A0B99924} + TLSharp.Tests + + + diff --git a/TLSharp.Tests.NUnit/Test.cs b/TLSharp.Tests.NUnit/Test.cs new file mode 100644 index 0000000..bf06d64 --- /dev/null +++ b/TLSharp.Tests.NUnit/Test.cs @@ -0,0 +1,72 @@ + +using System; +using System.Threading.Tasks; + +using NUnit.Framework; + +namespace TLSharp.Tests +{ + [TestFixture] + public class TLSharpTestsNUnit : TLSharpTests + { + [TestFixtureSetUp] + public void Init() + { + base.Init(o => Assert.IsNotNull(o), b => Assert.IsTrue(b)); + } + + [Test] + public async override Task AuthUser() + { + await base.AuthUser(); + } + + [Test] + public override async Task SendMessageTest() + { + await base.SendMessageTest(); + } + + [Test] + public override async Task SendMessageToChannelTest() + { + await base.SendMessageToChannelTest(); + } + + [Test] + public override async Task SendPhotoToContactTest() + { + await base.SendPhotoToContactTest(); + } + + [Test] + public override async Task SendBigFileToContactTest() + { + await base.SendBigFileToContactTest(); + } + + [Test] + public override async Task DownloadFileFromContactTest() + { + await base.DownloadFileFromContactTest(); + } + + [Test] + public override async Task DownloadFileFromWrongLocationTest() + { + await base.DownloadFileFromWrongLocationTest(); + } + + [Test] + public override async Task SignUpNewUser() + { + await base.SignUpNewUser(); + } + + [Test] + public override async Task CheckPhones() + { + await base.CheckPhones(); + } + } +} diff --git a/TLSharp.Tests.NUnit/packages.config b/TLSharp.Tests.NUnit/packages.config new file mode 100644 index 0000000..c714ef3 --- /dev/null +++ b/TLSharp.Tests.NUnit/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/TLSharp.Tests.VS/Properties/AssemblyInfo.cs b/TLSharp.Tests.VS/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..2eef1f8 --- /dev/null +++ b/TLSharp.Tests.VS/Properties/AssemblyInfo.cs @@ -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("TLSharp.Tests.VS")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("TLSharp.Tests.VS")] +[assembly: AssemblyCopyright("Copyright © 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("affc3b00-3e4d-4327-8f7a-08ee41e0c8b7")] + +// 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")] diff --git a/TLSharp.Tests.VS/TLSharp.Tests.VS.csproj b/TLSharp.Tests.VS/TLSharp.Tests.VS.csproj new file mode 100644 index 0000000..a44fff4 --- /dev/null +++ b/TLSharp.Tests.VS/TLSharp.Tests.VS.csproj @@ -0,0 +1,103 @@ + + + + Debug + AnyCPU + {AFFC3B00-3E4D-4327-8F7A-08EE41E0C8B7} + Library + Properties + TLSharp.Tests.VS + TLSharp.Tests.VS + v4.5 + 512 + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 10.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages + False + UnitTest + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + {d6144517-91d2-4880-86df-e9ff5d7f383a} + TeleSharp.TL + + + {400d2544-1cc6-4d8a-a62c-2292d9947a16} + TLSharp.Core + + + {de5c0467-ee99-4734-95f2-eff7a0b99924} + TLSharp.Tests + + + + + app.config + + + + + + + + False + + + False + + + False + + + False + + + + + + + + \ No newline at end of file diff --git a/TLSharp.Tests.VS/TLSharpTestsVs.cs b/TLSharp.Tests.VS/TLSharpTestsVs.cs new file mode 100644 index 0000000..8167f91 --- /dev/null +++ b/TLSharp.Tests.VS/TLSharpTestsVs.cs @@ -0,0 +1,71 @@ + +using System.Threading.Tasks; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace TLSharp.Tests +{ + [TestClass] + public class TLSharpTestsVS : TLSharpTests + { + [TestInitialize] + public void Init() + { + base.Init(o => Assert.IsNotNull(o), b => Assert.IsTrue(b)); + } + + [TestMethod] + public override async Task AuthUser() + { + await base.AuthUser(); + } + + [TestMethod] + public override async Task SendMessageTest() + { + await base.SendMessageTest(); + } + + [TestMethod] + public override async Task SendMessageToChannelTest() + { + await base.SendMessageToChannelTest(); + } + + [TestMethod] + public override async Task SendPhotoToContactTest() + { + await base.SendPhotoToContactTest(); + } + + [TestMethod] + public override async Task SendBigFileToContactTest() + { + await base.SendBigFileToContactTest(); + } + + [TestMethod] + public override async Task DownloadFileFromContactTest() + { + await base.DownloadFileFromContactTest(); + } + + [TestMethod] + public override async Task DownloadFileFromWrongLocationTest() + { + await base.DownloadFileFromWrongLocationTest(); + } + + [TestMethod] + public override async Task SignUpNewUser() + { + await base.SignUpNewUser(); + } + + [TestMethod] + public override async Task CheckPhones() + { + await base.CheckPhones(); + } + } +} diff --git a/TLSharp.Tests/TLSharp.Tests.csproj b/TLSharp.Tests/TLSharp.Tests.csproj index f215a0c..e2277f1 100644 --- a/TLSharp.Tests/TLSharp.Tests.csproj +++ b/TLSharp.Tests/TLSharp.Tests.csproj @@ -1,5 +1,6 @@ - + + Debug AnyCPU @@ -8,14 +9,8 @@ Properties TLSharp.Tests TLSharp.Tests - v4.5.2 + v4.5 512 - {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 10.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages - False - UnitTest true @@ -38,18 +33,6 @@ - - - - - - - - - - - - @@ -73,25 +56,6 @@ Always - - - - - False - - - False - - - False - - - False - - - - -