Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5848 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61pull/1/head
45 changed files with 2975 additions and 0 deletions
@ -0,0 +1,60 @@
@@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build"> |
||||
<PropertyGroup> |
||||
<ProjectGuid>{98030C86-7B0F-4813-AC4D-9FFCF00CF81F}</ProjectGuid> |
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform> |
||||
<OutputType>Library</OutputType> |
||||
<RootNamespace>Gallio.Extension</RootNamespace> |
||||
<AssemblyName>Gallio.Extension</AssemblyName> |
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> |
||||
<AppDesignerFolder>Properties</AppDesignerFolder> |
||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
||||
<NoStdLib>False</NoStdLib> |
||||
<WarningLevel>4</WarningLevel> |
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Platform)' == 'x86' "> |
||||
<PlatformTarget>x86</PlatformTarget> |
||||
<RegisterForComInterop>False</RegisterForComInterop> |
||||
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> |
||||
<BaseAddress>4194304</BaseAddress> |
||||
<FileAlignment>4096</FileAlignment> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
||||
<OutputPath>bin\Debug\</OutputPath> |
||||
<DebugSymbols>true</DebugSymbols> |
||||
<DebugType>Full</DebugType> |
||||
<Optimize>False</Optimize> |
||||
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> |
||||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
||||
<OutputPath>bin\Release\</OutputPath> |
||||
<DebugSymbols>False</DebugSymbols> |
||||
<DebugType>None</DebugType> |
||||
<Optimize>True</Optimize> |
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
||||
<DefineConstants>TRACE</DefineConstants> |
||||
</PropertyGroup> |
||||
<ItemGroup> |
||||
<Reference Include="Gallio"> |
||||
<HintPath>..\Gallio\bin\Gallio.dll</HintPath> |
||||
</Reference> |
||||
<Reference Include="System" /> |
||||
<Reference Include="System.Xml" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Compile Include="GallioTestStepConverter.cs" /> |
||||
<Compile Include="ITestResultsWriter.cs" /> |
||||
<Compile Include="ITestResultsWriterFactory.cs" /> |
||||
<Compile Include="MultiLineTestResultText.cs" /> |
||||
<Compile Include="Properties\AssemblyInfo.cs" /> |
||||
<Compile Include="SharpDevelopTagFormatter.cs" /> |
||||
<Compile Include="SharpDevelopTestRunnerExtension.cs" /> |
||||
<Compile Include="TestResult.cs" /> |
||||
<Compile Include="TestResultsWriter.cs" /> |
||||
<Compile Include="TestResultsWriterFactory.cs" /> |
||||
</ItemGroup> |
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> |
||||
</Project> |
@ -0,0 +1,78 @@
@@ -0,0 +1,78 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Diagnostics; |
||||
using Model = Gallio.Model; |
||||
using Gallio.Common.Markup; |
||||
using Gallio.Runner.Events; |
||||
|
||||
namespace Gallio.Extension |
||||
{ |
||||
public class GallioTestStepConverter |
||||
{ |
||||
TestStepEventArgs eventArgs; |
||||
TestResult testResult; |
||||
SharpDevelopTagFormatter tagFormatter; |
||||
|
||||
public GallioTestStepConverter(TestStepEventArgs eventArgs) |
||||
{ |
||||
this.eventArgs = eventArgs; |
||||
Convert(); |
||||
} |
||||
|
||||
void Convert() |
||||
{ |
||||
CreateTestResult(); |
||||
ConvertTestOutcome(); |
||||
ConvertTestMessages(); |
||||
} |
||||
|
||||
void CreateTestResult() |
||||
{ |
||||
string name = GetTestName(); |
||||
testResult = new TestResult(name); |
||||
} |
||||
|
||||
string GetTestName() |
||||
{ |
||||
return eventArgs.Test.FullName.Replace('/', '.'); |
||||
} |
||||
|
||||
void ConvertTestOutcome() |
||||
{ |
||||
testResult.ResultType = GetTestResultType(eventArgs.TestStepRun.Result.Outcome.Status); |
||||
} |
||||
|
||||
TestResultType GetTestResultType(Model.TestStatus status) |
||||
{ |
||||
switch (status) { |
||||
case Model.TestStatus.Passed: |
||||
return TestResultType.Success; |
||||
case Model.TestStatus.Skipped: |
||||
case Model.TestStatus.Inconclusive: |
||||
return TestResultType.Ignored; |
||||
case Model.TestStatus.Failed: |
||||
return TestResultType.Failure; |
||||
} |
||||
return TestResultType.None; |
||||
} |
||||
|
||||
void ConvertTestMessages() |
||||
{ |
||||
tagFormatter = new SharpDevelopTagFormatter(); |
||||
tagFormatter.Visit(eventArgs.TestStepRun); |
||||
testResult.Message = tagFormatter.TestResultMessage; |
||||
testResult.StackTrace = tagFormatter.GetStackTrace(); |
||||
} |
||||
|
||||
public TestResult GetTestResult() |
||||
{ |
||||
return testResult; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
|
||||
namespace Gallio.Extension |
||||
{ |
||||
public interface ITestResultsWriter : IDisposable |
||||
{ |
||||
void Write(TestResult testResult); |
||||
} |
||||
} |
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
|
||||
namespace Gallio.Extension |
||||
{ |
||||
public interface ITestResultsWriterFactory |
||||
{ |
||||
ITestResultsWriter Create(string fileName); |
||||
} |
||||
} |
@ -0,0 +1,54 @@
@@ -0,0 +1,54 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Text; |
||||
|
||||
namespace Gallio.Extension |
||||
{ |
||||
public class MultiLineTestResultText |
||||
{ |
||||
StringBuilder textBuilder = new StringBuilder(); |
||||
|
||||
public MultiLineTestResultText(string text) |
||||
{ |
||||
EncodeText(text); |
||||
} |
||||
|
||||
public override string ToString() |
||||
{ |
||||
return textBuilder.ToString(); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Replaces the first character on each new line with a space.
|
||||
/// The first line does not have the extra space added.
|
||||
/// </summary>
|
||||
void EncodeText(string text) |
||||
{ |
||||
if (String.IsNullOrEmpty(text)) { |
||||
return; |
||||
} |
||||
|
||||
text = text.TrimEnd(Environment.NewLine.ToCharArray()); |
||||
|
||||
foreach (char ch in text) { |
||||
switch (ch) { |
||||
case '\n': |
||||
textBuilder.Append("\r\n "); |
||||
break; |
||||
case '\r': |
||||
// Ignore.
|
||||
break; |
||||
default: |
||||
textBuilder.Append(ch); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,31 @@
@@ -0,0 +1,31 @@
|
||||
#region Using directives
|
||||
|
||||
using System; |
||||
using System.Reflection; |
||||
using System.Runtime.InteropServices; |
||||
|
||||
#endregion
|
||||
|
||||
// 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("Gallio.Extension")] |
||||
[assembly: AssemblyDescription("")] |
||||
[assembly: AssemblyConfiguration("")] |
||||
[assembly: AssemblyCompany("")] |
||||
[assembly: AssemblyProduct("Gallio.Extension")] |
||||
[assembly: AssemblyCopyright("Copyright 2010")] |
||||
[assembly: AssemblyTrademark("")] |
||||
[assembly: AssemblyCulture("")] |
||||
|
||||
// This sets the default COM visibility of types in the assembly to invisible.
|
||||
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
||||
[assembly: ComVisible(false)] |
||||
|
||||
// The assembly version has following format :
|
||||
//
|
||||
// Major.Minor.Build.Revision
|
||||
//
|
||||
// You can specify all the values or you can use the default the Revision and
|
||||
// Build Numbers by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.*")] |
@ -0,0 +1,68 @@
@@ -0,0 +1,68 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Text; |
||||
using Gallio.Common.Markup; |
||||
using Gallio.Common.Markup.Tags; |
||||
using Gallio.Runner.Reports.Schema; |
||||
|
||||
namespace Gallio.Extension |
||||
{ |
||||
public class SharpDevelopTagFormatter : ITagVisitor |
||||
{ |
||||
StringBuilder textBuilder = new StringBuilder(); |
||||
string testResultMessage = String.Empty; |
||||
|
||||
public void Visit(TestStepRun testStepRun) |
||||
{ |
||||
foreach (StructuredStream stream in testStepRun.TestLog.Streams) { |
||||
VisitBodyTag(stream.Body); |
||||
} |
||||
} |
||||
|
||||
public void VisitBodyTag(BodyTag tag) |
||||
{ |
||||
foreach (Tag childTag in tag.Contents) { |
||||
childTag.Accept(this); |
||||
} |
||||
} |
||||
|
||||
public void VisitSectionTag(SectionTag tag) |
||||
{ |
||||
textBuilder.Append(tag.Name + " "); |
||||
tag.AcceptContents(this); |
||||
} |
||||
|
||||
public void VisitMarkerTag(MarkerTag tag) |
||||
{ |
||||
if (tag.Class == Marker.StackTraceClass) { |
||||
testResultMessage = textBuilder.ToString(); |
||||
textBuilder = new StringBuilder(); |
||||
} |
||||
tag.AcceptContents(this); |
||||
} |
||||
|
||||
public void VisitEmbedTag(EmbedTag tag) |
||||
{ |
||||
} |
||||
|
||||
public void VisitTextTag(TextTag tag) |
||||
{ |
||||
textBuilder.Append(tag.Text); |
||||
} |
||||
|
||||
public string TestResultMessage { |
||||
get { return testResultMessage; } |
||||
} |
||||
|
||||
public string GetStackTrace() |
||||
{ |
||||
return textBuilder.ToString(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,51 @@
@@ -0,0 +1,51 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Diagnostics; |
||||
using Gallio.Runner.Events; |
||||
using Gallio.Runner.Extensions; |
||||
|
||||
namespace Gallio.Extension |
||||
{ |
||||
public class SharpDevelopTestRunnerExtension : TestRunnerExtension |
||||
{ |
||||
ITestResultsWriterFactory factory; |
||||
ITestResultsWriter writer; |
||||
|
||||
public SharpDevelopTestRunnerExtension(ITestResultsWriterFactory factory) |
||||
{ |
||||
this.factory = factory; |
||||
} |
||||
|
||||
public SharpDevelopTestRunnerExtension() |
||||
: this(new TestResultsWriterFactory()) |
||||
{ |
||||
} |
||||
|
||||
protected override void Initialize() |
||||
{ |
||||
writer = factory.Create(Parameters); |
||||
Events.TestStepFinished += TestStepFinished; |
||||
Events.DisposeStarted += DisposeStarted; |
||||
} |
||||
|
||||
void TestStepFinished(object source, TestStepFinishedEventArgs e) |
||||
{ |
||||
if (e.Test.IsTestCase) { |
||||
GallioTestStepConverter testStep = new GallioTestStepConverter(e); |
||||
TestResult testResult = testStep.GetTestResult(); |
||||
writer.Write(testResult); |
||||
} |
||||
} |
||||
|
||||
void DisposeStarted(object source, DisposeStartedEventArgs e) |
||||
{ |
||||
writer.Dispose(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,80 @@
@@ -0,0 +1,80 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
|
||||
namespace Gallio.Extension |
||||
{ |
||||
public enum TestResultType { |
||||
/// <summary>
|
||||
/// The test has not been run.
|
||||
/// </summary>
|
||||
None = 0, |
||||
|
||||
/// <summary>
|
||||
/// The test passed.
|
||||
/// </summary>
|
||||
Success = 1, |
||||
|
||||
/// <summary>
|
||||
/// The test failed.
|
||||
/// </summary>
|
||||
Failure = 2, |
||||
|
||||
/// <summary>
|
||||
/// The test was ignored.
|
||||
/// </summary>
|
||||
Ignored = 3 |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Holds the information about a single test result.
|
||||
/// </summary>
|
||||
public class TestResult |
||||
{ |
||||
string name = String.Empty; |
||||
string message = String.Empty; |
||||
string stackTrace = String.Empty; |
||||
TestResultType resultType = TestResultType.None; |
||||
|
||||
public TestResult(string name) |
||||
{ |
||||
this.name = name; |
||||
} |
||||
|
||||
public string Name { |
||||
get { return name; } |
||||
} |
||||
|
||||
public bool IsSuccess { |
||||
get { return resultType == TestResultType.Success; } |
||||
} |
||||
|
||||
public bool IsFailure { |
||||
get { return resultType == TestResultType.Failure; } |
||||
} |
||||
|
||||
public bool IsIgnored { |
||||
get { return resultType == TestResultType.Ignored; } |
||||
} |
||||
|
||||
public TestResultType ResultType { |
||||
get { return resultType; } |
||||
set { resultType = value; } |
||||
} |
||||
|
||||
public string Message { |
||||
get { return message; } |
||||
set { message = value; } |
||||
} |
||||
|
||||
public string StackTrace { |
||||
get { return stackTrace; } |
||||
set { stackTrace = value; } |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,90 @@
@@ -0,0 +1,90 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.IO; |
||||
using System.Text; |
||||
|
||||
namespace Gallio.Extension |
||||
{ |
||||
public class TestResultsWriter : ITestResultsWriter, IDisposable |
||||
{ |
||||
TextWriter writer; |
||||
|
||||
public TestResultsWriter(string fileName) |
||||
: this(new StreamWriter(fileName, false, Encoding.UTF8)) |
||||
{ |
||||
} |
||||
|
||||
public TestResultsWriter(TextWriter writer) |
||||
{ |
||||
this.writer = writer; |
||||
} |
||||
|
||||
public void Write(TestResult testResult) |
||||
{ |
||||
WriteTestName(testResult.Name); |
||||
WriteResult(testResult.ResultType); |
||||
|
||||
if (testResult.ResultType == TestResultType.Failure) { |
||||
WriteTestFailureResult(testResult); |
||||
} |
||||
} |
||||
|
||||
void WriteTestName(string name) |
||||
{ |
||||
WriteNameAndValue("Name", name); |
||||
} |
||||
|
||||
void WriteResult(TestResultType resultType) |
||||
{ |
||||
string result = GetResult(resultType); |
||||
WriteNameAndValue("Result", result); |
||||
} |
||||
|
||||
void WriteTestFailureResult(TestResult testResult) |
||||
{ |
||||
WriteNameAndMultiLineValue("Message", testResult.Message); |
||||
WriteNameAndMultiLineValue("StackTrace", testResult.StackTrace); |
||||
} |
||||
|
||||
void WriteNameAndValue(string name, string value) |
||||
{ |
||||
string nameAndValue = String.Format("{0}: {1}", name, value); |
||||
WriteLine(nameAndValue); |
||||
} |
||||
|
||||
string GetResult(TestResultType resultType) |
||||
{ |
||||
switch (resultType) { |
||||
case TestResultType.Success: |
||||
return "Success"; |
||||
case TestResultType.Ignored: |
||||
return "Ignored"; |
||||
case TestResultType.Failure: |
||||
return "Failure"; |
||||
} |
||||
return String.Empty; |
||||
} |
||||
|
||||
void WriteNameAndMultiLineValue(string name, string value) |
||||
{ |
||||
MultiLineTestResultText multiLineText = new MultiLineTestResultText(value); |
||||
WriteNameAndValue(name, multiLineText.ToString()); |
||||
} |
||||
|
||||
void WriteLine(string text) |
||||
{ |
||||
writer.WriteLine(text); |
||||
} |
||||
|
||||
public void Dispose() |
||||
{ |
||||
writer.Dispose(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,19 @@
@@ -0,0 +1,19 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
|
||||
namespace Gallio.Extension |
||||
{ |
||||
public class TestResultsWriterFactory : ITestResultsWriterFactory |
||||
{ |
||||
public ITestResultsWriter Create(string fileName) |
||||
{ |
||||
return new TestResultsWriter(fileName); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,99 @@
@@ -0,0 +1,99 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<PropertyGroup> |
||||
<ProjectGuid>{3F6C539D-DB38-41B4-A5B3-B9A52AE607CD}</ProjectGuid> |
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform> |
||||
<OutputType>Library</OutputType> |
||||
<RootNamespace>Gallio.SharpDevelop.Tests</RootNamespace> |
||||
<AssemblyName>Gallio.SharpDevelop.Tests</AssemblyName> |
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> |
||||
<SourceAnalysisOverrideSettingsFile>C:\Users\Matt\AppData\Roaming\ICSharpCode/SharpDevelop3.0\Settings.SourceAnalysis</SourceAnalysisOverrideSettingsFile> |
||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
||||
<NoStdLib>False</NoStdLib> |
||||
<WarningLevel>4</WarningLevel> |
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Platform)' == 'x86' "> |
||||
<PlatformTarget>x86</PlatformTarget> |
||||
<RegisterForComInterop>False</RegisterForComInterop> |
||||
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> |
||||
<BaseAddress>4194304</BaseAddress> |
||||
<FileAlignment>4096</FileAlignment> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
||||
<OutputPath>bin\Debug\</OutputPath> |
||||
<DebugSymbols>true</DebugSymbols> |
||||
<DebugType>Full</DebugType> |
||||
<Optimize>False</Optimize> |
||||
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> |
||||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
||||
<OutputPath>bin\Release\</OutputPath> |
||||
<DebugSymbols>False</DebugSymbols> |
||||
<DebugType>None</DebugType> |
||||
<Optimize>True</Optimize> |
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
||||
<DefineConstants>TRACE</DefineConstants> |
||||
</PropertyGroup> |
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> |
||||
<ItemGroup> |
||||
<Reference Include="Gallio"> |
||||
<HintPath>..\Gallio\bin\Gallio.dll</HintPath> |
||||
</Reference> |
||||
<Reference Include="ICSharpCode.Core"> |
||||
<HintPath>..\..\..\bin\ICSharpCode.Core.dll</HintPath> |
||||
</Reference> |
||||
<Reference Include="ICSharpCode.SharpDevelop"> |
||||
<HintPath>..\..\..\bin\ICSharpCode.SharpDevelop.dll</HintPath> |
||||
</Reference> |
||||
<Reference Include="ICSharpCode.SharpDevelop.Dom"> |
||||
<HintPath>..\..\..\bin\ICSharpCode.SharpDevelop.Dom.dll</HintPath> |
||||
</Reference> |
||||
<Reference Include="ICSharpCode.SharpDevelop.Dom"> |
||||
<HintPath>..\..\..\bin\ICSharpCode.SharpDevelop.Dom.dll</HintPath> |
||||
</Reference> |
||||
<Reference Include="nunit.framework"> |
||||
<HintPath>..\..\..\bin\Tools\NUnit\nunit.framework.dll</HintPath> |
||||
</Reference> |
||||
<Reference Include="System" /> |
||||
<Reference Include="System.Xml" /> |
||||
<Reference Include="UnitTesting"> |
||||
<HintPath>..\..\..\AddIns\AddIns\Misc\UnitTesting\UnitTesting.dll</HintPath> |
||||
</Reference> |
||||
<Reference Include="UnitTesting.Tests"> |
||||
<HintPath>..\..\..\bin\UnitTests\UnitTesting.Tests.dll</HintPath> |
||||
</Reference> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<ProjectReference Include="..\Gallio.Extension\Gallio.Extension.csproj"> |
||||
<Project>{98030C86-7B0F-4813-AC4D-9FFCF00CF81F}</Project> |
||||
<Name>Gallio.Extension</Name> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\Gallio.SharpDevelop\Gallio.SharpDevelop.csproj"> |
||||
<Project>{88D3DC5E-8A91-4DCE-A785-CC37DE0AA0EC}</Project> |
||||
<Name>Gallio.SharpDevelop</Name> |
||||
</ProjectReference> |
||||
<Compile Include="GallioEchoApplicationFileNameTestFixture.cs" /> |
||||
<Compile Include="GallioEchoCommandLineTests.cs" /> |
||||
<Compile Include="GallioEchoConsoleProcessStartInfoTestFixture.cs" /> |
||||
<Compile Include="GallioTestFailureTestFixture.cs" /> |
||||
<Compile Include="GallioTestFrameworkIsTestClassTests.cs" /> |
||||
<Compile Include="GallioTestFrameworkIsTestMethodTests.cs" /> |
||||
<Compile Include="GallioTestFrameworkIsTestProjectTests.cs" /> |
||||
<Compile Include="GallioTestToSharpDevelopTestResultConversionTests.cs" /> |
||||
<Compile Include="TestResultsWriterTestFixture.cs" /> |
||||
<Compile Include="TestRunnerExtensionTestFixture.cs" /> |
||||
<Compile Include="Utils\GallioBodyTagFactory.cs" /> |
||||
<Compile Include="Utils\MockTestResultsWriter.cs" /> |
||||
<Compile Include="Utils\MockTestResultsWriterFactory.cs" /> |
||||
<Compile Include="Utils\MockTestRunnerEvents.cs" /> |
||||
<Compile Include="Utils\GallioTestStepFinishedEventArgsFactory.cs" /> |
||||
<Compile Include="Utils\Tests\CreateAssertionFailureBodyTagTestFixture.cs" /> |
||||
<Compile Include="Utils\Tests\MockTestResultsWriterFactoryTests.cs" /> |
||||
<Compile Include="Utils\Tests\MockTestRunnerEventsTestFixture.cs" /> |
||||
<Folder Include="Utils" /> |
||||
<Folder Include="Utils\Tests" /> |
||||
</ItemGroup> |
||||
</Project> |
@ -0,0 +1,62 @@
@@ -0,0 +1,62 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using ICSharpCode.UnitTesting; |
||||
using Gallio.SharpDevelop; |
||||
using NUnit.Framework; |
||||
using UnitTesting.Tests.Utils; |
||||
|
||||
namespace Gallio.SharpDevelop.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class GallioEchoApplicationFileNameTestFixture |
||||
{ |
||||
GallioEchoConsoleApplication app; |
||||
string gallioEchoConsoleFileName; |
||||
MockAddInTree addinTree; |
||||
string addinTreePath; |
||||
|
||||
[SetUp] |
||||
public void Init() |
||||
{ |
||||
MockCSharpProject project = new MockCSharpProject(); |
||||
SelectedTests tests = new SelectedTests(project); |
||||
|
||||
gallioEchoConsoleFileName = @"d:\gallio\bin\Gallio.Echo.exe"; |
||||
addinTreePath = GallioEchoConsoleApplicationFactory.AddInTreePath; |
||||
|
||||
addinTree = new MockAddInTree(); |
||||
List<string> items = new List<string>(); |
||||
items.Add(gallioEchoConsoleFileName); |
||||
|
||||
addinTree.AddItems<string>(addinTreePath, items); |
||||
|
||||
GallioEchoConsoleApplicationFactory factory = new GallioEchoConsoleApplicationFactory(addinTree); |
||||
app = factory.Create(tests); |
||||
} |
||||
|
||||
[Test] |
||||
public void AddInTreeBuildItemsReturnsGallioEchoConsoleFileName() |
||||
{ |
||||
List<string> items = addinTree.BuildItems<string>(addinTreePath, null); |
||||
|
||||
List<string> expectedItems = new List<string>(); |
||||
expectedItems.Add(gallioEchoConsoleFileName); |
||||
|
||||
Assert.AreEqual(expectedItems.ToArray(), items.ToArray()); |
||||
} |
||||
|
||||
[Test] |
||||
public void ApplicationFileNameIsTakenFromAddInTree() |
||||
{ |
||||
string expectedFileName = gallioEchoConsoleFileName; |
||||
Assert.AreEqual(expectedFileName, app.FileName); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,76 @@
@@ -0,0 +1,76 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using ICSharpCode.UnitTesting; |
||||
using NUnit.Framework; |
||||
using UnitTesting.Tests.Utils; |
||||
|
||||
namespace Gallio.SharpDevelop.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class GallioEchoCommandLineTests |
||||
{ |
||||
MockCSharpProject project; |
||||
SelectedTests selectedTests; |
||||
|
||||
[SetUp] |
||||
public void Init() |
||||
{ |
||||
project = new MockCSharpProject(); |
||||
selectedTests = new SelectedTests(project); |
||||
} |
||||
|
||||
[Test] |
||||
public void CommandLineIncludesProjectOutputAssembly() |
||||
{ |
||||
GallioEchoConsoleApplication app = new GallioEchoConsoleApplication(selectedTests); |
||||
|
||||
string expectedArgs = |
||||
"/rv:v4.0.30319 " + |
||||
"\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\""; |
||||
|
||||
Assert.AreEqual(expectedArgs, app.GetArguments()); |
||||
} |
||||
|
||||
[Test] |
||||
public void SharpDevelopTestRunnerExtensionAddedToCommandLine() |
||||
{ |
||||
SharpDevelopTestRunnerExtensionCommandLineArgument arg = |
||||
new SharpDevelopTestRunnerExtensionCommandLineArgument(); |
||||
arg.TestResultsFileName = @"c:\temp\tmp66.tmp"; |
||||
|
||||
GallioEchoConsoleApplication app = new GallioEchoConsoleApplication(selectedTests); |
||||
app.TestRunnerExtensions.Add(arg); |
||||
|
||||
string expectedArgs = |
||||
"/rv:v4.0.30319 " + |
||||
"/re:\"Gallio.Extension.SharpDevelopTestRunnerExtension,Gallio.Extension.dll;c:\\temp\\tmp66.tmp\" " + |
||||
"\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\""; |
||||
|
||||
Assert.AreEqual(expectedArgs, app.GetArguments()); |
||||
} |
||||
|
||||
[Test] |
||||
public void TestRunnerExtensionWithoutParametersAddedToCommandLine() |
||||
{ |
||||
TestRunnerExtensionCommandLineArgument arg = |
||||
new TestRunnerExtensionCommandLineArgument("MyNamespace.MyTestExtension,MyTestRunner.dll"); |
||||
|
||||
GallioEchoConsoleApplication app = new GallioEchoConsoleApplication(selectedTests); |
||||
app.TestRunnerExtensions.Add(arg); |
||||
|
||||
string expectedArgs = |
||||
"/rv:v4.0.30319 " + |
||||
"/re:\"MyNamespace.MyTestExtension,MyTestRunner.dll\" " + |
||||
"\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\""; |
||||
|
||||
Assert.AreEqual(expectedArgs, app.GetArguments()); |
||||
} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,85 @@
@@ -0,0 +1,85 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Diagnostics; |
||||
using System.IO; |
||||
using Gallio.SharpDevelop; |
||||
using Gallio.SharpDevelop.Tests.Utils; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.UnitTesting; |
||||
using NUnit.Framework; |
||||
using UnitTesting.Tests.Utils; |
||||
|
||||
namespace Gallio.SharpDevelop.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class GallioEchoConsoleProcessStartInfoTestFixture |
||||
{ |
||||
ProcessStartInfo info; |
||||
|
||||
[TestFixtureSetUp] |
||||
public void SetUpFixture() |
||||
{ |
||||
string xml = |
||||
"<AddIn name='Unit Testing Addin'\r\n" + |
||||
" author='Matt Ward'\r\n" + |
||||
" copyright='prj:///doc/copyright.txt'\r\n" + |
||||
" description='Runs unit tests with Gallio inside SharpDevelop'\r\n" + |
||||
" addInManagerHidden='preinstalled'>\r\n" + |
||||
" <Manifest>\r\n" + |
||||
" <Identity name='ICSharpCode.Gallio'/>\r\n" + |
||||
" </Manifest>\r\n" + |
||||
"</AddIn>"; |
||||
AddIn addin = AddIn.Load(new StringReader(xml)); |
||||
addin.Enabled = false; |
||||
addin.FileName = @"d:\sharpdevelop\addins\gallio\Gallio.SharpDevelop.dll"; |
||||
AddInTree.InsertAddIn(addin); |
||||
} |
||||
|
||||
[SetUp] |
||||
public void Init() |
||||
{ |
||||
MockCSharpProject project = new MockCSharpProject(); |
||||
SelectedTests selectedTests = new SelectedTests(project); |
||||
GallioEchoConsoleApplication app = new GallioEchoConsoleApplication(selectedTests, @"d:\gallio\Gallio.Echo.exe"); |
||||
info = app.GetProcessStartInfo(); |
||||
} |
||||
|
||||
[Test] |
||||
public void GallioAddInPathIsConvertedByStringParser() |
||||
{ |
||||
string expectedDirectory = @"d:\sharpdevelop\addins\gallio"; |
||||
string actualDirectory = StringParser.Parse("${addinpath:ICSharpCode.Gallio}"); |
||||
Assert.AreEqual(expectedDirectory, actualDirectory); |
||||
} |
||||
|
||||
[Test] |
||||
public void WorkingDirectoryIsGallioAddInDirectory() |
||||
{ |
||||
string expectedDirectory = @"d:\sharpdevelop\addins\gallio"; |
||||
Assert.AreEqual(expectedDirectory, info.WorkingDirectory); |
||||
} |
||||
|
||||
[Test] |
||||
public void FileNameIsNUnitConsoleExe() |
||||
{ |
||||
string expectedFileName = @"d:\gallio\Gallio.Echo.exe"; |
||||
Assert.AreEqual(expectedFileName, info.FileName); |
||||
} |
||||
|
||||
[Test] |
||||
public void CommandLineArgumentsAreNUnitConsoleExeCommandLineArguments() |
||||
{ |
||||
string expectedCommandLine = |
||||
"/rv:v4.0.30319 " + |
||||
"\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\""; |
||||
|
||||
Assert.AreEqual(expectedCommandLine, info.Arguments); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,85 @@
@@ -0,0 +1,85 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.UnitTesting; |
||||
using NUnit.Framework; |
||||
using Gallio.SharpDevelop; |
||||
|
||||
namespace Gallio.SharpDevelop.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class GallioTestFailureTestFixture |
||||
{ |
||||
GallioTestResult gallioTestResult; |
||||
|
||||
[SetUp] |
||||
public void Init() |
||||
{ |
||||
TestResult testResult = new TestResult("MyNamespace.MyTests"); |
||||
testResult.ResultType = TestResultType.Failure; |
||||
testResult.Message = "Test failed"; |
||||
testResult.StackTrace = |
||||
@" at GallioTest.MyClass.AssertWithFailureMessage() in d:\temp\test\..\GallioTest\MyClass.cs:line 46"; |
||||
gallioTestResult = new GallioTestResult(testResult); |
||||
} |
||||
|
||||
[Test] |
||||
public void TestResultTypeIsFailure() |
||||
{ |
||||
Assert.AreEqual(TestResultType.Failure, gallioTestResult.ResultType); |
||||
} |
||||
|
||||
[Test] |
||||
public void TestResultMessageIsTestFailed() |
||||
{ |
||||
Assert.AreEqual("Test failed", gallioTestResult.Message); |
||||
} |
||||
|
||||
[Test] |
||||
public void TestResultHasStackTrace() |
||||
{ |
||||
string expectedStackTrace = |
||||
@" at GallioTest.MyClass.AssertWithFailureMessage() in d:\temp\test\..\GallioTest\MyClass.cs:line 46"; |
||||
Assert.AreEqual(expectedStackTrace, gallioTestResult.StackTrace); |
||||
} |
||||
|
||||
[Test] |
||||
public void TestResultHasExpectedName() |
||||
{ |
||||
Assert.AreEqual("MyNamespace.MyTests", gallioTestResult.Name); |
||||
} |
||||
|
||||
[Test] |
||||
public void StackTraceFilePositionFileNameMatchesLastFileNameInStackTrace() |
||||
{ |
||||
string expectedFileName = @"d:\temp\GallioTest\MyClass.cs"; |
||||
Assert.AreEqual(expectedFileName, gallioTestResult.StackTraceFilePosition.FileName); |
||||
} |
||||
|
||||
[Test] |
||||
public void StackTraceFilePositionLineNumberIs46WhichIsEqualToReportedErrorLine() |
||||
{ |
||||
Assert.AreEqual(46, gallioTestResult.StackTraceFilePosition.Line); |
||||
} |
||||
|
||||
[Test] |
||||
public void StackTraceFilePositionColumnNumberIsOne() |
||||
{ |
||||
Assert.AreEqual(1, gallioTestResult.StackTraceFilePosition.Column); |
||||
} |
||||
|
||||
[Test] |
||||
public void ChangingStackTraceToEmptyStringSetsStackTraceFilePositionToEmpty() |
||||
{ |
||||
gallioTestResult.StackTraceFilePosition = new FilePosition("test.cs", 10, 2); |
||||
gallioTestResult.StackTrace = String.Empty; |
||||
Assert.IsTrue(gallioTestResult.StackTraceFilePosition.IsEmpty); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,91 @@
@@ -0,0 +1,91 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using Gallio.SharpDevelop; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using ICSharpCode.UnitTesting; |
||||
using NUnit.Framework; |
||||
using UnitTesting.Tests.Utils; |
||||
|
||||
namespace Gallio.SharpDevelop.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class GallioTestFrameworkIsTestClassTests |
||||
{ |
||||
GallioTestFramework testFramework; |
||||
|
||||
[SetUp] |
||||
public void Init() |
||||
{ |
||||
testFramework = new GallioTestFramework(); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsTestClassReturnsFalseHasClassHasNoAttributes() |
||||
{ |
||||
MockClass mockClass = MockClass.CreateMockClassWithoutAnyAttributes(); |
||||
Assert.IsFalse(testFramework.IsTestClass(mockClass)); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsTestClassReturnsTrueHasClassHasTestFixtureAttributeMissingAttributePart() |
||||
{ |
||||
MockAttribute testAttribute = new MockAttribute("TestFixture"); |
||||
MockClass mockClass = MockClass.CreateMockClassWithAttribute(testAttribute); |
||||
Assert.IsTrue(testFramework.IsTestClass(mockClass)); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsTestClassReturnsTrueHasClassHasTestFixtureAttribute() |
||||
{ |
||||
MockAttribute testFixtureAttribute = new MockAttribute("TestFixtureAttribute"); |
||||
MockClass mockClass = MockClass.CreateMockClassWithAttribute(testFixtureAttribute); |
||||
Assert.IsTrue(testFramework.IsTestClass(mockClass)); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsTestClassReturnsTrueHasClassHasFullyQualifiedNUnitTestFixtureAttribute() |
||||
{ |
||||
MockAttribute testFixtureAttribute = new MockAttribute("MbUnit.Framework.TestFixtureAttribute"); |
||||
MockClass mockClass = MockClass.CreateMockClassWithAttribute(testFixtureAttribute); |
||||
Assert.IsTrue(testFramework.IsTestClass(mockClass)); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsTestClassReturnsFalseWhenClassIsNull() |
||||
{ |
||||
Assert.IsFalse(testFramework.IsTestClass(null)); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsTestClassReturnsFalseWhenProjectContentLanguageIsNull() |
||||
{ |
||||
IProject project = new MockCSharpProject(); |
||||
MockProjectContent mockProjectContent = new MockProjectContent(); |
||||
mockProjectContent.Project = project; |
||||
MockClass mockClass = new MockClass(mockProjectContent); |
||||
|
||||
Assert.IsFalse(testFramework.IsTestClass(mockClass)); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsTestClassReturnsFalseWhenProjectContentLanguageNameComparerIsNull() |
||||
{ |
||||
IProject project = new MockCSharpProject(); |
||||
MockProjectContent mockProjectContent = new MockProjectContent(); |
||||
mockProjectContent.Project = project; |
||||
mockProjectContent.Language = new LanguageProperties(null); |
||||
MockClass mockClass = new MockClass(mockProjectContent); |
||||
mockClass.Attributes.Add(new MockAttribute("Test")); |
||||
|
||||
Assert.IsFalse(testFramework.IsTestClass(mockClass)); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,127 @@
@@ -0,0 +1,127 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using Gallio.SharpDevelop; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using ICSharpCode.UnitTesting; |
||||
using NUnit.Framework; |
||||
using UnitTesting.Tests.Utils; |
||||
|
||||
namespace Gallio.SharpDevelop.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class GallioTestFrameworkIsTestMethodTests |
||||
{ |
||||
GallioTestFramework testFramework; |
||||
|
||||
[SetUp] |
||||
public void Init() |
||||
{ |
||||
testFramework = new GallioTestFramework(); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsTestMethodReturnsFalseWhenMethodHasNoAttributes() |
||||
{ |
||||
MockMethod mockMethod = MockMethod.CreateMockMethodWithoutAnyAttributes(); |
||||
Assert.IsFalse(testFramework.IsTestMethod(mockMethod)); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsTestMethodReturnsTrueWhenMethodHasTestAttributeWithoutAttributePart() |
||||
{ |
||||
MockAttribute testAttribute = new MockAttribute("Test"); |
||||
MockMethod mockMethod = MockMethod.CreateMockMethodWithAttribute(testAttribute); |
||||
Assert.IsTrue(testFramework.IsTestMethod(mockMethod)); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsTestMethodReturnsTrueWhenMethodHasTestAttributeAttribute() |
||||
{ |
||||
MockAttribute testAttribute = new MockAttribute("TestAttribute"); |
||||
MockMethod mockMethod = MockMethod.CreateMockMethodWithAttribute(testAttribute); |
||||
Assert.IsTrue(testFramework.IsTestMethod(mockMethod)); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsTestMethodReturnsTrueWhenMethodHasFullyQualifiedNUnitTestAttribute() |
||||
{ |
||||
MockAttribute testAttribute = new MockAttribute("MbUnit.Framework.TestAttribute"); |
||||
MockMethod mockMethod = MockMethod.CreateMockMethodWithAttribute(testAttribute); |
||||
Assert.IsTrue(testFramework.IsTestMethod(mockMethod)); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsTestMethodReturnsFalseWhenMethodIsNull() |
||||
{ |
||||
Assert.IsFalse(testFramework.IsTestMethod(null)); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsTestMethodReturnsFalseWhenProjectContentLanguageHasNullNameComparer() |
||||
{ |
||||
IProject project = new MockCSharpProject(); |
||||
MockProjectContent mockProjectContent = new MockProjectContent(); |
||||
mockProjectContent.Project = project; |
||||
mockProjectContent.Language = new LanguageProperties(null); |
||||
MockClass mockClass = new MockClass(mockProjectContent); |
||||
MockMethod mockMethod = new MockMethod(mockClass); |
||||
mockMethod.Attributes.Add(new MockAttribute("Test")); |
||||
|
||||
Assert.IsFalse(testFramework.IsTestMethod(mockMethod)); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Even if the project is null the method should be
|
||||
/// flagged as a TestMethod.
|
||||
/// </summary>
|
||||
[Test] |
||||
public void IsTestMethodReturnsTrueWhenProjectIsNull() |
||||
{ |
||||
MockAttribute testAttribute = new MockAttribute("Test"); |
||||
MockMethod mockMethod = MockMethod.CreateMockMethodWithAttribute(testAttribute); |
||||
MockProjectContent mockProjectContent = (MockProjectContent)mockMethod.DeclaringType.ProjectContent; |
||||
mockProjectContent.Project = null; |
||||
|
||||
Assert.IsTrue(testFramework.IsTestMethod(mockMethod)); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsTestMethodReturnsFalseWhenMethodHasNullDeclaringType() |
||||
{ |
||||
MockMethod mockMethod = new MockMethod(new MockClass()); |
||||
|
||||
Assert.IsFalse(testFramework.IsTestMethod(mockMethod)); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsTestMethodReturnsFalseWhenMethodHasNullLanguage() |
||||
{ |
||||
IProject project = new MockCSharpProject(); |
||||
MockProjectContent mockProjectContent = new MockProjectContent(); |
||||
mockProjectContent.Project = project; |
||||
MockClass mockClass = new MockClass(mockProjectContent); |
||||
MockMethod mockMethod = new MockMethod(mockClass); |
||||
|
||||
Assert.IsFalse(testFramework.IsTestMethod(mockMethod)); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsTestMethodReturnsFalseWhenMethodHasHasParameters() |
||||
{ |
||||
MockAttribute testAttribute = new MockAttribute("Test"); |
||||
MockMethod mockMethod = MockMethod.CreateMockMethodWithAttribute(testAttribute); |
||||
MockParameter mockParameter = new MockParameter(); |
||||
mockMethod.Parameters.Add(mockParameter); |
||||
|
||||
Assert.IsFalse(testFramework.IsTestMethod(mockMethod)); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,97 @@
@@ -0,0 +1,97 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using Gallio.SharpDevelop; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using ICSharpCode.UnitTesting; |
||||
using NUnit.Framework; |
||||
using UnitTesting.Tests.Utils; |
||||
|
||||
namespace Gallio.SharpDevelop.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class GallioTestFrameworkIsTestProjectTests |
||||
{ |
||||
GallioTestFramework testFramework; |
||||
|
||||
[SetUp] |
||||
public void Init() |
||||
{ |
||||
testFramework = new GallioTestFramework(); |
||||
} |
||||
|
||||
[Test] |
||||
public void GallioTestFrameworkImplementsITestFramework() |
||||
{ |
||||
Assert.IsNotNull(testFramework as ITestFramework); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsTestProjectReturnsFalseForNullProject() |
||||
{ |
||||
Assert.IsFalse(testFramework.IsTestProject(null)); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsTestProjectReturnsTrueForProjectWithMbUnitFrameworkAssemblyReference() |
||||
{ |
||||
MockCSharpProject project = new MockCSharpProject(); |
||||
|
||||
ReferenceProjectItem systemRef = new ReferenceProjectItem(project, "System"); |
||||
ProjectService.AddProjectItem(project, systemRef); |
||||
|
||||
ReferenceProjectItem nunitFrameworkRef = new ReferenceProjectItem(project, "MbUnit"); |
||||
ProjectService.AddProjectItem(project, nunitFrameworkRef); |
||||
|
||||
Assert.IsTrue(testFramework.IsTestProject(project)); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsTestProjectReturnsFalseForProjectWithoutMbUnitFrameworkAssemblyReference() |
||||
{ |
||||
MockCSharpProject project = new MockCSharpProject(); |
||||
Assert.IsFalse(testFramework.IsTestProject(project)); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsTestProjectReturnsTrueForProjectWithMbUnitFrameworkAssemblyReferenceIgnoringCase() |
||||
{ |
||||
MockCSharpProject project = new MockCSharpProject(); |
||||
|
||||
ReferenceProjectItem nunitFrameworkRef = new ReferenceProjectItem(project, "MBUNIT"); |
||||
ProjectService.AddProjectItem(project, nunitFrameworkRef); |
||||
|
||||
Assert.IsTrue(testFramework.IsTestProject(project)); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsTestProjectReturnsTrueForProjectWithMbUnitFrameworkAssemblyReferenceIgnoringNonReferenceProjectItems() |
||||
{ |
||||
MockCSharpProject project = new MockCSharpProject(); |
||||
|
||||
FileProjectItem fileItem = new FileProjectItem(project, ItemType.Compile, "test.cs"); |
||||
ProjectService.AddProjectItem(project, fileItem); |
||||
|
||||
ReferenceProjectItem nunitFrameworkRef = new ReferenceProjectItem(project, "mbunit"); |
||||
ProjectService.AddProjectItem(project, nunitFrameworkRef); |
||||
|
||||
Assert.IsTrue(testFramework.IsTestProject(project)); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsTestProjectReturnsTrueForProjectWithMbUnitFrameworkAssemblyReferenceUsingFullName() |
||||
{ |
||||
MockCSharpProject project = new MockCSharpProject(); |
||||
string assemblyName = "mbunit, Version=2.5.3.9345, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77"; |
||||
ReferenceProjectItem mbunitFrameworkRef = new ReferenceProjectItem(project, assemblyName); |
||||
ProjectService.AddProjectItem(project, mbunitFrameworkRef); |
||||
|
||||
Assert.IsTrue(testFramework.IsTestProject(project)); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,155 @@
@@ -0,0 +1,155 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using Model = Gallio.Model; |
||||
using Gallio.Extension; |
||||
using Gallio.Runner.Events; |
||||
using Gallio.SharpDevelop; |
||||
using Gallio.SharpDevelop.Tests.Utils; |
||||
using NUnit.Framework; |
||||
|
||||
namespace Gallio.SharpDevelop.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class GallioTestToSharpDevelopTestResultConversionTests |
||||
{ |
||||
GallioTestStepFinishedEventArgsFactory factory; |
||||
TestStepFinishedEventArgs testStepEventArgs; |
||||
GallioTestStepConverter converter; |
||||
TestResult testResult; |
||||
|
||||
[SetUp] |
||||
public void Init() |
||||
{ |
||||
factory = new GallioTestStepFinishedEventArgsFactory(); |
||||
} |
||||
|
||||
[Test] |
||||
public void GallioTestNameIsConvertedToSharpDevelopTestName() |
||||
{ |
||||
string gallioTestName = "MyNamespace/MyClass/MyTestMethod"; |
||||
CreateGallioTestStepEventArgs(gallioTestName); |
||||
ConvertToSharpDevelopTestResult(); |
||||
|
||||
string expectedTestName = "MyNamespace.MyClass.MyTestMethod"; |
||||
Assert.AreEqual(expectedTestName, testResult.Name); |
||||
} |
||||
|
||||
void CreateGallioTestStepEventArgs(string testName) |
||||
{ |
||||
testStepEventArgs = factory.Create(testName); |
||||
} |
||||
|
||||
void ConvertToSharpDevelopTestResult() |
||||
{ |
||||
converter = new GallioTestStepConverter(testStepEventArgs); |
||||
testResult = converter.GetTestResult(); |
||||
} |
||||
|
||||
[Test] |
||||
public void GallioTestOutcomePassedIsConvertedToSharpDevelopTestSuccess() |
||||
{ |
||||
CreateGallioTestStepEventArgs(); |
||||
UpdateGallioTestOutcomeToPassed(); |
||||
ConvertToSharpDevelopTestResult(); |
||||
|
||||
Assert.AreEqual(TestResultType.Success, testResult.ResultType); |
||||
} |
||||
|
||||
void CreateGallioTestStepEventArgs() |
||||
{ |
||||
CreateGallioTestStepEventArgs("MyNamespace.MyClass.MyTest"); |
||||
} |
||||
|
||||
void UpdateGallioTestOutcomeToPassed() |
||||
{ |
||||
UpdateGallioTestOutcome(Model.TestOutcome.Passed); |
||||
} |
||||
|
||||
void UpdateGallioTestOutcome(Model.TestOutcome testOutcome) |
||||
{ |
||||
testStepEventArgs.TestStepRun.Result.Outcome = testOutcome; |
||||
} |
||||
|
||||
[Test] |
||||
public void GallioTestOutcomeErrorIsConvertedToSharpDevelopTestFailure() |
||||
{ |
||||
CreateGallioTestStepEventArgs(); |
||||
UpdateGallioTestOutcomeToError(); |
||||
ConvertToSharpDevelopTestResult(); |
||||
|
||||
Assert.AreEqual(TestResultType.Failure, testResult.ResultType); |
||||
} |
||||
|
||||
void UpdateGallioTestOutcomeToError() |
||||
{ |
||||
UpdateGallioTestOutcome(Model.TestOutcome.Error); |
||||
} |
||||
|
||||
[Test] |
||||
public void GallioTestOutcomeSkippedIsConvertedToSharpDevelopTestIgnored() |
||||
{ |
||||
CreateGallioTestStepEventArgs(); |
||||
UpdateGallioTestOutcomeToSkipped(); |
||||
ConvertToSharpDevelopTestResult(); |
||||
|
||||
Assert.AreEqual(TestResultType.Ignored, testResult.ResultType); |
||||
} |
||||
|
||||
void UpdateGallioTestOutcomeToSkipped() |
||||
{ |
||||
UpdateGallioTestOutcome(Model.TestOutcome.Skipped); |
||||
} |
||||
|
||||
[Test] |
||||
public void GallioTestOutcomeInconclusiveIsConvertedToSharpDevelopTestIgnored() |
||||
{ |
||||
CreateGallioTestStepEventArgs(); |
||||
UpdateGallioTestOutcomeToInconclusive(); |
||||
ConvertToSharpDevelopTestResult(); |
||||
|
||||
Assert.AreEqual(TestResultType.Ignored, testResult.ResultType); |
||||
} |
||||
|
||||
void UpdateGallioTestOutcomeToInconclusive() |
||||
{ |
||||
UpdateGallioTestOutcome(Model.TestOutcome.Inconclusive); |
||||
} |
||||
|
||||
[Test] |
||||
public void GallioAssertionFailureMessageIsConvertedToSharpDevelopTestResultMessage() |
||||
{ |
||||
CreateGallioTestStepEventArgs(); |
||||
UpdateGallioTestOutcomeToError(); |
||||
UpdateGallioTestLogWithAssertionFailure(); |
||||
ConvertToSharpDevelopTestResult(); |
||||
|
||||
string expectedMessage = "Expected value to be true. User assertion message."; |
||||
Assert.AreEqual(expectedMessage, testResult.Message); |
||||
} |
||||
|
||||
void UpdateGallioTestLogWithAssertionFailure() |
||||
{ |
||||
GallioBodyTagFactory factory = new GallioBodyTagFactory(); |
||||
testStepEventArgs.TestStepRun.TestLog.Streams.Add(factory.CreateAssertionFailureStructuredStream()); |
||||
} |
||||
|
||||
[Test] |
||||
public void GallioAssertionFailureStackTraceIsConvertedToSharpDevelopTestResultStackTrace() |
||||
{ |
||||
CreateGallioTestStepEventArgs(); |
||||
UpdateGallioTestOutcomeToError(); |
||||
UpdateGallioTestLogWithAssertionFailure(); |
||||
ConvertToSharpDevelopTestResult(); |
||||
|
||||
string expectedStackTrace = |
||||
@" at GallioTest.MyClass.AssertWithFailureMessage() in d:\temp\test\GallioTest\MyClass.cs:line 46 "; |
||||
Assert.AreEqual(expectedStackTrace, testResult.StackTrace); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,126 @@
@@ -0,0 +1,126 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.IO; |
||||
using System.Text; |
||||
using Gallio.Extension; |
||||
using NUnit.Framework; |
||||
|
||||
namespace Gallio.SharpDevelop.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class TestResultsWriterTestFixture |
||||
{ |
||||
TestResultsWriter writer; |
||||
StringBuilder results; |
||||
|
||||
[SetUp] |
||||
public void Init() |
||||
{ |
||||
results = new StringBuilder(); |
||||
StringWriter stringWriter = new StringWriter(results); |
||||
writer = new TestResultsWriter(stringWriter); |
||||
} |
||||
|
||||
[TearDown] |
||||
public void TearDown() |
||||
{ |
||||
writer.Dispose(); |
||||
} |
||||
|
||||
[Test] |
||||
public void WriteSuccessTestResult() |
||||
{ |
||||
TestResult testResult = new TestResult("MyTests.MyTestClass.MyTestMethod"); |
||||
testResult.ResultType = TestResultType.Success; |
||||
writer.Write(testResult); |
||||
|
||||
string expectedText = |
||||
"Name: MyTests.MyTestClass.MyTestMethod\r\n" + |
||||
"Result: Success\r\n"; |
||||
|
||||
Assert.AreEqual(expectedText, results.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void WriteIgnoredTestResult() |
||||
{ |
||||
TestResult testResult = new TestResult("MyTests.MyTestClass.MyTestMethod"); |
||||
testResult.ResultType = TestResultType.Ignored; |
||||
writer.Write(testResult); |
||||
|
||||
string expectedText = |
||||
"Name: MyTests.MyTestClass.MyTestMethod\r\n" + |
||||
"Result: Ignored\r\n"; |
||||
|
||||
Assert.AreEqual(expectedText, results.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void WriteFailedTestResult() |
||||
{ |
||||
TestResult testResult = new TestResult("MyTests.MyTestClass.MyTestMethod"); |
||||
testResult.ResultType = TestResultType.Failure; |
||||
testResult.Message = "message"; |
||||
testResult.StackTrace = "stacktrace"; |
||||
writer.Write(testResult); |
||||
|
||||
string expectedText = |
||||
"Name: MyTests.MyTestClass.MyTestMethod\r\n" + |
||||
"Result: Failure\r\n" + |
||||
"Message: message\r\n" + |
||||
"StackTrace: stacktrace\r\n"; |
||||
|
||||
Assert.AreEqual(expectedText, results.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void WriteFailedTestResultWithTwoLineMessage() |
||||
{ |
||||
TestResult testResult = new TestResult("MyTests.MyTestClass.MyTestMethod"); |
||||
testResult.ResultType = TestResultType.Failure; |
||||
testResult.Message = "first\r\n" + |
||||
"second"; |
||||
testResult.StackTrace = "stacktrace"; |
||||
writer.Write(testResult); |
||||
|
||||
string expectedText = |
||||
"Name: MyTests.MyTestClass.MyTestMethod\r\n" + |
||||
"Result: Failure\r\n" + |
||||
"Message: first\r\n" + |
||||
" second\r\n" + |
||||
"StackTrace: stacktrace\r\n"; |
||||
|
||||
Assert.AreEqual(expectedText, results.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void WriteFailedTestResultWithThreeLineStackTrace() |
||||
{ |
||||
TestResult testResult = new TestResult("MyTests.MyTestClass.MyTestMethod"); |
||||
testResult.ResultType = TestResultType.Failure; |
||||
testResult.Message = "first\r\n" + |
||||
"second\r\n"; |
||||
testResult.StackTrace = "first\r\n" + |
||||
"second\r\n" + |
||||
"third\r\n"; |
||||
writer.Write(testResult); |
||||
|
||||
string expectedText = |
||||
"Name: MyTests.MyTestClass.MyTestMethod\r\n" + |
||||
"Result: Failure\r\n" + |
||||
"Message: first\r\n" + |
||||
" second\r\n" + |
||||
"StackTrace: first\r\n" + |
||||
" second\r\n" + |
||||
" third\r\n"; |
||||
|
||||
Assert.AreEqual(expectedText, results.ToString()); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,71 @@
@@ -0,0 +1,71 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using Gallio.Extension; |
||||
using Gallio.Runtime.Logging; |
||||
using Gallio.SharpDevelop.Tests.Utils; |
||||
using ICSharpCode.UnitTesting; |
||||
using NUnit.Framework; |
||||
|
||||
namespace Gallio.SharpDevelop.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class TestRunnerExtensionTestFixture |
||||
{ |
||||
SharpDevelopTestRunnerExtension testRunnerExtension; |
||||
MockTestResultsWriterFactory factory; |
||||
MockTestRunnerEvents testRunnerEvents; |
||||
MockTestResultsWriter writer; |
||||
NullLogger logger; |
||||
|
||||
[SetUp] |
||||
public void Init() |
||||
{ |
||||
testRunnerEvents = new MockTestRunnerEvents(); |
||||
logger = new NullLogger(); |
||||
factory = new MockTestResultsWriterFactory(); |
||||
|
||||
testRunnerExtension = new SharpDevelopTestRunnerExtension(factory); |
||||
testRunnerExtension.Parameters = @"c:\temp\tmp77.tmp"; |
||||
testRunnerExtension.Install(testRunnerEvents, logger); |
||||
|
||||
writer = factory.TestResultsWriter; |
||||
} |
||||
|
||||
[Test] |
||||
public void TestResultWriterCreatedWithFileNameTakenFromTestRunnerExtensionParameters() |
||||
{ |
||||
string expectedFileName = @"c:\temp\tmp77.tmp"; |
||||
Assert.AreEqual(expectedFileName, writer.FileName); |
||||
} |
||||
|
||||
[Test] |
||||
public void FiringTestStepFinishedEventWritesTestResultNameToTestResultsWriter() |
||||
{ |
||||
string testName = "MyNamespace.MyTests.MyTestMethod"; |
||||
testRunnerEvents.FireTestStepFinishedEvent("MyNamespace.MyTests.MyTestMethod"); |
||||
|
||||
Assert.AreEqual(testName, writer.FirstTestResult.Name); |
||||
} |
||||
|
||||
[Test] |
||||
public void TestRunnerEventsDisposeStartedEventCausesTestResultsWriterToBeDisposed() |
||||
{ |
||||
testRunnerEvents.FireDisposeStartedEvent(); |
||||
Assert.IsTrue(writer.IsDisposed); |
||||
} |
||||
|
||||
[Test] |
||||
public void FiringTestStepFinishedEventWithNonTestCaseDoesNotWriteTestResultToTestResultsWriter() |
||||
{ |
||||
testRunnerEvents.FireTestStepFinishedEventForNonTestCase("MyNamespace.MyTests.MyTestMethod"); |
||||
|
||||
Assert.AreEqual(0, writer.TestResults.Count); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,93 @@
@@ -0,0 +1,93 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using Gallio.Model; |
||||
using Gallio.Common.Markup; |
||||
using Gallio.Common.Markup.Tags; |
||||
using Gallio.Common.Reflection; |
||||
|
||||
namespace Gallio.SharpDevelop.Tests.Utils |
||||
{ |
||||
public class GallioBodyTagFactory |
||||
{ |
||||
public StructuredStream CreateAssertionFailureStructuredStream() |
||||
{ |
||||
StructuredStream stream = new StructuredStream("Failures"); |
||||
stream.Body = CreateAssertionFailure(); |
||||
return stream; |
||||
} |
||||
|
||||
public BodyTag CreateAssertionFailure() |
||||
{ |
||||
BodyTag bodyTag = new BodyTag(); |
||||
bodyTag.Contents.Add(CreateAssertionFailureMarkerTag()); |
||||
return bodyTag; |
||||
} |
||||
|
||||
MarkerTag CreateAssertionFailureMarkerTag() |
||||
{ |
||||
MarkerTag markerTag = new MarkerTag(Marker.AssertionFailure); |
||||
markerTag.Contents.Add(CreateAssertionFailureSectionTag()); |
||||
return markerTag; |
||||
} |
||||
|
||||
SectionTag CreateAssertionFailureSectionTag() |
||||
{ |
||||
SectionTag sectionTag = new SectionTag("Expected value to be true."); |
||||
sectionTag.Contents.Add(CreateUserAssertionMessageTextTag()); |
||||
sectionTag.Contents.Add(CreateMonospaceMarkerTag()); |
||||
sectionTag.Contents.Add(CreateEmptyTextTag()); |
||||
sectionTag.Contents.Add(CreateStackTraceMarkerTag()); |
||||
return sectionTag; |
||||
} |
||||
|
||||
TextTag CreateUserAssertionMessageTextTag() |
||||
{ |
||||
return new TextTag("User assertion message."); |
||||
} |
||||
|
||||
MarkerTag CreateMonospaceMarkerTag() |
||||
{ |
||||
return new MarkerTag(Marker.Monospace); |
||||
} |
||||
|
||||
TextTag CreateEmptyTextTag() |
||||
{ |
||||
return new TextTag(String.Empty); |
||||
} |
||||
|
||||
MarkerTag CreateStackTraceMarkerTag() |
||||
{ |
||||
MarkerTag markerTag = new MarkerTag(Marker.StackTrace); |
||||
markerTag.Contents.Add(CreateStackTraceTextTag()); |
||||
markerTag.Contents.Add(CreateCodeLocationMarkerTag()); |
||||
return markerTag; |
||||
} |
||||
|
||||
TextTag CreateStackTraceTextTag() |
||||
{ |
||||
string text = " at GallioTest.MyClass.AssertWithFailureMessage() in "; |
||||
return new TextTag(text); |
||||
} |
||||
|
||||
MarkerTag CreateCodeLocationMarkerTag() |
||||
{ |
||||
CodeLocation location = new CodeLocation(); |
||||
Marker marker = Marker.CodeLocation(location); |
||||
MarkerTag markerTag = new MarkerTag(marker); |
||||
markerTag.Contents.Add(CreateCodeLocationTextTag()); |
||||
return markerTag; |
||||
} |
||||
|
||||
TextTag CreateCodeLocationTextTag() |
||||
{ |
||||
string text = @"d:\temp\test\GallioTest\MyClass.cs:line 46 "; |
||||
return new TextTag(text); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,52 @@
@@ -0,0 +1,52 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using ICSharpCode.UnitTesting; |
||||
using Gallio.Model.Schema; |
||||
using Gallio.Runner.Events; |
||||
using Gallio.Runner.Reports.Schema; |
||||
|
||||
namespace Gallio.SharpDevelop.Tests.Utils |
||||
{ |
||||
public class GallioTestStepFinishedEventArgsFactory |
||||
{ |
||||
TestData gallioTest; |
||||
Report gallioReport = new Report(); |
||||
TestStepRun gallioTestStepRun; |
||||
|
||||
public TestStepFinishedEventArgs Create(string name) |
||||
{ |
||||
CreateTestData(name); |
||||
CreateTestStepRun(); |
||||
return CreateTestStepFinishedEventArgs(); |
||||
} |
||||
|
||||
void CreateTestData(string name) |
||||
{ |
||||
string gallioTestName = ConvertToGallioTestName(name); |
||||
gallioTest = new TestData("a", "b", gallioTestName); |
||||
gallioTest.IsTestCase = true; |
||||
} |
||||
|
||||
void CreateTestStepRun() |
||||
{ |
||||
TestStepData testStepData = new TestStepData("a", "b", "c", "d"); |
||||
gallioTestStepRun = new TestStepRun(testStepData); |
||||
} |
||||
|
||||
string ConvertToGallioTestName(string name) |
||||
{ |
||||
return name.Replace('.', '/'); |
||||
} |
||||
|
||||
TestStepFinishedEventArgs CreateTestStepFinishedEventArgs() |
||||
{ |
||||
return new TestStepFinishedEventArgs(gallioReport, gallioTest, gallioTestStepRun); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,52 @@
@@ -0,0 +1,52 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using Gallio.Extension; |
||||
using System.Collections.Generic; |
||||
|
||||
namespace Gallio.SharpDevelop.Tests.Utils |
||||
{ |
||||
public class MockTestResultsWriter : ITestResultsWriter |
||||
{ |
||||
string fileName = String.Empty; |
||||
List<TestResult> testResults = new List<TestResult>(); |
||||
bool disposed; |
||||
|
||||
public MockTestResultsWriter(string fileName) |
||||
{ |
||||
this.fileName = fileName; |
||||
} |
||||
|
||||
public string FileName { |
||||
get { return fileName; } |
||||
} |
||||
|
||||
public void Write(TestResult testResult) |
||||
{ |
||||
testResults.Add(testResult); |
||||
} |
||||
|
||||
public List<TestResult> TestResults { |
||||
get { return testResults; } |
||||
} |
||||
|
||||
public TestResult FirstTestResult { |
||||
get { return testResults[0]; } |
||||
} |
||||
|
||||
public void Dispose() |
||||
{ |
||||
disposed = true; |
||||
} |
||||
|
||||
public bool IsDisposed { |
||||
get { return disposed; } |
||||
set { disposed = value; } |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,28 @@
@@ -0,0 +1,28 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using Gallio.Extension; |
||||
using Gallio.SharpDevelop; |
||||
|
||||
namespace Gallio.SharpDevelop.Tests.Utils |
||||
{ |
||||
public class MockTestResultsWriterFactory : ITestResultsWriterFactory |
||||
{ |
||||
MockTestResultsWriter testResultsWriter; |
||||
|
||||
public ITestResultsWriter Create(string fileName) |
||||
{ |
||||
testResultsWriter = new MockTestResultsWriter(fileName); |
||||
return testResultsWriter; |
||||
} |
||||
|
||||
public MockTestResultsWriter TestResultsWriter { |
||||
get { return testResultsWriter; } |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,76 @@
@@ -0,0 +1,76 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using ICSharpCode.UnitTesting; |
||||
using Gallio.Runner.Events; |
||||
|
||||
namespace Gallio.SharpDevelop.Tests.Utils |
||||
{ |
||||
public class MockTestRunnerEvents : ITestRunnerEvents |
||||
{ |
||||
#pragma warning disable 67
|
||||
|
||||
public event EventHandler<Gallio.Runtime.Logging.LogEntrySubmittedEventArgs> LogEntrySubmitted; |
||||
public event EventHandler<Gallio.Runner.Events.MessageReceivedEventArgs> MessageReceived; |
||||
public event EventHandler<InitializeStartedEventArgs> InitializeStarted; |
||||
public event EventHandler<InitializeFinishedEventArgs> InitializeFinished; |
||||
public event EventHandler<DisposeStartedEventArgs> DisposeStarted; |
||||
public event EventHandler<DisposeFinishedEventArgs> DisposeFinished; |
||||
public event EventHandler<ExploreStartedEventArgs> ExploreStarted; |
||||
public event EventHandler<ExploreFinishedEventArgs> ExploreFinished; |
||||
public event EventHandler<RunStartedEventArgs> RunStarted; |
||||
public event EventHandler<RunFinishedEventArgs> RunFinished; |
||||
public event EventHandler<TestDiscoveredEventArgs> TestDiscovered; |
||||
public event EventHandler<AnnotationDiscoveredEventArgs> AnnotationDiscovered; |
||||
public event EventHandler<TestStepStartedEventArgs> TestStepStarted; |
||||
public event EventHandler<TestStepFinishedEventArgs> TestStepFinished; |
||||
public event EventHandler<TestStepLifecyclePhaseChangedEventArgs> TestStepLifecyclePhaseChanged; |
||||
public event EventHandler<TestStepMetadataAddedEventArgs> TestStepMetadataAdded; |
||||
public event EventHandler<TestStepLogAttachEventArgs> TestStepLogAttach; |
||||
public event EventHandler<TestStepLogStreamWriteEventArgs> TestStepLogStreamWrite; |
||||
public event EventHandler<TestStepLogStreamEmbedEventArgs> TestStepLogStreamEmbed; |
||||
public event EventHandler<TestStepLogStreamBeginSectionBlockEventArgs> TestStepLogStreamBeginSectionBlock; |
||||
public event EventHandler<TestStepLogStreamBeginMarkerBlockEventArgs> TestStepLogStreamBeginMarkerBlock; |
||||
public event EventHandler<TestStepLogStreamEndBlockEventArgs> TestStepLogStreamEndBlock; |
||||
|
||||
#pragma warning restore 67
|
||||
|
||||
public void FireTestStepFinishedEvent(string name) |
||||
{ |
||||
TestStepFinishedEventArgs e = CreateTestStepFinishedEventArgs(name); |
||||
FireTestStepFinishedEvent(e); |
||||
} |
||||
|
||||
TestStepFinishedEventArgs CreateTestStepFinishedEventArgs(string testName) |
||||
{ |
||||
GallioTestStepFinishedEventArgsFactory factory = new GallioTestStepFinishedEventArgsFactory(); |
||||
return factory.Create(testName); |
||||
} |
||||
|
||||
void FireTestStepFinishedEvent(TestStepFinishedEventArgs e) |
||||
{ |
||||
if (TestStepFinished != null) { |
||||
TestStepFinished(this, e); |
||||
} |
||||
} |
||||
|
||||
public void FireTestStepFinishedEventForNonTestCase(string testName) |
||||
{ |
||||
TestStepFinishedEventArgs e = CreateTestStepFinishedEventArgs(testName); |
||||
e.Test.IsTestCase = false; |
||||
FireTestStepFinishedEvent(e); |
||||
} |
||||
|
||||
public void FireDisposeStartedEvent() |
||||
{ |
||||
if (DisposeStarted != null) { |
||||
DisposeStarted(this, new DisposeStartedEventArgs()); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,175 @@
@@ -0,0 +1,175 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using Gallio.Common.Markup; |
||||
using Gallio.Common.Markup.Tags; |
||||
using Gallio.SharpDevelop.Tests.Utils; |
||||
using NUnit.Framework; |
||||
|
||||
namespace Gallio.SharpDevelop.Tests.Utils.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class CreateAssertionFailureBodyTagTestFixture |
||||
{ |
||||
StructuredStream structuredStream; |
||||
BodyTag bodyTag; |
||||
MarkerTag assertionFailureMarkerTag; |
||||
SectionTag expectedValueToBeTrueSectionTag; |
||||
TextTag expectedValueToBeTrueTextTag; |
||||
MarkerTag monoSpaceMarkerTag; |
||||
TextTag textTagAfterMonoSpaceMarkerTag; |
||||
MarkerTag stackTraceMarkerTag; |
||||
TextTag stackTraceTextTag; |
||||
MarkerTag codeLocationMarkerTag; |
||||
TextTag codeLocationTextTag; |
||||
|
||||
[SetUp] |
||||
public void Init() |
||||
{ |
||||
GallioBodyTagFactory factory = new GallioBodyTagFactory(); |
||||
structuredStream = factory.CreateAssertionFailureStructuredStream(); |
||||
bodyTag = structuredStream.Body; |
||||
assertionFailureMarkerTag = GetFirstChildMarkerTag(bodyTag); |
||||
expectedValueToBeTrueSectionTag = GetFirstChildSectionTag(assertionFailureMarkerTag); |
||||
expectedValueToBeTrueTextTag = GetFirstChildTextTag(expectedValueToBeTrueSectionTag); |
||||
monoSpaceMarkerTag = GetSecondChildMarkerTag(expectedValueToBeTrueSectionTag); |
||||
textTagAfterMonoSpaceMarkerTag = GetThirdChildTextTag(expectedValueToBeTrueSectionTag); |
||||
stackTraceMarkerTag = GetFourthChildMarkerTag(expectedValueToBeTrueSectionTag); |
||||
stackTraceTextTag = GetFirstChildTextTag(stackTraceMarkerTag); |
||||
codeLocationMarkerTag = GetSecondChildMarkerTag(stackTraceMarkerTag); |
||||
codeLocationTextTag = GetFirstChildTextTag(codeLocationMarkerTag); |
||||
} |
||||
|
||||
MarkerTag GetFirstChildMarkerTag(ContainerTag parentTag) |
||||
{ |
||||
return GetFirstChildTag(parentTag) as MarkerTag; |
||||
} |
||||
|
||||
Tag GetFirstChildTag(ContainerTag parentTag) |
||||
{ |
||||
return GetChildTagAtPosition(parentTag, 1); |
||||
} |
||||
|
||||
Tag GetChildTagAtPosition(ContainerTag parentTag, int position) |
||||
{ |
||||
if (TagHasChildTagAtPosition(parentTag, position)) { |
||||
int index = position - 1; |
||||
return parentTag.Contents[index]; |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
bool TagHasChildTagAtPosition(ContainerTag tag, int position) |
||||
{ |
||||
if (tag != null) { |
||||
return tag.Contents.Count >= position; |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
SectionTag GetFirstChildSectionTag(ContainerTag parentTag) |
||||
{ |
||||
return GetFirstChildTag(parentTag) as SectionTag; |
||||
} |
||||
|
||||
TextTag GetFirstChildTextTag(ContainerTag parentTag) |
||||
{ |
||||
return GetFirstChildTag(parentTag) as TextTag; |
||||
} |
||||
|
||||
MarkerTag GetSecondChildMarkerTag(ContainerTag parentTag) |
||||
{ |
||||
return GetSecondChildTag(parentTag) as MarkerTag; |
||||
} |
||||
|
||||
Tag GetSecondChildTag(ContainerTag parentTag) |
||||
{ |
||||
return GetChildTagAtPosition(parentTag, 2); |
||||
} |
||||
|
||||
TextTag GetThirdChildTextTag(ContainerTag parentTag) |
||||
{ |
||||
return GetChildTagAtPosition(parentTag, 3) as TextTag; |
||||
} |
||||
|
||||
MarkerTag GetFourthChildMarkerTag(ContainerTag parentTag) |
||||
{ |
||||
return GetChildTagAtPosition(parentTag, 4) as MarkerTag; |
||||
} |
||||
|
||||
[Test] |
||||
public void StructuredStreamNameIsFailures() |
||||
{ |
||||
Assert.AreEqual("Failures", structuredStream.Name); |
||||
} |
||||
|
||||
[Test] |
||||
public void BodyTagHasOneChildTag() |
||||
{ |
||||
Assert.AreEqual(1, bodyTag.Contents.Count); |
||||
} |
||||
|
||||
[Test] |
||||
public void BodyTagChildIsMarkerTagWithClassSetToAssertionFailure() |
||||
{ |
||||
Assert.AreEqual("AssertionFailure", assertionFailureMarkerTag.Class); |
||||
} |
||||
|
||||
[Test] |
||||
public void AssertionFailureMarkerTagHasSectionTagContentsWithTagNameEqualToExpectedValueToBeTrue() |
||||
{ |
||||
string expectedName = "Expected value to be true."; |
||||
Assert.AreEqual(expectedName, expectedValueToBeTrueSectionTag.Name); |
||||
} |
||||
|
||||
[Test] |
||||
public void ExpectedValueToBeTrueSectionTagHasTextTagChildWithTextSetToUserAssertionMessage() |
||||
{ |
||||
string expectedText = "User assertion message."; |
||||
Assert.AreEqual(expectedText, expectedValueToBeTrueTextTag.Text); |
||||
} |
||||
|
||||
[Test] |
||||
public void ExpectedValueToBeTrueSectionTagHasMarkerTagChildWithClassSetToMonospace() |
||||
{ |
||||
Assert.AreEqual("Monospace", monoSpaceMarkerTag.Class); |
||||
} |
||||
|
||||
[Test] |
||||
public void ExpectedValueToBeTrueSectionTagHasTextTagChildAfterMonospaceTagChild() |
||||
{ |
||||
Assert.IsNotNull(textTagAfterMonoSpaceMarkerTag); |
||||
} |
||||
|
||||
[Test] |
||||
public void ExpectedValueToBeTrueSectionTagHasMarkerTagWithClassSetToStackTrace() |
||||
{ |
||||
Assert.AreEqual("StackTrace", stackTraceMarkerTag.Class); |
||||
} |
||||
|
||||
[Test] |
||||
public void StackTraceTagHasFirstChildTextTagWithFirstLineOfStackTrace() |
||||
{ |
||||
string expectedText = " at GallioTest.MyClass.AssertWithFailureMessage() in "; |
||||
Assert.AreEqual(expectedText, stackTraceTextTag.Text); |
||||
} |
||||
|
||||
[Test] |
||||
public void StackTraceTagHasMarkerTagChildWithClassSetToCodeLocation() |
||||
{ |
||||
Assert.AreEqual("CodeLocation", codeLocationMarkerTag.Class); |
||||
} |
||||
|
||||
[Test] |
||||
public void CodeLocationMarkerHasTextTagWithCodeLocationText() |
||||
{ |
||||
string expectedText = @"d:\temp\test\GallioTest\MyClass.cs:line 46 "; |
||||
Assert.AreEqual(expectedText, codeLocationTextTag.Text); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,82 @@
@@ -0,0 +1,82 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using Gallio.Extension; |
||||
using Gallio.SharpDevelop.Tests.Utils; |
||||
using NUnit.Framework; |
||||
|
||||
namespace Gallio.SharpDevelop.Tests.Utils.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class MockTestResultsWriterFactoryTests |
||||
{ |
||||
MockTestResultsWriterFactory factory; |
||||
|
||||
[SetUp] |
||||
public void Init() |
||||
{ |
||||
factory = new MockTestResultsWriterFactory(); |
||||
} |
||||
|
||||
[Test] |
||||
public void TestResultsWritersSavedByFactory() |
||||
{ |
||||
ITestResultsWriter writer = factory.Create("testresults.txt"); |
||||
Assert.AreEqual(writer, factory.TestResultsWriter); |
||||
} |
||||
|
||||
[Test] |
||||
public void TestResultsWriterCreatedIsMockTestResultsWriter() |
||||
{ |
||||
MockTestResultsWriter writer = factory.Create("abc.txt") as MockTestResultsWriter; |
||||
Assert.IsNotNull(writer); |
||||
} |
||||
|
||||
[Test] |
||||
public void TestResultsWriterCreatedWithFileNamePassedToFactoryCreateMethod() |
||||
{ |
||||
MockTestResultsWriter writer = factory.Create("testresults.txt") as MockTestResultsWriter; |
||||
Assert.AreEqual("testresults.txt", writer.FileName); |
||||
} |
||||
|
||||
[Test] |
||||
public void TestResultsWriterSavesTestResultsWritten() |
||||
{ |
||||
TestResult firstResult = new TestResult("test1"); |
||||
TestResult secondResult = new TestResult("test2"); |
||||
MockTestResultsWriter writer = factory.Create("testresults.txt") as MockTestResultsWriter; |
||||
writer.Write(firstResult); |
||||
writer.Write(secondResult); |
||||
|
||||
TestResult[] expectedTestResults = new TestResult[] { firstResult, secondResult }; |
||||
|
||||
Assert.AreEqual(expectedTestResults, writer.TestResults.ToArray()); |
||||
} |
||||
|
||||
[Test] |
||||
public void FirstTestResultsWriterReturnsFirstTestResultsWriter() |
||||
{ |
||||
TestResult firstResult = new TestResult("test1"); |
||||
TestResult secondResult = new TestResult("test2"); |
||||
MockTestResultsWriter writer = factory.Create("testresults.txt") as MockTestResultsWriter; |
||||
writer.Write(firstResult); |
||||
writer.Write(secondResult); |
||||
|
||||
Assert.AreEqual(firstResult, writer.FirstTestResult); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsDisposedCalledReturnsTrueAfterDisposeMethodCalled() |
||||
{ |
||||
MockTestResultsWriter writer = factory.Create("testresults.txt") as MockTestResultsWriter; |
||||
writer.IsDisposed = false; |
||||
writer.Dispose(); |
||||
Assert.IsTrue(writer.IsDisposed); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,69 @@
@@ -0,0 +1,69 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using ICSharpCode.UnitTesting; |
||||
using Gallio.Runner.Events; |
||||
using Gallio.SharpDevelop.Tests.Utils; |
||||
using NUnit.Framework; |
||||
|
||||
namespace Gallio.SharpDevelop.Tests.Utils.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class MockTestRunnerEventsTestFixture |
||||
{ |
||||
MockTestRunnerEvents testRunnerEvents; |
||||
TestStepFinishedEventArgs testStepFinishedEventArgs; |
||||
|
||||
[SetUp] |
||||
public void Init() |
||||
{ |
||||
testRunnerEvents = new MockTestRunnerEvents(); |
||||
testRunnerEvents.TestStepFinished += delegate (object source, TestStepFinishedEventArgs e) { |
||||
testStepFinishedEventArgs = e; |
||||
}; |
||||
} |
||||
|
||||
[Test] |
||||
public void FireTestStepFinishedEventWithTestResultCreatesGallioTestDataWithExpectedFullName() |
||||
{ |
||||
testRunnerEvents.FireTestStepFinishedEvent("MyNamespace/MyTests/MyTestMethod"); |
||||
|
||||
string expectedFullName = "MyNamespace/MyTests/MyTestMethod"; |
||||
string actualFullName = testStepFinishedEventArgs.Test.FullName; |
||||
Assert.AreEqual(expectedFullName, actualFullName); |
||||
} |
||||
|
||||
[Test] |
||||
public void FireTestStepFinishedEventCreatesGallioTestDataWithIsTestCaseSetToTrue() |
||||
{ |
||||
testRunnerEvents.FireTestStepFinishedEvent("testName"); |
||||
|
||||
Assert.IsTrue(testStepFinishedEventArgs.Test.IsTestCase); |
||||
} |
||||
|
||||
[Test] |
||||
public void FireTestStepFinishedEventForNonTestCaseCreatesGallioTestDataIsTestCaseSetToFalse() |
||||
{ |
||||
testRunnerEvents.FireTestStepFinishedEventForNonTestCase("testName"); |
||||
|
||||
Assert.IsFalse(testStepFinishedEventArgs.Test.IsTestCase); |
||||
} |
||||
|
||||
[Test] |
||||
public void FireDisposeStartedEventTriggersEvent() |
||||
{ |
||||
DisposeStartedEventArgs eventArgs = null; |
||||
testRunnerEvents.DisposeStarted += delegate(object sender, DisposeStartedEventArgs e) { |
||||
eventArgs = e; |
||||
}; |
||||
testRunnerEvents.FireDisposeStartedEvent(); |
||||
|
||||
Assert.IsNotNull(eventArgs); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,30 @@
@@ -0,0 +1,30 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00 |
||||
# Visual Studio 2010 |
||||
# SharpDevelop 4.0.0.5840 |
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gallio.SharpDevelop", "Gallio.SharpDevelop\Gallio.SharpDevelop.csproj", "{88D3DC5E-8A91-4DCE-A785-CC37DE0AA0EC}" |
||||
EndProject |
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gallio.SharpDevelop.Tests", "Gallio.SharpDevelop.Tests\Gallio.SharpDevelop.Tests.csproj", "{3F6C539D-DB38-41B4-A5B3-B9A52AE607CD}" |
||||
EndProject |
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gallio.Extension", "Gallio.Extension\Gallio.Extension.csproj", "{98030C86-7B0F-4813-AC4D-9FFCF00CF81F}" |
||||
EndProject |
||||
Global |
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
||||
Debug|x86 = Debug|x86 |
||||
Release|x86 = Release|x86 |
||||
EndGlobalSection |
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
||||
{88D3DC5E-8A91-4DCE-A785-CC37DE0AA0EC}.Debug|x86.Build.0 = Debug|x86 |
||||
{88D3DC5E-8A91-4DCE-A785-CC37DE0AA0EC}.Debug|x86.ActiveCfg = Debug|x86 |
||||
{88D3DC5E-8A91-4DCE-A785-CC37DE0AA0EC}.Release|x86.Build.0 = Release|x86 |
||||
{88D3DC5E-8A91-4DCE-A785-CC37DE0AA0EC}.Release|x86.ActiveCfg = Release|x86 |
||||
{3F6C539D-DB38-41B4-A5B3-B9A52AE607CD}.Debug|x86.Build.0 = Debug|x86 |
||||
{3F6C539D-DB38-41B4-A5B3-B9A52AE607CD}.Debug|x86.ActiveCfg = Debug|x86 |
||||
{3F6C539D-DB38-41B4-A5B3-B9A52AE607CD}.Release|x86.Build.0 = Release|x86 |
||||
{3F6C539D-DB38-41B4-A5B3-B9A52AE607CD}.Release|x86.ActiveCfg = Release|x86 |
||||
{98030C86-7B0F-4813-AC4D-9FFCF00CF81F}.Debug|x86.Build.0 = Debug|x86 |
||||
{98030C86-7B0F-4813-AC4D-9FFCF00CF81F}.Debug|x86.ActiveCfg = Debug|x86 |
||||
{98030C86-7B0F-4813-AC4D-9FFCF00CF81F}.Release|x86.Build.0 = Release|x86 |
||||
{98030C86-7B0F-4813-AC4D-9FFCF00CF81F}.Release|x86.ActiveCfg = Release|x86 |
||||
EndGlobalSection |
||||
EndGlobal |
@ -0,0 +1,28 @@
@@ -0,0 +1,28 @@
|
||||
<AddIn name="Unit Testing Addin" |
||||
author="Matt Ward" |
||||
copyright="prj:///doc/copyright.txt" |
||||
description="Runs unit tests with Gallio inside SharpDevelop" |
||||
addInManagerHidden="preinstalled"> |
||||
|
||||
<Manifest> |
||||
<Identity name="ICSharpCode.Gallio"/> |
||||
<Dependency addin="SharpDevelop"/> |
||||
<Dependency addin="ICSharpCode.UnitTesting"/> |
||||
</Manifest> |
||||
|
||||
<Runtime> |
||||
<Import assembly="Gallio.SharpDevelop.dll"/> |
||||
<Import assembly="$ICSharpCode.UnitTesting/UnitTesting.dll"/> |
||||
</Runtime> |
||||
|
||||
<Path name="/SharpDevelop/UnitTesting/GallioEchoApplication"> |
||||
<String id="GallioEchoApplication" text="D:\projects\dotnet\mirador\SharpDevelop\samples\Gallio\Gallio\bin\Gallio.Echo.exe"/> |
||||
</Path> |
||||
|
||||
<Path name="/SharpDevelop/UnitTesting/TestFrameworks"> |
||||
<TestFramework id="gallio" |
||||
class="Gallio.SharpDevelop.GallioTestFramework" |
||||
supportedProjects=".csproj;.vbproj" |
||||
insertbefore="nunit" /> |
||||
</Path> |
||||
</AddIn> |
@ -0,0 +1,87 @@
@@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<PropertyGroup> |
||||
<ProjectGuid>{88D3DC5E-8A91-4DCE-A785-CC37DE0AA0EC}</ProjectGuid> |
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform> |
||||
<OutputType>Library</OutputType> |
||||
<RootNamespace>Gallio.SharpDevelop</RootNamespace> |
||||
<AssemblyName>Gallio.SharpDevelop</AssemblyName> |
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> |
||||
<AppDesignerFolder>Properties</AppDesignerFolder> |
||||
<SourceAnalysisOverrideSettingsFile>C:\Users\Matt\AppData\Roaming\ICSharpCode/SharpDevelop3.0\Settings.SourceAnalysis</SourceAnalysisOverrideSettingsFile> |
||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
||||
<NoStdLib>False</NoStdLib> |
||||
<WarningLevel>4</WarningLevel> |
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Platform)' == 'x86' "> |
||||
<PlatformTarget>x86</PlatformTarget> |
||||
<RegisterForComInterop>False</RegisterForComInterop> |
||||
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> |
||||
<BaseAddress>4194304</BaseAddress> |
||||
<FileAlignment>4096</FileAlignment> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
||||
<OutputPath>..\..\..\AddIns\Samples\Gallio</OutputPath> |
||||
<DebugSymbols>true</DebugSymbols> |
||||
<DebugType>Full</DebugType> |
||||
<Optimize>False</Optimize> |
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
||||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
||||
<OutputPath>..\..\..\AddIns\Samples\Gallio</OutputPath> |
||||
<DebugSymbols>false</DebugSymbols> |
||||
<DebugType>None</DebugType> |
||||
<Optimize>True</Optimize> |
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
||||
<DefineConstants>TRACE</DefineConstants> |
||||
</PropertyGroup> |
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> |
||||
<ItemGroup> |
||||
<Reference Include="Gallio"> |
||||
<HintPath>..\Gallio\bin\Gallio.dll</HintPath> |
||||
</Reference> |
||||
<Reference Include="ICSharpCode.Core"> |
||||
<HintPath>..\..\..\bin\ICSharpCode.Core.dll</HintPath> |
||||
<Private>False</Private> |
||||
</Reference> |
||||
<Reference Include="ICSharpCode.SharpDevelop"> |
||||
<HintPath>..\..\..\bin\ICSharpCode.SharpDevelop.dll</HintPath> |
||||
<Private>False</Private> |
||||
</Reference> |
||||
<Reference Include="ICSharpCode.SharpDevelop.Dom"> |
||||
<HintPath>..\..\..\bin\ICSharpCode.SharpDevelop.Dom.dll</HintPath> |
||||
<Private>False</Private> |
||||
</Reference> |
||||
<Reference Include="System" /> |
||||
<Reference Include="System.Xml" /> |
||||
<Reference Include="UnitTesting"> |
||||
<HintPath>..\..\..\AddIns\AddIns\Misc\UnitTesting\UnitTesting.dll</HintPath> |
||||
<Private>False</Private> |
||||
</Reference> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Compile Include="GallioEchoConsoleApplication.cs" /> |
||||
<Compile Include="GallioEchoConsoleApplicationFactory.cs" /> |
||||
<Compile Include="GallioEchoConsoleApplicationProcessStartInfo.cs" /> |
||||
<Compile Include="GallioTestDebugger.cs" /> |
||||
<Compile Include="GallioTestFramework.cs" /> |
||||
<Compile Include="GallioTestResult.cs" /> |
||||
<Compile Include="GallioTestRunner.cs" /> |
||||
<Compile Include="MbUnitTestAttributeName.cs" /> |
||||
<Compile Include="Properties\AssemblyInfo.cs" /> |
||||
<Compile Include="SharpDevelopTestRunnerExtensionCommandLineArgument.cs" /> |
||||
<Compile Include="TestRunnerExtensionCommandLineArgument.cs" /> |
||||
<None Include="Gallio.SharpDevelop.addin"> |
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
||||
</None> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<ProjectReference Include="..\Gallio.Extension\Gallio.Extension.csproj"> |
||||
<Project>{98030C86-7B0F-4813-AC4D-9FFCF00CF81F}</Project> |
||||
<Name>Gallio.Extension</Name> |
||||
</ProjectReference> |
||||
</ItemGroup> |
||||
</Project> |
@ -0,0 +1,96 @@
@@ -0,0 +1,96 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Diagnostics; |
||||
using System.Text; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.UnitTesting; |
||||
|
||||
namespace Gallio.SharpDevelop |
||||
{ |
||||
public class GallioEchoConsoleApplication |
||||
{ |
||||
string fileName = String.Empty; |
||||
SelectedTests selectedTests; |
||||
StringBuilder commandLine = new StringBuilder(); |
||||
List<TestRunnerExtensionCommandLineArgument> testRunnerExtensions = |
||||
new List<TestRunnerExtensionCommandLineArgument>(); |
||||
|
||||
public GallioEchoConsoleApplication(SelectedTests selectedTests, string fileName) |
||||
{ |
||||
this.selectedTests = selectedTests; |
||||
this.fileName = fileName; |
||||
} |
||||
|
||||
public GallioEchoConsoleApplication(SelectedTests selectedTests) |
||||
: this(selectedTests, String.Empty) |
||||
{ |
||||
} |
||||
|
||||
public string FileName { |
||||
get { return fileName; } |
||||
} |
||||
|
||||
public List<TestRunnerExtensionCommandLineArgument> TestRunnerExtensions { |
||||
get { return testRunnerExtensions; } |
||||
} |
||||
|
||||
public string GetArguments() |
||||
{ |
||||
AppendDotNet4Framework(); |
||||
AppendTestRunnerExtensions(); |
||||
AppendAssemblyToTest(); |
||||
|
||||
return commandLine.ToString().TrimEnd(); |
||||
} |
||||
|
||||
void AppendDotNet4Framework() |
||||
{ |
||||
AppendArgument("/rv:v4.0.30319"); |
||||
|
||||
} |
||||
|
||||
void AppendTestRunnerExtensions() |
||||
{ |
||||
foreach (TestRunnerExtensionCommandLineArgument arg in testRunnerExtensions) { |
||||
AppendArgument(arg.ToString()); |
||||
} |
||||
} |
||||
|
||||
void AppendArgument(string argument) |
||||
{ |
||||
commandLine.Append(argument); |
||||
commandLine.Append(' '); |
||||
} |
||||
|
||||
void AppendAssemblyToTest() |
||||
{ |
||||
AppendQuoted(selectedTests.Project.OutputAssemblyFullPath); |
||||
} |
||||
|
||||
void AppendQuoted(string argument) |
||||
{ |
||||
commandLine.AppendFormat("\"{0}\"", argument); |
||||
} |
||||
|
||||
public ProcessStartInfo GetProcessStartInfo() |
||||
{ |
||||
ProcessStartInfo startInfo = new ProcessStartInfo(); |
||||
startInfo.FileName = fileName; |
||||
startInfo.Arguments = GetArguments(); |
||||
startInfo.WorkingDirectory = GetWorkingDirectory(); |
||||
return startInfo; |
||||
} |
||||
|
||||
string GetWorkingDirectory() |
||||
{ |
||||
return StringParser.Parse("${addinpath:ICSharpCode.Gallio}"); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,41 @@
@@ -0,0 +1,41 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using ICSharpCode.UnitTesting; |
||||
|
||||
namespace Gallio.SharpDevelop |
||||
{ |
||||
public class GallioEchoConsoleApplicationFactory |
||||
{ |
||||
public static readonly string AddInTreePath = "/SharpDevelop/UnitTesting/GallioEchoApplication"; |
||||
|
||||
string gallioEchoConsoleApplicationFileName = "Gallio.Echo.exe"; |
||||
|
||||
public GallioEchoConsoleApplicationFactory() |
||||
: this(new UnitTestAddInTree()) |
||||
{ |
||||
} |
||||
|
||||
public GallioEchoConsoleApplicationFactory(IAddInTree addInTree) |
||||
{ |
||||
ReadFileName(addInTree); |
||||
} |
||||
|
||||
void ReadFileName(IAddInTree addInTree) |
||||
{ |
||||
List<string> items = addInTree.BuildItems<string>(AddInTreePath, this); |
||||
gallioEchoConsoleApplicationFileName = items[0]; |
||||
} |
||||
|
||||
public GallioEchoConsoleApplication Create(SelectedTests selectedTests) |
||||
{ |
||||
return new GallioEchoConsoleApplication(selectedTests, gallioEchoConsoleApplicationFileName); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,32 @@
@@ -0,0 +1,32 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Diagnostics; |
||||
using ICSharpCode.UnitTesting; |
||||
|
||||
namespace Gallio.SharpDevelop |
||||
{ |
||||
public class GallioEchoConsoleApplicationProcessStartInfo |
||||
{ |
||||
ProcessStartInfo processStartInfo = new ProcessStartInfo(); |
||||
|
||||
public GallioEchoConsoleApplicationProcessStartInfo(SelectedTests selectedTests, string testResultsFileName) |
||||
{ |
||||
GallioEchoConsoleApplicationFactory factory = new GallioEchoConsoleApplicationFactory(); |
||||
GallioEchoConsoleApplication app = factory.Create(selectedTests); |
||||
SharpDevelopTestRunnerExtensionCommandLineArgument argument = new SharpDevelopTestRunnerExtensionCommandLineArgument(); |
||||
argument.TestResultsFileName = testResultsFileName; |
||||
app.TestRunnerExtensions.Add(argument); |
||||
processStartInfo = app.GetProcessStartInfo(); |
||||
} |
||||
|
||||
public ProcessStartInfo ProcessStartInfo { |
||||
get { return processStartInfo; } |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,33 @@
@@ -0,0 +1,33 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Diagnostics; |
||||
using ICSharpCode.UnitTesting; |
||||
|
||||
namespace Gallio.SharpDevelop |
||||
{ |
||||
public class GallioTestDebugger : TestDebuggerBase |
||||
{ |
||||
public GallioTestDebugger() |
||||
{ |
||||
} |
||||
|
||||
protected override ProcessStartInfo GetProcessStartInfo(SelectedTests selectedTests) |
||||
{ |
||||
GallioEchoConsoleApplicationProcessStartInfo startInfo = |
||||
new GallioEchoConsoleApplicationProcessStartInfo(selectedTests, base.TestResultsMonitor.FileName); |
||||
startInfo.ProcessStartInfo.Arguments += " /d"; |
||||
return startInfo.ProcessStartInfo; |
||||
} |
||||
|
||||
protected override TestResult CreateTestResultForTestFramework(TestResult testResult) |
||||
{ |
||||
return new GallioTestResult(testResult); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,111 @@
@@ -0,0 +1,111 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using ICSharpCode.UnitTesting; |
||||
|
||||
namespace Gallio.SharpDevelop |
||||
{ |
||||
public class GallioTestFramework : ITestFramework |
||||
{ |
||||
public GallioTestFramework() |
||||
{ |
||||
} |
||||
|
||||
public bool IsTestProject(IProject project) |
||||
{ |
||||
if (project != null) { |
||||
foreach (ProjectItem projectItem in project.Items) { |
||||
ReferenceProjectItem referenceProjectItem = projectItem as ReferenceProjectItem; |
||||
if (IsMbUnitFrameworkAssemblyReference(referenceProjectItem)) { |
||||
return true; |
||||
} |
||||
} |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
bool IsMbUnitFrameworkAssemblyReference(ReferenceProjectItem referenceProjectItem) |
||||
{ |
||||
if (referenceProjectItem != null) { |
||||
string name = referenceProjectItem.ShortName; |
||||
return name.Equals("MbUnit", StringComparison.OrdinalIgnoreCase); |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
public ITestRunner CreateTestRunner() |
||||
{ |
||||
return new GallioTestRunner(); |
||||
} |
||||
|
||||
public ITestRunner CreateTestDebugger() |
||||
{ |
||||
return new GallioTestDebugger(); |
||||
} |
||||
|
||||
public bool IsTestClass(IClass c) |
||||
{ |
||||
StringComparer nameComparer = GetNameComparer(c); |
||||
if (nameComparer != null) { |
||||
MbUnitTestAttributeName testAttributeName = new MbUnitTestAttributeName("TestFixture", nameComparer); |
||||
foreach (IAttribute attribute in c.Attributes) { |
||||
if (testAttributeName.IsEqual(attribute)) { |
||||
return true; |
||||
} |
||||
} |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
StringComparer GetNameComparer(IClass c) |
||||
{ |
||||
if (c != null) { |
||||
IProjectContent projectContent = c.ProjectContent; |
||||
if (projectContent != null) { |
||||
LanguageProperties language = projectContent.Language; |
||||
if (language != null) { |
||||
return language.NameComparer; |
||||
} |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Determines whether the method is a test method. A method
|
||||
/// is considered to be a test method if it contains the NUnit Test attribute.
|
||||
/// If the method has parameters it cannot be a test method.
|
||||
/// </summary>
|
||||
public bool IsTestMethod(IMember member) |
||||
{ |
||||
if (member == null) { |
||||
return false; |
||||
} |
||||
|
||||
StringComparer nameComparer = GetNameComparer(member.DeclaringType); |
||||
if (nameComparer != null) { |
||||
MbUnitTestAttributeName testAttribute = new MbUnitTestAttributeName("Test", nameComparer); |
||||
foreach (IAttribute attribute in member.Attributes) { |
||||
if (testAttribute.IsEqual(attribute)) { |
||||
IMethod method = (IMethod)member; |
||||
if (method.Parameters.Count == 0) { |
||||
return true; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
public bool IsBuildNeededBeforeTestRun { |
||||
get { return true; } |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,54 @@
@@ -0,0 +1,54 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Text.RegularExpressions; |
||||
using System.IO; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.UnitTesting; |
||||
|
||||
namespace Gallio.SharpDevelop |
||||
{ |
||||
public class GallioTestResult : TestResult |
||||
{ |
||||
public GallioTestResult(TestResult testResult) |
||||
: base(testResult.Name) |
||||
{ |
||||
Message = testResult.Message; |
||||
ResultType = testResult.ResultType; |
||||
StackTrace = testResult.StackTrace; |
||||
} |
||||
|
||||
protected override void OnStackTraceChanged() |
||||
{ |
||||
GetFilePositionFromStackTrace(); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Stack trace:
|
||||
/// at GallioTest.MyClass.AssertWithFailureMessage() in d:\temp\test\..\GallioTest\MyClass.cs:line 46
|
||||
/// </summary>
|
||||
void GetFilePositionFromStackTrace() |
||||
{ |
||||
Match match = Regex.Match(StackTrace, @"\sin\s(.*?):line\s(\d+)", RegexOptions.Multiline); |
||||
if (match.Success) { |
||||
SetStackTraceFilePosition(match.Groups); |
||||
} else { |
||||
StackTraceFilePosition = FilePosition.Empty; |
||||
} |
||||
} |
||||
|
||||
void SetStackTraceFilePosition(GroupCollection groups) |
||||
{ |
||||
string fileName = Path.GetFullPath(groups[1].Value); |
||||
int line = Convert.ToInt32(groups[2].Value); |
||||
int column = 1; |
||||
|
||||
StackTraceFilePosition = new FilePosition(fileName, line, column); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,32 @@
@@ -0,0 +1,32 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Diagnostics; |
||||
using ICSharpCode.UnitTesting; |
||||
|
||||
namespace Gallio.SharpDevelop |
||||
{ |
||||
public class GallioTestRunner : TestProcessRunnerBase |
||||
{ |
||||
public GallioTestRunner() |
||||
{ |
||||
} |
||||
|
||||
protected override ProcessStartInfo GetProcessStartInfo(SelectedTests selectedTests) |
||||
{ |
||||
GallioEchoConsoleApplicationProcessStartInfo startInfo = |
||||
new GallioEchoConsoleApplicationProcessStartInfo(selectedTests, base.TestResultsMonitor.FileName); |
||||
return startInfo.ProcessStartInfo; |
||||
} |
||||
|
||||
protected override TestResult CreateTestResultForTestFramework(TestResult testResult) |
||||
{ |
||||
return new GallioTestResult(testResult); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,47 @@
@@ -0,0 +1,47 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
|
||||
namespace Gallio.SharpDevelop |
||||
{ |
||||
public class MbUnitTestAttributeName |
||||
{ |
||||
string name = String.Empty; |
||||
string qualifiedName = String.Empty; |
||||
string fullyQualifiedName = String.Empty; |
||||
StringComparer nameComparer; |
||||
|
||||
public MbUnitTestAttributeName(string name, StringComparer nameComparer) |
||||
{ |
||||
this.name = name; |
||||
this.nameComparer = nameComparer; |
||||
qualifiedName = String.Concat(name, "Attribute"); |
||||
fullyQualifiedName = String.Concat("MbUnit.Framework.", name, "Attribute"); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified attribute name is a
|
||||
/// match to this attribute.
|
||||
/// </summary>
|
||||
public bool IsEqual(string attributeName) |
||||
{ |
||||
if (nameComparer.Equals(attributeName, name) || |
||||
nameComparer.Equals(attributeName, qualifiedName) || |
||||
nameComparer.Equals(attributeName, fullyQualifiedName)) { |
||||
return true; |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
public bool IsEqual(IAttribute attribute) |
||||
{ |
||||
return IsEqual(attribute.AttributeType.FullyQualifiedName); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,31 @@
@@ -0,0 +1,31 @@
|
||||
#region Using directives
|
||||
|
||||
using System; |
||||
using System.Reflection; |
||||
using System.Runtime.InteropServices; |
||||
|
||||
#endregion
|
||||
|
||||
// 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("Gallio.SharpDevelop")] |
||||
[assembly: AssemblyDescription("")] |
||||
[assembly: AssemblyConfiguration("")] |
||||
[assembly: AssemblyCompany("")] |
||||
[assembly: AssemblyProduct("Gallio.SharpDevelop")] |
||||
[assembly: AssemblyCopyright("Copyright 2010")] |
||||
[assembly: AssemblyTrademark("")] |
||||
[assembly: AssemblyCulture("")] |
||||
|
||||
// This sets the default COM visibility of types in the assembly to invisible.
|
||||
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
||||
[assembly: ComVisible(false)] |
||||
|
||||
// The assembly version has following format :
|
||||
//
|
||||
// Major.Minor.Build.Revision
|
||||
//
|
||||
// You can specify all the values or you can use the default the Revision and
|
||||
// Build Numbers by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("0.1")] |
@ -0,0 +1,38 @@
@@ -0,0 +1,38 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using Gallio.Extension; |
||||
|
||||
namespace Gallio.SharpDevelop |
||||
{ |
||||
public class SharpDevelopTestRunnerExtensionCommandLineArgument : TestRunnerExtensionCommandLineArgument |
||||
{ |
||||
string testResultsFileName = String.Empty; |
||||
|
||||
public SharpDevelopTestRunnerExtensionCommandLineArgument() |
||||
: base(GetFullyQualifiedTypeName()) |
||||
{ |
||||
} |
||||
|
||||
static string GetFullyQualifiedTypeName() |
||||
{ |
||||
Type type = typeof(SharpDevelopTestRunnerExtension); |
||||
string typeName = type.FullName; |
||||
string assemblyFileName = type.Assembly.ManifestModule.ScopeName; |
||||
return String.Format("{0},{1}", typeName, assemblyFileName); |
||||
} |
||||
|
||||
public string TestResultsFileName { |
||||
get { return testResultsFileName; } |
||||
set { |
||||
testResultsFileName = value; |
||||
Parameters = testResultsFileName; |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,51 @@
@@ -0,0 +1,51 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
|
||||
namespace Gallio.SharpDevelop |
||||
{ |
||||
public class TestRunnerExtensionCommandLineArgument |
||||
{ |
||||
string type; |
||||
string parameters = String.Empty; |
||||
|
||||
public TestRunnerExtensionCommandLineArgument(string type) |
||||
{ |
||||
this.type = type; |
||||
} |
||||
|
||||
public string Type { |
||||
get { return type; } |
||||
} |
||||
|
||||
public string Parameters { |
||||
get { return parameters; } |
||||
set { parameters = value; } |
||||
} |
||||
|
||||
public override string ToString() |
||||
{ |
||||
return String.Format("/re:\"{0}{1}\"", |
||||
GetTypeName(), |
||||
GetParameters()); |
||||
} |
||||
|
||||
string GetTypeName() |
||||
{ |
||||
return type; |
||||
} |
||||
|
||||
string GetParameters() |
||||
{ |
||||
if (String.IsNullOrEmpty(parameters)) { |
||||
return String.Empty; |
||||
} |
||||
return String.Format(";{0}", parameters); |
||||
} |
||||
} |
||||
} |
Binary file not shown.
Loading…
Reference in new issue