Exemplo n.º 1
0
        public TestNodeEventArgs(TestAction action, TestNode test)
            : base(action)
        {
            if (test == null)
                throw new ArgumentNullException("test");

            Test = test;
        }
Exemplo n.º 2
0
        public TestEventArgs(TestAction action, TestNode test)
        {
            if (test == null)
                throw new ArgumentNullException("test");

            this.Action = action;
            this.Test = test;
        }
Exemplo n.º 3
0
        public void CreateTestRun()
        {
            var testNode = new TestNode("<test-run id='123' name='mytest.dll' fullname='/A/B/C/mytest.dll' testcasecount='99'/>");

            Assert.That(testNode.Id, Is.EqualTo("123"));
            Assert.That(testNode.Name, Is.EqualTo("mytest.dll"));
            Assert.That(testNode.FullName, Is.EqualTo("/A/B/C/mytest.dll"));
            Assert.That(testNode.TestCount, Is.EqualTo(99));
            Assert.That(testNode.IsSuite);
        }
Exemplo n.º 4
0
        public void CreateTestSuite()
        {
            var testNode = new TestNode("<test-suite id='123' type='Assembly' name='mytest.dll' fullname='/A/B/C/mytest.dll' testcasecount='42' runstate='Runnable'/>");

            Assert.That(testNode.Id, Is.EqualTo("123"));
            Assert.That(testNode.Name, Is.EqualTo("mytest.dll"));
            Assert.That(testNode.FullName, Is.EqualTo("/A/B/C/mytest.dll"));
            Assert.That(testNode.Type, Is.EqualTo("Assembly"));
            Assert.That(testNode.TestCount, Is.EqualTo(42));
            Assert.That(testNode.RunState, Is.EqualTo(RunState.Runnable));
            Assert.That(testNode.IsSuite);
        }
Exemplo n.º 5
0
        public void CreateTestCase()
        {
            var testNode = new TestNode("<test-case id='123' name='SomeTest' fullname='A.B.C.SomeTest' runstate='Ignored'/>");

            Assert.That(testNode.Id, Is.EqualTo("123"));
            Assert.That(testNode.Name, Is.EqualTo("SomeTest"));
            Assert.That(testNode.FullName, Is.EqualTo("A.B.C.SomeTest"));
            Assert.That(testNode.Type, Is.EqualTo("TestCase"));
            Assert.That(testNode.TestCount, Is.EqualTo(1));
            Assert.That(testNode.RunState, Is.EqualTo(RunState.Ignored));
            Assert.False(testNode.IsSuite);
        }
Exemplo n.º 6
0
        public void ReloadTests(string runtime)
        {
            Runner.Unload();
            _resultIndex.Clear();
            Tests = null;

            _package = MakeTestPackage(_files);
            if (runtime != null)
            {
                _package.Settings["RuntimeFramework"] = runtime;
            }
            Runner = _testEngine.GetRunner(_package);

            Tests = new TestNode(Runner.Explore(TestFilter.Empty));

            _resultIndex.Clear();

            if (TestReloaded != null)
            {
                TestReloaded(new TestNodeEventArgs(TestAction.TestReloaded, Tests));
            }
        }
Exemplo n.º 7
0
        public void LoadTests(TestPackage package)
        {
            if (IsPackageLoaded)
            {
                UnloadTests();
            }

            //if (TestLoading != null)
            //    TestLoading(new TestEventArgs(TestAction.TestLoading));

            _package = package;

            try
            {
                Runner = _testEngine.GetRunner(package);
                // TODO: Error here when multiple files are run
                Tests = new TestNode(Runner.Explore(TestFilter.Empty));

                _resultIndex.Clear();
            }
            catch (Exception ex)
            {
                //if (TestException != null)
                //    TestException(new TestEventArgs(TestAction.TestLoadFailed, ex));
            }

            if (TestLoaded != null)
            {
                TestLoaded(new TestEventArgs(TestAction.TestLoaded, Tests));
            }

            // TODO: Handle this on the presenter?
            foreach (var subPackage in _package.SubPackages)
            {
                RecentFiles.SetMostRecent(subPackage.FullName);
            }
        }
Exemplo n.º 8
0
 public TestEventArgs(TestAction action, TestNode test)
 {
     // TODO: Add Guard for test
     this.Action = action;
     this.Test = test;
 }
Exemplo n.º 9
0
 public TestEventArgs(TestAction action, TestNode test)
 {
     // TODO: Add Guard for test
     this.Action = action;
     this.Test   = test;
 }
Exemplo n.º 10
0
 public TestNodeEventArgs(TestAction action, TestNode test)
     : this(action, test, new string[0])
 {
 }
    public string GetTestTypeTest(string type, string fullname, string runstate)
    {
      TestNode testNode = new TestNode(XmlHelper.CreateXmlNode(string.Format("<test-run id='1' type='{0}' fullname='{1}' runstate='{2}'><test-suite id='42'/></test-run>", type, fullname, runstate)));

      return TestPropertiesPresenter.GetTestType(testNode);
    }
Exemplo n.º 12
0
 private void Accumulate(TestSelection selection, TestNode testNode, TestNodePredicate predicate)
 {
     if (predicate(testNode))
         selection.Add(testNode);
     else if (testNode.IsSuite)
         foreach (TestNode child in testNode.Children)
             Accumulate(selection, child, predicate);
 }