Browse Source

Fix Gallio sample.

Compile Gallio extension with AnyCPU so it works on x64 Windows.
pull/39/merge
Matt Ward 12 years ago
parent
commit
245c2bd9ca
  1. 8
      samples/Gallio/Gallio.Extension/Gallio.Extension.csproj
  2. 7
      samples/Gallio/Gallio.SharpDevelop.Tests/Gallio.SharpDevelop.Tests.csproj
  3. 42
      samples/Gallio/Gallio.SharpDevelop.Tests/GallioTestFrameworkIsTestMemberTests.cs
  4. 3
      samples/Gallio/Gallio.SharpDevelop/Gallio.SharpDevelop.csproj
  5. 19
      samples/Gallio/Gallio.SharpDevelop/GallioTestFramework.cs

8
samples/Gallio/Gallio.Extension/Gallio.Extension.csproj

@ -12,14 +12,17 @@ @@ -12,14 +12,17 @@
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<NoStdLib>False</NoStdLib>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<NoWin32Manifest>False</NoWin32Manifest>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'x86' ">
<PlatformTarget>x86</PlatformTarget>
<PlatformTarget>AnyCPU</PlatformTarget>
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
<BaseAddress>4194304</BaseAddress>
<FileAlignment>4096</FileAlignment>
<Prefer32Bit>False</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>bin\Debug\</OutputPath>
@ -28,6 +31,7 @@ @@ -28,6 +31,7 @@
<Optimize>False</Optimize>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>bin\Release\</OutputPath>

7
samples/Gallio/Gallio.SharpDevelop.Tests/Gallio.SharpDevelop.Tests.csproj

@ -51,16 +51,13 @@ @@ -51,16 +51,13 @@
<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>
<HintPath>..\..\..\AddIns\Analysis\UnitTesting\UnitTesting.dll</HintPath>
</Reference>
<Reference Include="UnitTesting.Tests">
<HintPath>..\..\..\bin\UnitTests\UnitTesting.Tests.dll</HintPath>
@ -80,7 +77,7 @@ @@ -80,7 +77,7 @@
<Compile Include="GallioEchoConsoleProcessStartInfoTestFixture.cs" />
<Compile Include="GallioTestFailureTestFixture.cs" />
<Compile Include="GallioTestFrameworkIsTestClassTests.cs" />
<Compile Include="GallioTestFrameworkIsTestMethodTests.cs" />
<Compile Include="GallioTestFrameworkIsTestMemberTests.cs" />
<Compile Include="GallioTestFrameworkIsTestProjectTests.cs" />
<Compile Include="GallioTestToSharpDevelopTestResultConversionTests.cs" />
<Compile Include="TestResultsWriterTestFixture.cs" />

42
samples/Gallio/Gallio.SharpDevelop.Tests/GallioTestFrameworkIsTestMethodTests.cs → samples/Gallio/Gallio.SharpDevelop.Tests/GallioTestFrameworkIsTestMemberTests.cs

