Skip to content
This repository has been archived by the owner on Jan 24, 2021. It is now read-only.

Commit

Permalink
IfDefd a test in mono and added xunit mono build task
Browse files Browse the repository at this point in the history
  • Loading branch information
grumpydev committed Oct 2, 2011
1 parent aa0ecc7 commit f937f70
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
26 changes: 25 additions & 1 deletion rakefile.rb
Expand Up @@ -7,6 +7,7 @@
NANCY_VERSION = "0.7.1"
OUTPUT = "build"
CONFIGURATION = 'Release'
CONFIGURATIONMONO = 'MonoRelease'
SHARED_ASSEMBLY_INFO = 'src/SharedAssemblyInfo.cs'
SOLUTION_FILE = 'src/Nancy.sln'

Expand All @@ -21,6 +22,12 @@
desc "Executes all MSpec and Xunit tests"
task :test => [:mspec, :xunit]

desc "Compiles solution and runs unit tests for Mono"
task :mono => [:clean, :version, :compilemono, :testmono]

desc "Executes all tests with Mono"
task :testmono => [:xunitmono]

#Add the folders that should be cleaned as part of the clean task
CLEAN.include(OUTPUT)
CLEAN.include(FileList["src/**/#{CONFIGURATION}"])
Expand All @@ -43,6 +50,15 @@
msb.solution = SOLUTION_FILE
end

desc "Compile solution file for Mono"
msbuild :compilemono => [:version] do |msb|
msb.command = "xbuild"
msb.properties :configuration => CONFIGURATIONMONO
msb.targets :Clean, :Build
msb.solution = SOLUTION_FILE
end


desc "Gathers output files and copies them to the output folder"
task :publish => [:compile] do
Dir.mkdir(OUTPUT)
Expand All @@ -67,6 +83,14 @@
xunit.assemblies = tests
end

desc "Executes xUnit tests using Mono"
xunit :xunitmono => [] do |xunit|
tests = FileList["src/**/#{CONFIGURATIONMONO}/*.Tests.dll"].exclude(/obj\//)

xunit.command = "tools/xunit/xunitmono.sh"
xunit.assemblies = tests
end

desc "Zips up the built binaries for easy distribution"
zip :package => [:publish] do |zip|
Dir.mkdir("#{OUTPUT}/packages")
Expand Down Expand Up @@ -160,4 +184,4 @@ def update_xml(xml_path)
# 4. Zip binaries with docs (named with version number) - DONE
# 5. Create a how to build file - DONE
# 6. TeamCity integration - DONE
# 7. NuGet task - DONE
# 7. NuGet task - DONE
6 changes: 5 additions & 1 deletion src/Nancy.Testing.Tests/BrowserResponseBodyWrapperFixture.cs
Expand Up @@ -49,7 +49,11 @@ public void Should_return_querywrapper_for_css_selector_match()
var result = body["#bar"];

// Then
result.ShouldContain("inner");
#if __MonoCS__
AssertExtensions.ShouldContain(result, "inner", System.StringComparison.OrdinalIgnoreCase);
#else
result.ShouldContain("inner");
#endif
}
}
}
4 changes: 4 additions & 0 deletions tools/xunit/xunitmono.sh
@@ -0,0 +1,4 @@
#!/bin/sh
BASEDIR=$(dirname $0)

mono ${BASEDIR}/xunit.console.clr4.x86.exe $*

0 comments on commit f937f70

Please sign in to comment.