Beispiel #1
0
        private void Analyze(Type type, MethodInfo method, ItemCollection collection, TestFixtureView fixture)
        {
            if (method.GetCustomAttributes(typeof(TestAttribute), false).Count() > 0)
            {

                var testcase = new TestcaseView(type, method);
                collection.Add(CreateItem(testcase));
                fixture.AddTest(testcase);
            }
            else if (method.GetCustomAttributes(typeof(SetUpAttribute), false).Count() > 0)
            {
                fixture.SetupMethod = method;
            }
            else if (method.GetCustomAttributes(typeof(TearDownAttribute), false).Count() > 0)
            {
                fixture.TeardownMethod = method;
            }
        }
Beispiel #2
0
        private void Analyze(Type type, ItemCollection collection)
        {
            object[] attrs = Attribute.GetCustomAttributes(type);
            //if ( attrs.Contains(NUnit.Framework.TestAttribute);
            if (type.GetCustomAttributes(typeof(TestFixtureAttribute), false).Count() == 0)
                return;
            var fixture = new TestFixtureView(type.Name, type);
            var item = new TreeViewItem();
            {
                item.Header = type.Name;
                item.Tag = fixture;
                collection.Add(item);
                item.PreviewMouseDown += (o, args) => PresentSummary(item);
            }

            foreach (MethodInfo method in type.GetMethods(BindingFlags.Public | BindingFlags.Instance))
                Analyze(type, method, item.Items, fixture);
        }