Skip to content

Instantly share code, notes, and snippets.

@leviwilson
Created November 4, 2011 13:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leviwilson/1339339 to your computer and use it in GitHub Desktop.
Save leviwilson/1339339 to your computer and use it in GitHub Desktop.
Noesis.Javascript.Headless Example
using NUnit.Framework;
using Noesis.Javascript.Headless;
using Noesis.Javascript.Headless.Reporters;
namespace Noesis.Javascript.Headless.Example.Specs
{
[TestFixture]
public class JasmineSpecs
{
private JavaScriptTestRunner _jsTestRunner;
[SetUp]
public void SetUp()
{
_jsTestRunner = new JavaScriptTestRunner();
}
[Test]
public void Then_all_of_our_jasmine_specs_pass()
{
// these resources are embedded in the Noesis.JavaScript.Headless assembly
_jsTestRunner.Include(JavaScriptLibrary.Jasmine_1_1_0);
_jsTestRunner.Include(JavaScriptLibrary.jQuery_1_6_4_min);
_jsTestRunner.Include(JavaScriptLibrary.jQuery_ui_1_8_16);
_jsTestRunner.Include(JavaScriptLibrary.jEditable);
_jsTestRunner.Include(JavaScriptLibrary.Jasmine_Fixture);
_jsTestRunner.Include(JavaScriptLibrary.BackboneMin);
/**
* these resources are embedded in an assembly, but also as content. It uses the
* <T> argument to load the resource from the assembly, eliminating having to deal with
* folder path issues, especially in Team Build.
**/
_jsTestRunner.LoadFromResource<Specs>("example.js");
_jsTestRunner.LoadFromResource<Specs>("example-specs.js");
var javaScriptReporter = new StringReporter();
_jsTestRunner.RunJasmineSpecs(javaScriptReporter);
Assert.AreEqual(0, javaScriptReporter.TotalFailures, javaScriptReporter.Result); //
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment