Permalink
Browse files

Moved tests to NUnit (instead of MS Test), so the tests can run in ot…

…her IDE's as well (such as JetBrains Rider).
  • Loading branch information...
aahoogendoorn committed Oct 10, 2016
1 parent c1eba73 commit 9cf0e38a494b663d6ab2c761ad2478ecc43bcfc7
@@ -35,6 +35,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="nunit.framework, Version=3.5.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb">
<HintPath>..\packages\NUnit.3.5.0\lib\net45\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
</ItemGroup>
<Choose>
@@ -43,11 +46,7 @@
<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>
<Otherwise />
</Choose>
<ItemGroup>
<Compile Include="Employee.cs" />
@@ -61,6 +60,9 @@
<Name>Monads</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="packages.config" />
</ItemGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
<ItemGroup>
@@ -1,14 +1,14 @@
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NUnit.Framework;

namespace Monads.Test
{
[TestClass]
[TestFixture]
public class TryTest
{
private readonly EmployeeRepository repo = new EmployeeRepository();

[TestMethod]
[Test]
public void TestMap()
{
var result = Try<Employee>.Invoke(() => repo.Create("Kees"))
@@ -19,7 +19,7 @@ public void TestMap()
Assert.IsTrue(result);
}

[TestMethod]
[Test]
public void TestFlatMap()
{
var result = Try<Employee>.Invoke(() => repo.Create("Kees"))
@@ -29,7 +29,7 @@ public void TestFlatMap()
Assert.IsTrue(result);
}

[TestMethod]
[Test]
public void TestFailureOnMap()
{
var result = Try<Employee>.Invoke(() => repo.Create("Kees"))
@@ -38,7 +38,7 @@ public void TestFailureOnMap()
Assert.IsTrue(result.IsFailure);
}

[TestMethod]
[Test]
public void TestRecoverOnFlatMap()
{
var result = Try<Employee>.Invoke(() => repo.Create("Kees"))
@@ -49,7 +49,7 @@ public void TestRecoverOnFlatMap()
Assert.AreEqual(result.Value.Name, "Jaap");
}

[TestMethod]
[Test]
public void TestSpecificRecoverOnFlatMap()
{
var result = Try<Employee>.Invoke(() => repo.Create("Kees"))
@@ -61,7 +61,7 @@ public void TestSpecificRecoverOnFlatMap()
Assert.AreEqual(result.Get().Name, "Jaap");
}

[TestMethod]
[Test]
public void TestRecoverSkippingSpecificRecoverOnFlatMap()
{
var result = Try<Employee>.Invoke(() => repo.Create("Kees"))
@@ -73,7 +73,7 @@ public void TestRecoverSkippingSpecificRecoverOnFlatMap()
Assert.AreEqual(result.Value.Name, "Jan");
}

[TestMethod]
[Test]
public void TestFilter()
{
var result = Try<Employee>.Invoke(() => repo.Create("Kees"))
@@ -82,7 +82,7 @@ public void TestFilter()
Assert.IsTrue(result.IsSuccess);
}

[TestMethod]
[Test]
public void TestFilterNegative()
{
var result = Try<Employee>.Invoke(() => repo.Create("Frits"))
@@ -91,7 +91,7 @@ public void TestFilterNegative()
Assert.IsTrue(result.IsFailure);
}

[TestMethod]
[Test]
public void TestGetOrElse()
{
var result = Try<Employee>.Invoke(() => repo.Create("Kees"))
@@ -100,7 +100,7 @@ public void TestGetOrElse()
Assert.AreEqual(result.Name, "Kees");
}

[TestMethod]
[Test]
public void TestGetOrElseFails()
{
var result = Try<Employee>.Invoke(() => repo.Create("Frits"))
@@ -110,7 +110,7 @@ public void TestGetOrElseFails()
Assert.AreEqual(result.Name, "Hans");
}

[TestMethod]
[Test]
public void TestOrElse()
{
var result = Try<Employee>.Invoke(() => repo.Create("Kees"))
@@ -120,7 +120,7 @@ public void TestOrElse()
Assert.AreEqual(result.Name, "Kees");
}

[TestMethod]
[Test]
public void TestOrElseFails()
{
var result = Try<Employee>.Invoke(() => repo.Create("Frits"))
@@ -131,7 +131,7 @@ public void TestOrElseFails()
Assert.AreEqual(result.Name, "Hans");
}

[TestMethod]
[Test]
public void TestDoSuccess()
{
var result = Try<Employee>.Invoke(() => repo.Create("Frits"))
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NUnit" version="3.5.0" targetFramework="net45" />
<package id="NUnit.ConsoleRunner" version="3.4.1" targetFramework="net45" />
<package id="NUnit.Extension.NUnitProjectLoader" version="3.4.1" targetFramework="net45" />
<package id="NUnit.Extension.NUnitV2Driver" version="3.4.1" targetFramework="net45" />
<package id="NUnit.Extension.NUnitV2ResultWriter" version="3.4.1" targetFramework="net45" />
<package id="NUnit.Extension.TeamCityEventListener" version="1.0.1" targetFramework="net45" />
<package id="NUnit.Extension.VSProjectLoader" version="3.4.1" targetFramework="net45" />
<package id="NUnit.Runners" version="3.4.1" targetFramework="net45" />
</packages>
@@ -46,6 +46,9 @@
<Compile Include="Try.cs" />
<Compile Include="TryException.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="packages.config" />
</ItemGroup>
<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.
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NUnit" version="3.5.0" targetFramework="net45" />
<package id="NUnit.ConsoleRunner" version="3.4.1" targetFramework="net45" />
<package id="NUnit.Extension.NUnitProjectLoader" version="3.4.1" targetFramework="net45" />
<package id="NUnit.Extension.NUnitV2Driver" version="3.4.1" targetFramework="net45" />
<package id="NUnit.Extension.NUnitV2ResultWriter" version="3.4.1" targetFramework="net45" />
<package id="NUnit.Extension.TeamCityEventListener" version="1.0.1" targetFramework="net45" />
<package id="NUnit.Extension.VSProjectLoader" version="3.4.1" targetFramework="net45" />
<package id="NUnit.Runners" version="3.4.1" targetFramework="net45" />
</packages>

0 comments on commit 9cf0e38

Please sign in to comment.