Created
November 4, 2011 13:41
-
-
Save leviwilson/1339339 to your computer and use it in GitHub Desktop.
Noesis.Javascript.Headless Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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