コード例 #1
0
ファイル: Program.cs プロジェクト: riezebosch/centric
        static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.WriteLine("Specify test assembly is parameter");
                return;
            }

            var location = args.First();
            var ai = new AssemblyInspector(location);
            var classes = ai.GetClasses();
            int apassed = 0, afailed = 0;

            foreach (var c in classes)
            {
                var runner = new TestRunner(c);
                Console.WriteLine(c.Name);

                var ci = new ClassInspector(c);

                if (!ExecuteIfExists(runner, ci.GetClassInitialize()))
                {
                    break;
                }

                var testinit = ci.GetTestInitialize();
                var testclean = ci.GetTestCleanUp();
                var methods = ci.GetMethods();
                int cpassed = 0, cfailed = 0;

                foreach (var m in methods)
                {
                    if (!ExecuteIfExists(runner, testinit))
                    {
                        break;
                    }

                    ExecuteTest(ref apassed, ref afailed, runner, ref cpassed, ref cfailed, m);
                    ExecuteIfExists(runner, testclean);
                }

                ExecuteIfExists(runner, ci.GetClassCleanUp());
                Console.WriteLine("  [{0}] Tests passed: {1}, tests failed: {2}", c.Name, cpassed, cfailed);
            }
            Console.WriteLine("Tests passed: {0}, tests failed: {1}", apassed, afailed);
        }
コード例 #2
0
ファイル: UnitTest1.cs プロジェクト: riezebosch/centric
        public void TestMethod1()
        {
            var inspector = new ClassInspector(typeof(TestDemoClass));
            IEnumerable<MethodInfo> methods = inspector.GetMethods();

            Assert.IsNotNull(methods);
            Assert.AreEqual(6, methods.Count());
        }
コード例 #3
0
ファイル: UnitTest1.cs プロジェクト: riezebosch/centric
        public void TestGetTestInitialize()
        {
            var inspector = new ClassInspector(typeof(TestDemoClass));
            MethodInfo m = inspector.GetTestInitialize();

            Assert.IsNotNull(m);
            Assert.AreEqual("TestInit", m.Name);
        }
コード例 #4
0
ファイル: UnitTest1.cs プロジェクト: riezebosch/centric
        public void TestGetClassCleanup()
        {
            var inspector = new ClassInspector(typeof(TestDemoClass));
            MethodInfo m = inspector.GetClassCleanUp();

            Assert.IsNotNull(m);
            Assert.AreEqual("ClassClean", m.Name);
        }