Пример #1
0
        [Test] public void TestRunCoverageWithProperAdapter()
        {
            TestInstrument();
            using (ICoverageAdapter adapter = JSNet.JSCoverage(JSNet.ClosureLibrary(basejsfile)))
            {
                adapter.LoadSourceFile(@"resources\jscoverage\instrumented\jscoverage_source.js");
                ICoverageResults results = adapter.RunCoverage(@"resources\jscoverage\jscoverage_test.js");

                Assert.AreEqual(0, results.Failed.Count(), results.ToString());
                Assert.AreEqual(4, results.Passed.Count(), results.ToString());

                Assert.AreEqual(1, results.FilesCount);
                Assert.AreEqual(5, results.Statements);
                Assert.AreEqual(5, results.Executed);
                Assert.AreEqual(100.0m, results.CoveragePercentage);

                IFileCoverageResults sourceCoverage = results.FileResults.First();
                Assert.AreEqual("jscoverage_source.js", sourceCoverage.FileName);
                Assert.AreEqual(5, sourceCoverage.Statements);
                Assert.AreEqual(5, sourceCoverage.Executed);
                Assert.AreEqual(100.0m, sourceCoverage.CoveragePercentage);

                Console.WriteLine(results);
            }
        }
Пример #2
0
        [Test] public void TestHtmlFileWithSrcFiles()
        {
            using (ITestAdapter adapter = JSNet.ClosureLibrary(basejsfile))
            {
                ITestResults results = adapter.RunTest(@"resources\test_with_src_files.html");

                Assert.AreEqual(0, results.Failed.Count(), results.ToString());
                Assert.AreEqual(65, results.Passed.Count(), results.ToString());
            }
        }
Пример #3
0
        [Test] public void RunHtmlFileTest()
        {
            using (ITestAdapter adapter = JSNet.ClosureLibrary(basejsfile))
            {
                ITestResults results = adapter.RunTest(@"J:\dev\Projects\Misc\closure-library\closure\goog\array\array_test.html");

                Assert.AreEqual(0, results.Failed.Count(), results.ToString());
                Assert.AreEqual(73, results.Passed.Count(), results.ToString());
            }
        }
Пример #4
0
        [Test] public void RunJSFileTest()
        {
            using (ITestAdapter adapter = JSNet.ClosureLibrary(basejsfile))
            {
                ITestResults results = adapter.RunTest(@"resources\simple_closure_tests.js");

                Assert.AreEqual(0, results.Failed.Count(), results.ToString());
                Assert.AreEqual(66, results.Passed.Count(), results.ToString());
            }
        }
Пример #5
0
        [Test] public void AssertThatTheClosureTestWorksWithoutAnyCoverageStuff()
        {
            using (ITestAdapter adapter = JSNet.ClosureLibrary(basejsfile))
            {
                adapter.LoadSourceFile(@"resources\jscoverage\src\jscoverage_source.js");
                ITestResults results = adapter.RunTest(@"resources\jscoverage\jscoverage_test.js");

                Assert.AreEqual(0, results.Failed.Count(), results.ToString());
                Assert.AreEqual(4, results.Passed.Count(), results.ToString());
            }
        }
Пример #6
0
        [SetUp] public void SetUp()
        {
            const string basejsfile = @"J:\dev\Projects\Misc\closure-library\closure\goog\base.js";

            ctx = JSNet.ClosureLibrary(basejsfile);
        }