示例#1
0
        public void ClassObjectHasTestList()
        {
            StubExecutorWrapper wrapper = CreateStubExecutor();

            TestAssembly assembly = TestAssemblyBuilder.Build(wrapper);

            TestClass testClass = assembly.EnumerateClasses().First();
            IEnumerable <TestMethod> testMethods = testClass.EnumerateTestMethods();

            Assert.True(testMethods.Any(tm => tm.TestClass == testClass &&
                                        tm.MethodName == "NonSkipMethod" &&
                                        tm.DisplayName == "ThisIsTheType.NonSkipMethod" &&
                                        tm.RunResults.Count == 0 &&
                                        tm.Traits.Count == 0));
            Assert.True(testMethods.Any(tm => tm.TestClass == testClass &&
                                        tm.MethodName == "TestMethodWithTraits" &&
                                        tm.DisplayName == "This is a custom display name" &&
                                        tm.RunResults.Count == 0 &&
                                        tm.Traits["Category"].FirstOrDefault() == "Foo" &&
                                        tm.Traits["Author"].FirstOrDefault() == "Dumb Attribute"));
            Assert.True(testMethods.Any(tm => tm.TestClass == testClass &&
                                        tm.MethodName == "SkipMethod" &&
                                        tm.DisplayName == "ThisIsTheType.SkipMethod" &&
                                        tm.RunResults.Count == 1 &&
                                        ((TestSkippedResult)tm.RunResults[0]).Reason == "Skip Reason" &&
                                        tm.Traits.Count == 0));
        }
示例#2
0
        public void AssemblyObjectHasClassList()
        {
            StubExecutorWrapper wrapper = CreateStubExecutor();

            TestAssembly assembly = TestAssemblyBuilder.Build(wrapper);

            var testClasses = assembly.EnumerateClasses();

            Assert.Equal(2, testClasses.Count());
            TestClass testClass = testClasses.First();

            Assert.Equal("ThisIsTheType", testClass.TypeName);
        }