Esempio n. 1
0
        private static bool ReadFixture(Type fixtureType, IAssemblyData data)
        {
            var fixtureAttribs = fixtureType.GetCustomAttributes(typeof(TestFixtureAttribute), true);

            if (!fixtureAttribs.Any())
            {
                //Console.WriteLine("Specified fixture does not have the required TestFixture attribute.");
                return(false);
            }

            var fixData = new FixtureData(data, fixtureType.Name);

            data.Fixtures.Add(fixData);

            foreach (var test in fixtureType.GetMethods())
            {
                var testAttribs = test.GetCustomAttributes(typeof(TestAttribute), false);
                if (!testAttribs.Any())
                {
                    // skip this method
                    continue;
                }

                if (!ReadTest(test, fixData))
                {
                    //Console.WriteLine(string.Format("Journal could not be created for test:{0} in fixture:{1}", _test,_fixture));
                    continue;
                }
            }

            return(true);
        }
Esempio n. 2
0
        private static bool ReadFixture(Type fixtureType, IAssemblyData data)
        {
            var fixtureAttribs = fixtureType.GetCustomAttributes(typeof (TestFixtureAttribute), true);
            if (!fixtureAttribs.Any())
            {
                Console.WriteLine("Specified fixture does not have the required TestFixture attribute.");
                return false;
            }

            var fixData = new FixtureData(data, fixtureType.Name);
            data.Fixtures.Add(fixData);

            foreach (var test in fixtureType.GetMethods())
            {
                var testAttribs = test.GetCustomAttributes(typeof(TestAttribute), false);
                if (!testAttribs.Any())
                {
                    // skip this method
                    continue;
                }

                if (!ReadTest(test, fixData))
                {
                    Console.WriteLine(string.Format("Journal could not be created for test:{0} in fixture:{1}", _test,
                        _fixture));
                    continue;
                }
            }

            return true;
        }