Browse Source

New unit tests project using NUnit instead of VS tests

Former-commit-id: fdb9bf359884a5b8f168228ac45a8e194e4d3d1d
af/merge-core
Thomas Broust 12 years ago
parent
commit
58203f767d
  1. 3
      .gitignore
  2. 112
      src/ImageProcessor.Tests/ImageProcessor.Tests.csproj
  3. 36
      src/ImageProcessor.Tests/Properties/AssemblyInfo.cs
  4. 15
      src/ImageProcessor.Tests/app.config
  5. 52
      src/ImageProcessor.UnitTests/ImageProcessor.UnitTests.csproj
  6. 47
      src/ImageProcessor.UnitTests/RegularExpressionUnitTests.cs
  7. 4
      src/ImageProcessor.UnitTests/packages.config
  8. 13
      src/packages/repositories.config

3
.gitignore

@ -64,6 +64,9 @@ local.properties
.builds .builds
**/*.dotCover **/*.dotCover
# Xamarin
*.userprefs
## TODO: If you have NuGet Package Restore enabled, uncomment this ## TODO: If you have NuGet Package Restore enabled, uncomment this
packages/ packages/

112
src/ImageProcessor.Tests/ImageProcessor.Tests.csproj

@ -1,112 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{39911A38-CA06-413C-80AA-39EF60CE984F}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ImageProcessor.Tests</RootNamespace>
<AssemblyName>ImageProcessor.Tests</AssemblyName>
<TargetFrameworkVersion>v4.5</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>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
<Reference Include="System.Drawing" />
</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="RegularExpressionUnitTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ImageProcessor\ImageProcessor.csproj">
<Project>{3b5dd734-fb7a-487d-8ce6-55e7af9aea7e}</Project>
<Name>ImageProcessor</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
</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>
-->
</Project>

36
src/ImageProcessor.Tests/Properties/AssemblyInfo.cs

@ -1,36 +0,0 @@
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("ImageProcessor.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ImageProcessor.Tests")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[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("ab617b65-7259-4dc5-9dad-81a7c6537a4f")]
// 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")]

15
src/ImageProcessor.Tests/app.config

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.5.19.0" newVersion="2.5.19.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.5.19.0" newVersion="2.5.19.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

52
src/ImageProcessor.UnitTests/ImageProcessor.UnitTests.csproj

@ -0,0 +1,52 @@
<?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>{03CA9055-F997-428C-BF28-F50F991777C6}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>ImageProcessor.UnitTests</RootNamespace>
<AssemblyName>ImageProcessor.UnitTests</AssemblyName>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
</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' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Drawing" />
<Reference Include="nunit.framework">
<HintPath>..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup>
<Compile Include="RegularExpressionUnitTests.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\ImageProcessor\ImageProcessor.csproj">
<Project>{3B5DD734-FB7A-487D-8CE6-55E7AF9AEA7E}</Project>
<Name>ImageProcessor</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
</Project>

47
src/ImageProcessor.Tests/RegularExpressionUnitTests.cs → src/ImageProcessor.UnitTests/RegularExpressionUnitTests.cs

