Skip to content

Commit

Permalink
migrate tests to NUnit
Browse files Browse the repository at this point in the history
  • Loading branch information
antonmes committed Feb 20, 2016
1 parent b897526 commit acdec2a
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 107 deletions.
137 changes: 48 additions & 89 deletions MPack.Tests/MPack.Tests.csproj
@@ -1,90 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{6C2C8FC6-420E-4606-84F4-945C8EC67D24}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CS.MPackTests</RootNamespace>
<AssemblyName>MPack.Tests</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
</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" />
</ItemGroup>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
</ItemGroup>
</Otherwise>
</Choose>
<ItemGroup>
<Compile Include="Helpers.cs" />
<Compile Include="Tests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MPack\MPack.csproj">
<Project>{80b67925-ac57-46b2-bc37-1ebc0b5c521b}</Project>
<Name>MPack</Name>
</ProjectReference>
</ItemGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
</ItemGroup>
</When>
</Choose>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- 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>
-->
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{6F1DCA9F-6645-437B-8B83-A279CFC0DA81}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>CS.MPackTests</RootNamespace>
<AssemblyName>CS.MPackTests</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="nunit.framework">
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Tests.cs" />
<Compile Include="Helpers.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MPack\MPack.csproj">
<Project>{80B67925-AC57-46B2-BC37-1EBC0B5C521B}</Project>
<Name>MPack</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
24 changes: 12 additions & 12 deletions MPack.Tests/Tests.cs
@@ -1,13 +1,13 @@
using System;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NUnit.Framework;

namespace CS.MPackTests
{
[TestClass]
[TestFixture()]
public class Tests
{
[TestMethod]
[Test()]
public void TestDouble()
{
var tests = new[]
Expand All @@ -31,12 +31,12 @@ public void TestDouble()
}
}

[TestMethod]
[Test()]
public void TestNull()
{
Assert.AreEqual(null, MPack.ParseFromBytes(MPack.Null().EncodeToBytes()).To<object>());
}
[TestMethod]
[Test()]
public void TestString()
{
var tests = new string[]
Expand All @@ -53,7 +53,7 @@ public void TestString()
Assert.AreEqual(value, MPack.ParseFromBytes(MPack.From(value).EncodeToBytes()).To<string>());
}
}
[TestMethod]
[Test()]
public void TestInteger()
{
var tests = new[]
Expand All @@ -76,7 +76,7 @@ public void TestInteger()
Assert.AreEqual(value, MPack.ParseFromBytes(MPack.From(value).EncodeToBytes()).To<long>());
}
}
[TestMethod]
[Test()]
public void TestMap()
{
MPackMap dictionary = new MPackMap
Expand All @@ -100,7 +100,7 @@ public void TestMap()
var result = MPack.ParseFromBytes(bytes) as MPackMap;
Assert.AreEqual(dictionary, result);
}
[TestMethod]
[Test()]
public void TestArray()
{
var tests = new[]
Expand Down Expand Up @@ -128,7 +128,7 @@ public void TestArray()
}
Assert.AreEqual(arr, round);
}
[TestMethod]
[Test()]
public void TestUInt64()
{
var tests = new[]
Expand All @@ -141,15 +141,15 @@ public void TestUInt64()
Assert.AreEqual(value, MPack.ParseFromBytes(MPack.From(value).EncodeToBytes()).To<ulong>());
}
}
[TestMethod]
[Test()]
public void TestBoolean()
{
var tru = MPack.ParseFromBytes(MPack.From(true).EncodeToBytes()).To<bool>();
var fal = MPack.ParseFromBytes(MPack.From(false).EncodeToBytes()).To<bool>();
Assert.IsTrue(tru);
Assert.IsFalse(fal);
}
[TestMethod]
[Test()]
public void TestSingle()
{
var tests = new[]
Expand All @@ -168,7 +168,7 @@ public void TestSingle()
Assert.AreEqual(value, MPack.ParseFromBytes(MPack.From(value).EncodeToBytes()).To<float>());
}
}
[TestMethod]
[Test()]
public void TestBinary()
{
var tests = new[]
Expand Down
4 changes: 4 additions & 0 deletions MPack.Tests/packages.config
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NUnit" version="2.6.4" targetFramework="net45" />
</packages>
12 changes: 6 additions & 6 deletions MPack.sln
Expand Up @@ -5,14 +5,14 @@ VisualStudioVersion = 14.0.24627.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MPack", "MPack\MPack.csproj", "{80B67925-AC57-46B2-BC37-1EBC0B5C521B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MPack.Tests", "MPack.Tests\MPack.Tests.csproj", "{6C2C8FC6-420E-4606-84F4-945C8EC67D24}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{872176B1-8480-4F8C-86E1-B3B56F62C99C}"
ProjectSection(SolutionItems) = preProject
LICENSE.txt = LICENSE.txt
README.md = README.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MPack.Tests", "MPack.Tests\MPack.Tests.csproj", "{6F1DCA9F-6645-437B-8B83-A279CFC0DA81}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -23,10 +23,10 @@ Global
{80B67925-AC57-46B2-BC37-1EBC0B5C521B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{80B67925-AC57-46B2-BC37-1EBC0B5C521B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{80B67925-AC57-46B2-BC37-1EBC0B5C521B}.Release|Any CPU.Build.0 = Release|Any CPU
{6C2C8FC6-420E-4606-84F4-945C8EC67D24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6C2C8FC6-420E-4606-84F4-945C8EC67D24}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6C2C8FC6-420E-4606-84F4-945C8EC67D24}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6C2C8FC6-420E-4606-84F4-945C8EC67D24}.Release|Any CPU.Build.0 = Release|Any CPU
{6F1DCA9F-6645-437B-8B83-A279CFC0DA81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6F1DCA9F-6645-437B-8B83-A279CFC0DA81}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6F1DCA9F-6645-437B-8B83-A279CFC0DA81}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6F1DCA9F-6645-437B-8B83-A279CFC0DA81}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down

0 comments on commit acdec2a

Please sign in to comment.