@ -17,7 +17,7 @@ using UnitTesting.Tests.Utils; @@ -17,7 +17,7 @@ using UnitTesting.Tests.Utils;
namespace Gallio.SharpDevelop.Tests
{
[TestFixture]
public class GallioTestFrameworkIsTestMethodTests
public class GallioTestFrameworkIsTestMemberTests
{
GallioTestFramework testFramework;
@ -28,44 +28,44 @@ namespace Gallio.SharpDevelop.Tests @@ -28,44 +28,44 @@ namespace Gallio.SharpDevelop.Tests
}
[Test]
public void IsTestMethodReturnsFalseWhenMethodHasNoAttributes()
public void IsTestMemberReturnsFalseWhenMethodHasNoAttributes()
{
MockMethod mockMethod = MockMethod.CreateMockMethodWithoutAnyAttributes();
Assert.IsFalse(testFramework.IsTestMethod(mockMethod));
Assert.IsFalse(testFramework.IsTestMember(mockMethod));
}
[Test]
public void IsTestMethodReturnsTrueWhenMethodHasTestAttributeWithoutAttributePart()
public void IsTestMemberReturnsTrueWhenMethodHasTestAttributeWithoutAttributePart()
{
MockAttribute testAttribute = new MockAttribute("Test");
MockMethod mockMethod = MockMethod.CreateMockMethodWithAttribute(testAttribute);
Assert.IsTrue(testFramework.IsTestMethod(mockMethod));
Assert.IsTrue(testFramework.IsTestMember(mockMethod));
}
[Test]
public void IsTestMethodReturnsTrueWhenMethodHasTestAttributeAttribute()
public void IsTestMemberReturnsTrueWhenMethodHasTestAttributeAttribute()
{
MockAttribute testAttribute = new MockAttribute("TestAttribute");
MockMethod mockMethod = MockMethod.CreateMockMethodWithAttribute(testAttribute);
Assert.IsTrue(testFramework.IsTestMethod(mockMethod));
Assert.IsTrue(testFramework.IsTestMember(mockMethod));
}
[Test]
public void IsTestMethodReturnsTrueWhenMethodHasFullyQualifiedNUnitTestAttribute()
public void IsTestMemberReturnsTrueWhenMethodHasFullyQualifiedNUnitTestAttribute()
{
MockAttribute testAttribute = new MockAttribute("MbUnit.Framework.TestAttribute");
MockMethod mockMethod = MockMethod.CreateMockMethodWithAttribute(testAttribute);
Assert.IsTrue(testFramework.IsTestMethod(mockMethod));
Assert.IsTrue(testFramework.IsTestMember(mockMethod));
}
[Test]
public void IsTestMethodReturnsFalseWhenMethodIsNull()
public void IsTestMemberReturnsFalseWhenMethodIsNull()
{
Assert.IsFalse(testFramework.IsTestMethod(null));
Assert.IsFalse(testFramework.IsTestMember(null));
}
[Test]
public void IsTestMethodReturnsFalseWhenProjectContentLanguageHasNullNameComparer()
public void IsTestMemberReturnsFalseWhenProjectContentLanguageHasNullNameComparer()
{
IProject project = new MockCSharpProject();
MockProjectContent mockProjectContent = new MockProjectContent();
@ -75,7 +75,7 @@ namespace Gallio.SharpDevelop.Tests @@ -75,7 +75,7 @@ namespace Gallio.SharpDevelop.Tests
MockMethod mockMethod = new MockMethod(mockClass);
mockMethod.Attributes.Add(new MockAttribute("Test"));
Assert.IsFalse(testFramework.IsTestMethod(mockMethod));
Assert.IsFalse(testFramework.IsTestMember(mockMethod));
}
/// <summary>
@ -83,26 +83,26 @@ namespace Gallio.SharpDevelop.Tests @@ -83,26 +83,26 @@ namespace Gallio.SharpDevelop.Tests
/// flagged as a TestMethod.
/// </summary>
[Test]
public void IsTestMethodReturnsTrueWhenProjectIsNull()
public void IsTestMemberReturnsTrueWhenProjectIsNull()
{
MockAttribute testAttribute = new MockAttribute("Test");
MockMethod mockMethod = MockMethod.CreateMockMethodWithAttribute(testAttribute);
MockProjectContent mockProjectContent = (MockProjectContent)mockMethod.DeclaringType.ProjectContent;
mockProjectContent.Project = null;
Assert.IsTrue(testFramework.IsTestMethod(mockMethod));
Assert.IsTrue(testFramework.IsTestMember(mockMethod));
}
[Test]
public void IsTestMethodReturnsFalseWhenMethodHasNullDeclaringType()
public void IsTestMemberReturnsFalseWhenMethodHasNullDeclaringType()
{
MockMethod mockMethod = new MockMethod(new MockClass());
Assert.IsFalse(testFramework.IsTestMethod(mockMethod));
Assert.IsFalse(testFramework.IsTestMember(mockMethod));
}
[Test]
public void IsTestMethodReturnsFalseWhenMethodHasNullLanguage()
public void IsTestMemberReturnsFalseWhenMethodHasNullLanguage()
{
IProject project = new MockCSharpProject();
MockProjectContent mockProjectContent = new MockProjectContent();
@ -110,18 +110,18 @@ namespace Gallio.SharpDevelop.Tests @@ -110,18 +110,18 @@ namespace Gallio.SharpDevelop.Tests
MockClass mockClass = new MockClass(mockProjectContent);
MockMethod mockMethod = new MockMethod(mockClass);
Assert.IsFalse(testFramework.IsTestMethod(mockMethod));
Assert.IsFalse(testFramework.IsTestMember(mockMethod));
}
[Test]
public void IsTestMethodReturnsFalseWhenMethodHasHasParameters()
public void IsTestMemberReturnsFalseWhenMethodHasHasParameters()
{
MockAttribute testAttribute = new MockAttribute("Test");
MockMethod mockMethod = MockMethod.CreateMockMethodWithAttribute(testAttribute);
MockParameter mockParameter = new MockParameter();
mockMethod.Parameters.Add(mockParameter);
Assert.IsFalse(testFramework.IsTestMethod(mockMethod));
Assert.IsFalse(testFramework.IsTestMember(mockMethod));
}
}
}

3
samples/Gallio/Gallio.SharpDevelop/Gallio.SharpDevelop.csproj

@ -58,8 +58,7 @@ @@ -58,8 +58,7 @@
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="UnitTesting">
<HintPath>..\..\..\AddIns\AddIns\Misc\UnitTesting\UnitTesting.dll</HintPath>
<Private>False</Private>
<HintPath>..\..\..\AddIns\Analysis\UnitTesting\UnitTesting.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>

19
samples/Gallio/Gallio.SharpDevelop/GallioTestFramework.cs

@ -6,6 +6,9 @@ @@ -6,6 +6,9 @@
// </file>
using System;
using System.Collections.Generic;
using System.Linq;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.UnitTesting;
@ -78,12 +81,26 @@ namespace Gallio.SharpDevelop @@ -78,12 +81,26 @@ namespace Gallio.SharpDevelop
return null;
}
public bool IsTestMember(IMember member)
{
var method = member as IMethod;
if (method != null) {
return IsTestMethod(method);
}
return false;
}
public IEnumerable<TestMember> GetTestMembersFor(IClass c)
{
return c.Methods.Where(IsTestMethod).Select(member => new TestMember(member));
}
/// <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)
bool IsTestMethod(IMember member)
{
if (member == null) {
return false;

Loading…
Cancel
Save