forked from timwingfield/HeadlessJavascriptTestingInDotNet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHeadlessTestingDemo.cs
38 lines (34 loc) · 1.31 KB
/
HeadlessTestingDemo.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System.Linq;
using NUnit.Framework;
using Noesis.Javascript.Headless;
using Noesis.Javascript.Headless.Reporters;
namespace HeadlessTestingDemo
{
[TestFixture]
public class HeadlessTestingDemo
{
[Test, TestCaseSource("JasmineResults")]
public void Expect(string testName, string errors)
{
Assert.That(errors, Is.Null);
}
public object [] JasmineResults
{
get
{
var testRunner = new JavaScriptTestRunner();
testRunner.Include(JavaScriptLibrary.jQuery_1_6_4_min);
testRunner.Include(JavaScriptLibrary.Jasmine_1_1_0);
// load the "Roman.js" file from the resource specified in <T>, which happens to be this assembly but could be in another project.
testRunner.LoadFromResource<HeadlessTestingDemo>("Roman.js");
testRunner.LoadFromResource<HeadlessTestingDemo>("RomanSpec.js");
testRunner.LoadFromResource<HeadlessTestingDemo>("SpecHelper.js");
var testReporter = new ResultsReporter();
testRunner.RunJasmineSpecs(testReporter);
return testReporter.Results
.Select(x => new[] {x.Key, x.Value})
.ToArray();
}
}
}
}