@ -1,31 +1,18 @@
// ----------------------------------------------------------------------- namespace ImageProcessor.UnitTests
// <copyright file="RegularExpressionUnitTests.cs" company="James South">
// Copyright (c) James South.
// Licensed under the Apache License, Version 2.0.
// </copyright>
// -----------------------------------------------------------------------
namespace ImageProcessor.Tests
{ {
#region Using using System;
using System.Drawing; using System.Drawing;
using ImageProcessor.Imaging; using ImageProcessor.Imaging;
using ImageProcessor.Processors; using ImageProcessor.Processors;
using Microsoft.VisualStudio.TestTools.UnitTesting; using NUnit.Framework;
#endregion
[TestFixture ()]
/// <summary>
/// The regular expression unit tests.
/// This is a work in progress. YAWN!
/// </summary>
[TestClass]
public class RegularExpressionUnitTests public class RegularExpressionUnitTests
{ {
#region Regular Expression Tests
/// <summary> /// <summary>
/// The alpha regex unit test. /// The alpha regex unit test.
/// </summary> /// </summary>
[TestMethod] [Test ()]
public void TestAlphaRegex() public void TestAlphaRegex()
{ {
const string Querystring = "alpha=56"; const string Querystring = "alpha=56";
@ -42,7 +29,7 @@ namespace ImageProcessor.Tests
/// <summary> /// <summary>
/// The brightness regex unit test. /// The brightness regex unit test.
/// </summary> /// </summary>
[TestMethod] [Test ()]
public void TestBrightnessRegex() public void TestBrightnessRegex()
{ {
const string Querystring = "brightness=56"; const string Querystring = "brightness=56";
@ -59,7 +46,7 @@ namespace ImageProcessor.Tests
/// <summary> /// <summary>
/// The contrast regex unit test. /// The contrast regex unit test.
/// </summary> /// </summary>
[TestMethod] [Test ()]
public void TestContrastRegex() public void TestContrastRegex()
{ {
const string Querystring = "contrast=56"; const string Querystring = "contrast=56";
@ -76,7 +63,7 @@ namespace ImageProcessor.Tests
/// <summary> /// <summary>
/// The rotate regex unit test. /// The rotate regex unit test.
/// </summary> /// </summary>
[TestMethod] [Test ()]
public void TestCropRegex() public void TestCropRegex()
{ {
const string Querystring = "crop=0,0,150,300"; const string Querystring = "crop=0,0,150,300";
@ -92,7 +79,7 @@ namespace ImageProcessor.Tests
/// <summary> /// <summary>
/// The filter regex unit test. /// The filter regex unit test.
/// </summary> /// </summary>
[TestMethod] [Test ()]
public void TestFilterRegex() public void TestFilterRegex()
{ {
// Should really write more for the other filters. // Should really write more for the other filters.
@ -110,7 +97,7 @@ namespace ImageProcessor.Tests
/// <summary> /// <summary>
/// The format regex unit test. /// The format regex unit test.
/// </summary> /// </summary>
[TestMethod] [Test ()]
public void TestFormatRegex() public void TestFormatRegex()
{ {
const string Querystring = "format=gif"; const string Querystring = "format=gif";
@ -127,7 +114,7 @@ namespace ImageProcessor.Tests
/// <summary> /// <summary>
/// The quality regex unit test. /// The quality regex unit test.
/// </summary> /// </summary>
[TestMethod] [Test ()]
public void TestQualityRegex() public void TestQualityRegex()
{ {
const string Querystring = "quality=56"; const string Querystring = "quality=56";
@ -144,7 +131,7 @@ namespace ImageProcessor.Tests
/// <summary> /// <summary>
/// The resize regex unit test. /// The resize regex unit test.
/// </summary> /// </summary>
[TestMethod] [Test ()]
public void TestResizeRegex() public void TestResizeRegex()
{ {
const string Querystring = "width=300"; const string Querystring = "width=300";
@ -161,7 +148,7 @@ namespace ImageProcessor.Tests
/// <summary> /// <summary>
/// The rotate regex unit test. /// The rotate regex unit test.
/// </summary> /// </summary>
[TestMethod] [Test ()]
public void TestRotateRegex() public void TestRotateRegex()
{ {
const string Querystring = "rotate=270"; const string Querystring = "rotate=270";
@ -178,7 +165,7 @@ namespace ImageProcessor.Tests
/// <summary> /// <summary>
/// The rounded corners regex unit test. /// The rounded corners regex unit test.
/// </summary> /// </summary>
[TestMethod] [Test ()]
public void TestRoundedCornersRegex() public void TestRoundedCornersRegex()
{ {
const string Querystring = "roundedcorners=30"; const string Querystring = "roundedcorners=30";
@ -195,7 +182,7 @@ namespace ImageProcessor.Tests
/// <summary> /// <summary>
/// The rounded corners regex unit test. /// The rounded corners regex unit test.
/// </summary> /// </summary>
[TestMethod] [Test ()]
public void TestTintRegex() public void TestTintRegex()
{ {
const string HexQuerystring = "tint=6aa6cc"; const string HexQuerystring = "tint=6aa6cc";
@ -213,6 +200,6 @@ namespace ImageProcessor.Tests
Color actualRgba = tint.DynamicParameter; Color actualRgba = tint.DynamicParameter;
Assert.AreEqual(expectedRgba, actualRgba); Assert.AreEqual(expectedRgba, actualRgba);
} }
#endregion
} }
} }

4
src/ImageProcessor.UnitTests/packages.config

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NUnit" version="2.6.3" targetFramework="net40" />
</packages>

13
src/packages/repositories.config

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<repositories> <repositories>
<repository path="..\ImageProcessor.Web\NET4\packages.config" /> <repository path="..\ImageProcessor.UnitTests\packages.config" />
<repository path="..\TestWebsites\NET4\packages.config" /> <repository path="..\ImageProcessor.Web\NET4\packages.config" />
<repository path="..\TestWebsites\NET45\Test_Website_NET45\packages.config" /> <repository path="..\TestWebsites\NET4\packages.config" />
<repository path="..\TestWebsites\NET45\Test_Website_Webforms_NET45\packages.config" /> <repository path="..\TestWebsites\NET45\Test_Website_NET45\packages.config" />
<repository path="..\TestWebsites\NET45\Test_Website_Webforms_NET45\packages.config" />
</repositories> </repositories>
Loading…
Cancel
Save