Пример #1
0
        TestSuiteElement Setup(TestSuite suite)
        {
            while (suite.Tests.Count == 1 && (suite.Tests[0] is TestSuite))
            {
                suite = (TestSuite)suite.Tests[0];
            }

            TestSuiteElement tse = new TestSuiteElement(suite, this);

            suite_elements.Add(suite, tse);

            var root = new RootElement("Tests");

            Section section = new Section(suite.Name);

            foreach (ITest test in suite.Tests)
            {
                TestSuite ts = (test as TestSuite);
                if (ts != null)
                {
                    section.Add(Setup(ts));
                }
                else
                {
                    TestMethod tc = (test as TestMethod);
                    if (tc != null)
                    {
                        section.Add(Setup(tc));
                    }
                    else
                    {
                        throw new NotImplementedException(test.GetType().ToString());
                    }
                }
            }

            root.Add(section);

            if (section.Count > 1)
            {
                Section options = new Section()
                {
                    new StringElement("Run all", async delegate() {
                        if (OpenWriter(suite.Name))
                        {
                            await Run(suite);
                            CloseWriter();
                            suites_dvc [suite].Filter();
                        }
                    })
                };
                root.Add(options);
            }

            suites_dvc.Add(suite, new TouchViewController(root));
            return(tse);
        }
Пример #2
0
		TestSuiteElement Setup (TestSuite suite)
		{
            while (suite.Tests.Count == 1 && (suite.Tests[0] is TestSuite))
                suite = (TestSuite)suite.Tests[0];

			TestSuiteElement tse = new TestSuiteElement (suite, this);
			suite_elements.Add (suite, tse);
			
			var root = new RootElement ("Tests");
		
			Section section = new Section (suite.Name);
			foreach (ITest test in suite.Tests) {
				TestSuite ts = (test as TestSuite);
				if (ts != null) {
					section.Add (Setup (ts));
				} else {
					TestMethod tc = (test as TestMethod);
					if (tc != null) {
						section.Add (Setup (tc));
					} else {
						throw new NotImplementedException (test.GetType ().ToString ());
					}
				}
			}
		
			root.Add (section);
			
			if (section.Count > 1) {
				Section options = new Section () {
					new StringElement ("Run all", async delegate () {
						if (OpenWriter (suite.Name)) {
							await Run (suite);
							CloseWriter ();
							suites_dvc [suite].Filter ();
						}
					})
				};
				root.Add (options);
			}

			suites_dvc.Add (suite, new TouchViewController (root));
			return tse;
		}