moved to nunit

This commit is contained in:
Holger Boerchers 2018-06-03 23:14:33 +02:00
parent 26343921f7
commit 3aebff4e6d
4 changed files with 27 additions and 23 deletions

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Vestris.ResourceLib" version="1.6.422" targetFramework="net45" /> <package id="Vestris.ResourceLib" version="1.6.422" targetFramework="net462" />
</packages> </packages>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\MSTest.TestAdapter.1.3.0\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.1.3.0\build\net45\MSTest.TestAdapter.props')" /> <Import Project="..\packages\NUnit3TestAdapter.3.10.0\build\net35\NUnit3TestAdapter.props" Condition="Exists('..\packages\NUnit3TestAdapter.3.10.0\build\net35\NUnit3TestAdapter.props')" />
<Import Project="..\packages\NUnit.3.10.1\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.10.1\build\NUnit.props')" />
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@ -38,11 +39,8 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <Reference Include="nunit.framework, Version=3.10.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.1.3.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath> <HintPath>..\packages\NUnit.3.10.1\lib\net45\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.1.3.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
@ -69,10 +67,9 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup> <PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> <ErrorText>Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}".</ErrorText>
</PropertyGroup> </PropertyGroup>
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.3.0\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.3.0\build\net45\MSTest.TestAdapter.props'))" /> <Error Condition="!Exists('..\packages\NUnit.3.10.1\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.10.1\build\NUnit.props'))" />
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.3.0\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.3.0\build\net45\MSTest.TestAdapter.targets'))" /> <Error Condition="!Exists('..\packages\NUnit3TestAdapter.3.10.0\build\net35\NUnit3TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit3TestAdapter.3.10.0\build\net35\NUnit3TestAdapter.props'))" />
</Target> </Target>
<Import Project="..\packages\MSTest.TestAdapter.1.3.0\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.1.3.0\build\net45\MSTest.TestAdapter.targets')" />
</Project> </Project>

View File

@ -1,17 +1,17 @@
using System; using System;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using Microsoft.VisualStudio.TestTools.UnitTesting; using NUnit.Framework;
namespace Katteker.Test namespace Katteker.Test
{ {
[TestClass] [TestFixture]
public class KattekerLibTest public class KattekerLibTest
{ {
private static readonly string BaseDir = AppDomain.CurrentDomain.BaseDirectory; private static readonly string BaseDir = AppDomain.CurrentDomain.BaseDirectory;
private static readonly string ExampleFile = Path.Combine(BaseDir, "testdata", "Example.exe"); private static readonly string ExampleFile = Path.Combine(BaseDir, "testdata", "Example.exe");
[TestMethod] [Test]
public void Sha1ChecksumOfFile() public void Sha1ChecksumOfFile()
{ {
var actual = Utility.ComputeFileHash(ExampleFile); var actual = Utility.ComputeFileHash(ExampleFile);
@ -19,7 +19,7 @@ namespace Katteker.Test
Assert.AreEqual(expected, actual); Assert.AreEqual(expected, actual);
} }
[TestMethod] [Test]
public void CheckIfStringIsWebUrl() public void CheckIfStringIsWebUrl()
{ {
const string test1 = "http://TolleUrl.de/Test"; const string test1 = "http://TolleUrl.de/Test";
@ -27,13 +27,13 @@ namespace Katteker.Test
const string test3 = "C:\\Test"; const string test3 = "C:\\Test";
const string test4 = "furz"; const string test4 = "furz";
Assert.IsTrue(Utility.IsWebUrl(test1)); Assert.True(Utility.IsWebUrl(test1));
Assert.IsTrue(Utility.IsWebUrl(test2)); Assert.True(Utility.IsWebUrl(test2));
Assert.IsFalse(Utility.IsWebUrl(test3)); Assert.False(Utility.IsWebUrl(test3));
Assert.ThrowsException<UriFormatException>(() => Utility.IsWebUrl(test4)); Assert.Throws<UriFormatException>(() => Utility.IsWebUrl(test4));
} }
[TestMethod] [Test]
public void CheckRightAssemblyName() public void CheckRightAssemblyName()
{ {
const string expected = "Example"; const string expected = "Example";
@ -41,12 +41,19 @@ namespace Katteker.Test
Assert.AreEqual(expected, actual); Assert.AreEqual(expected, actual);
} }
[TestMethod] [Test]
public void CheckAssemblyVersionStuff() public void CheckAssemblyVersionStuff()
{ {
var expected = new Semver.SemVersion(1, 0, 53); var expected = new Semver.SemVersion(1, 0, 53);
var actual = VersionUtils.GetCurrentVersion(Assembly.LoadFile(ExampleFile)); var actual = VersionUtils.GetCurrentVersion(Assembly.LoadFile(ExampleFile));
Assert.AreEqual(expected, actual); Assert.AreEqual(expected, actual);
} }
[Test]
public void TestGetLocalAppDataDirectory()
{
var expected = Utility.GetLocalAppDataDirectory();
Assert.IsTrue(expected.Contains("AppData\\Local"));
}
} }
} }

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="MSTest.TestAdapter" version="1.3.0" targetFramework="net461" /> <package id="NUnit" version="3.10.1" targetFramework="net461" />
<package id="MSTest.TestFramework" version="1.3.0" targetFramework="net461" /> <package id="NUnit3TestAdapter" version="3.10.0" targetFramework="net461" />
</packages> </packages>