Permalink
Browse files

Ported tests to MbUnit.

  • Loading branch information...
1 parent 3a64e4e commit 3282cf2a13be009a1b0f42e4324448b5d08725e1 @ChrisFulstow committed Apr 25, 2011
View
@@ -1,3 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<configuration>
-</configuration>
@@ -1,19 +1,17 @@
-using System;
-using System.Text;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.Linq;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
+using MbUnit.Framework;
using NBlog.Web.Application.Service;
using NBlog.Web.Application.Service.Entity;
using NBlog.Web.Controllers;
using NSubstitute;
namespace NBlog.Tests
{
- [TestClass]
+ [TestFixture]
public class EntryControllerTests
{
- [TestMethod]
+ [Test]
public void ListTest()
{
// arrange
@@ -1,35 +1,43 @@
-using System.IO;
+using System;
+using System.IO;
using System.Linq;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Gallio.Framework;
+using MbUnit.Framework;
using NBlog.Web.Application;
using NBlog.Web.Application.Service.Entity;
using NBlog.Web.Application.Storage;
using NBlog.Web.Application.Storage.Json;
-namespace NBlog.Tests
+namespace NBlog.Tests.MbUnit
{
- [TestClass]
+ [TestFixture]
public class JsonRepositoryTests
{
public TestContext TestContext { get; set; }
private RepositoryKeys _keys;
private JsonRepository _jsonRepository;
private string _dataPath;
- [TestInitialize]
+ [SetUp]
public void TestInit()
{
_keys = new RepositoryKeys();
_keys.Add<Entry>(e => e.Slug);
_keys.Add<Config>(c => c.Site);
_keys.Add<User>(u => u.Username);
- _dataPath = Path.Combine(TestContext.TestDir, "JsonRepository");
+ _dataPath = Path.Combine(Path.GetTempPath(), "JsonRepositoryTests");
+
+ if (Directory.Exists(_dataPath))
+ {
+ Directory.Delete(_dataPath, recursive: true);
+ }
+
_jsonRepository = new JsonRepository(_keys, _dataPath);
}
- [TestCleanup]
+ [TearDown]
public void TestCleanup()
{
if (Directory.Exists(_dataPath))
@@ -39,7 +47,7 @@ public void TestCleanup()
}
- [TestMethod]
+ [Test]
public void Single_Should_Return_Correct_Entity_By_Key()
{
// arrange
@@ -49,7 +57,7 @@ public void Single_Should_Return_Correct_Entity_By_Key()
// act
_jsonRepository.Save(entry);
-
+
var keyValue = _keys.GetKeyValue(entry);
var retrievedEntry = _jsonRepository.Single<Entry>(keyValue);
@@ -58,7 +66,7 @@ public void Single_Should_Return_Correct_Entity_By_Key()
}
- [TestMethod]
+ [Test]
public void List_Should_Return_All_Entities()
{
// arrange
@@ -73,7 +81,7 @@ public void List_Should_Return_All_Entities()
Assert.IsTrue(all.Count() == 3);
}
- [TestMethod]
+ [Test]
public void Exists_Should_Be_True_When_Entity_Exists()
{
// arrange
@@ -87,7 +95,7 @@ public void Exists_Should_Be_True_When_Entity_Exists()
}
- [TestMethod]
+ [Test]
public void Exists_Should_Be_False_When_Entity_Deleted()
{
// arrange
@@ -100,5 +108,6 @@ public void Exists_Should_Be_False_When_Entity_Deleted()
// assert
Assert.IsFalse(exists);
}
+
}
-}
+}
@@ -3,21 +3,16 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>
- </ProductVersion>
+ <ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{01B84B52-FD31-4C19-A68C-36E509CA533D}</ProjectGuid>
+ <ProjectGuid>{DF1D802E-F26B-4A53-8BFD-9B75BF8FB87C}</ProjectGuid>
+ <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>NBlog.Tests</RootNamespace>
<AssemblyName>NBlog.Tests</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
- <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SccProjectName>SAK</SccProjectName>
- <SccLocalPath>SAK</SccLocalPath>
- <SccAuxPath>SAK</SccAuxPath>
- <SccProvider>SAK</SccProvider>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -36,57 +31,41 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release_CF|AnyCPU'">
- <OutputPath>bin\Release_CF\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <Optimize>true</Optimize>
- <DebugType>pdbonly</DebugType>
- <PlatformTarget>AnyCPU</PlatformTarget>
- <CodeAnalysisLogFile>bin\Release\NBlog.Tests.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
- <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
- <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
- <ErrorReport>prompt</ErrorReport>
- <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRuleSetDirectories>;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
- <CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
- <CodeAnalysisRuleDirectories>;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
- <CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
- </PropertyGroup>
<ItemGroup>
- <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
+ <Reference Include="Gallio" />
+ <Reference Include="MbUnit" />
<Reference Include="NSubstitute">
<HintPath>..\NBlog.Lib\NSubstitute.dll</HintPath>
</Reference>
<Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
+ <Reference Include="System.Xml" />
+ <Reference Include="Gallio35" />
+ <Reference Include="MbUnit35" />
<Reference Include="System.Core">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ <RequiredTargetFramework>4.0</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Xml.Linq">
+ <RequiredTargetFramework>4.0</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data.DataSetExtensions">
+ <RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
- <Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
- </ItemGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
</ItemGroup>
<ItemGroup>
<Compile Include="EntryControllerTests.cs" />
<Compile Include="JsonRepositoryTests.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SlugTests.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NBlog.Web\NBlog.Web.csproj">
<Project>{980CCF7B-946B-41D2-9F71-4EDC4E04AEAD}</Project>
<Name>NBlog.Web</Name>
</ProjectReference>
</ItemGroup>
- <ItemGroup />
- <ItemGroup>
- <None Include="App.config">
- <SubType>Designer</SubType>
- </None>
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.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">
@@ -5,12 +5,12 @@
// 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("NBlog.Tests")]
+[assembly: AssemblyTitle("NBlog.Tests.MbUnit")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("NBlog.Tests")]
-[assembly: AssemblyCopyright("Copyright © 2010")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("NBlog.Tests.MbUnit")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -20,7 +20,7 @@
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("77f5e175-a51f-4cab-a530-81134f3022d8")]
+[assembly: Guid("db7aaeff-176e-4f27-937b-cbc25fa91ee9")]
// Version information for an assembly consists of the following four values:
//
@@ -29,7 +29,7 @@
// Build Number
// Revision
//
-// You can specify all the values or you can default the Build and Revision Numbers
+// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
View
@@ -1,13 +1,17 @@
+using System;
using System.Collections.Generic;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System.Text;
+using Gallio.Framework;
+using MbUnit.Framework;
+using MbUnit.Framework.ContractVerifiers;
using NBlog.Web.Application;
-namespace NBlog.Tests
+namespace NBlog.Tests.MbUnit
{
- [TestClass]
+ [TestFixture]
public class SlugTests
{
- [TestMethod]
+ [Test]
public void ToSlugUrl_Should_Build_Correct_Slugs()
{
// arrange
@@ -30,4 +34,4 @@ public void ToSlugUrl_Should_Build_Correct_Slugs()
}
}
}
-}
+}
View
@@ -14,10 +14,14 @@
<AssemblyName>NBlog.Web</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<MvcBuildViews>false</MvcBuildViews>
- <SccProjectName>SAK</SccProjectName>
- <SccLocalPath>SAK</SccLocalPath>
- <SccAuxPath>SAK</SccAuxPath>
- <SccProvider>SAK</SccProvider>
+ <SccProjectName>
+ </SccProjectName>
+ <SccLocalPath>
+ </SccLocalPath>
+ <SccAuxPath>
+ </SccAuxPath>
+ <SccProvider>
+ </SccProvider>
<UseIISExpress>false</UseIISExpress>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
View
@@ -3,30 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NBlog.Web", "NBlog.Web\NBlog.Web.csproj", "{980CCF7B-946B-41D2-9F71-4EDC4E04AEAD}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NBlog.Tests", "NBlog.Tests\NBlog.Tests.csproj", "{01B84B52-FD31-4C19-A68C-36E509CA533D}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F0C068EF-7B24-4774-9F09-00FB0FB4332D}"
- ProjectSection(SolutionItems) = preProject
- Local.testsettings = Local.testsettings
- NBlog.vsmdi = NBlog.vsmdi
- TraceAndTestImpact.testsettings = TraceAndTestImpact.testsettings
- EndProjectSection
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NBlog.Lib", "NBlog.Lib\NBlog.Lib.csproj", "{093D2FDF-2411-461F-8D74-DFC3B84B050C}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NBlog.Tests", "NBlog.Tests\NBlog.Tests.csproj", "{DF1D802E-F26B-4A53-8BFD-9B75BF8FB87C}"
+EndProject
Global
- GlobalSection(TeamFoundationVersionControl) = preSolution
- SccNumberOfProjects = 3
- SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
- SccTeamFoundationServer = https://tfs.codeplex.com/tfs/tfs03
- SccLocalPath0 = .
- SccProjectUniqueName1 = NBlog.Web\\NBlog.Web.csproj
- SccProjectName1 = NBlog.Web
- SccLocalPath1 = NBlog.Web
- SccProjectUniqueName2 = NBlog.Tests\\NBlog.Tests.csproj
- SccProjectName2 = NBlog.Tests
- SccLocalPath2 = NBlog.Tests
- EndGlobalSection
GlobalSection(TestCaseManagementSettings) = postSolution
CategoryFile = NBlog.vsmdi
EndGlobalSection
@@ -39,12 +20,13 @@ Global
{980CCF7B-946B-41D2-9F71-4EDC4E04AEAD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{980CCF7B-946B-41D2-9F71-4EDC4E04AEAD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{980CCF7B-946B-41D2-9F71-4EDC4E04AEAD}.Release|Any CPU.Build.0 = Release|Any CPU
- {01B84B52-FD31-4C19-A68C-36E509CA533D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {01B84B52-FD31-4C19-A68C-36E509CA533D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {01B84B52-FD31-4C19-A68C-36E509CA533D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{093D2FDF-2411-461F-8D74-DFC3B84B050C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{093D2FDF-2411-461F-8D74-DFC3B84B050C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{093D2FDF-2411-461F-8D74-DFC3B84B050C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {DF1D802E-F26B-4A53-8BFD-9B75BF8FB87C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {DF1D802E-F26B-4A53-8BFD-9B75BF8FB87C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {DF1D802E-F26B-4A53-8BFD-9B75BF8FB87C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {DF1D802E-F26B-4A53-8BFD-9B75BF8FB87C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
View
Binary file not shown.
Oops, something went wrong.

0 comments on commit 3282cf2

Please sign in to comment.