コード例 #1
0
        public void FilterWithTruePredicate()
        {
            var mate      = new TestableMultiAssemblyTestEnvironment();
            var assembly1 = mate.Load(CreateStubExecutor());
            var assembly2 = mate.Load(CreateStubExecutor("assembly", "config"));

            var tests = mate.EnumerateTestMethods(testMethod => true);

            Assert.Equal(8, tests.Count());
            Assert.True(tests.Any(tm => tm.TestClass.TestAssembly == assembly1 &&
                                  tm.DisplayName == "ThisIsTheType.NonSkipMethod"));
            Assert.True(tests.Any(tm => tm.TestClass.TestAssembly == assembly1 &&
                                  tm.DisplayName == "ThisIsTheType.SkipMethod"));
            Assert.True(tests.Any(tm => tm.TestClass.TestAssembly == assembly1 &&
                                  tm.DisplayName == "This is a custom display name"));
            Assert.True(tests.Any(tm => tm.TestClass.TestAssembly == assembly1 &&
                                  tm.DisplayName == "Monkey.DummyMethod"));
            Assert.True(tests.Any(tm => tm.TestClass.TestAssembly == assembly2 &&
                                  tm.DisplayName == "ThisIsTheType.NonSkipMethod"));
            Assert.True(tests.Any(tm => tm.TestClass.TestAssembly == assembly2 &&
                                  tm.DisplayName == "ThisIsTheType.SkipMethod"));
            Assert.True(tests.Any(tm => tm.TestClass.TestAssembly == assembly2 &&
                                  tm.DisplayName == "This is a custom display name"));
            Assert.True(tests.Any(tm => tm.TestClass.TestAssembly == assembly2 &&
                                  tm.DisplayName == "Monkey.DummyMethod"));
        }
コード例 #2
0
        public void NullAssemblyNameThrows()
        {
            var mate = new TestableMultiAssemblyTestEnvironment();

            Assert.Throws <ArgumentNullException>(() => mate.Load((string)null));
            Assert.Throws <ArgumentNullException>(() => mate.Load(null, "configFile"));
        }
コード例 #3
0
        public void FilterWithFalsePredicate()
        {
            var mate      = new TestableMultiAssemblyTestEnvironment();
            var assembly1 = mate.Load(CreateStubExecutor());
            var assembly2 = mate.Load(CreateStubExecutor("assembly", "config"));

            var tests = mate.EnumerateTestMethods(testMethod => false);

            Assert.Equal(0, tests.Count());
        }
コード例 #4
0
        public void ReturnsLoadedAssembly()
        {
            var wrapper = CreateStubExecutor();
            var mate    = new TestableMultiAssemblyTestEnvironment();

            var testAssembly = mate.Load(wrapper);

            Assert.Same(wrapper, testAssembly.ExecutorWrapper);
        }
コード例 #5
0
        public void RemovesDisposedTestAssemblies()
        {
            var wrapper  = CreateStubExecutor();
            var mate     = new TestableMultiAssemblyTestEnvironment();
            var assembly = mate.Load(wrapper);

            mate.Dispose();

            Assert.False(mate.EnumerateTestAssemblies().Any());
        }
コード例 #6
0
        public void RemovesDisposedTestAssemblies()
        {
            var wrapper = CreateStubExecutor();
            var mate = new TestableMultiAssemblyTestEnvironment();
            var assembly = mate.Load(wrapper);

            mate.Dispose();

            Assert.False(mate.EnumerateTestAssemblies().Any());
        }
コード例 #7
0
        public void DisposesTestAssembliesWhichDisposesWrapper()
        {
            var wrapper  = CreateStubExecutor();
            var mate     = new TestableMultiAssemblyTestEnvironment();
            var assembly = mate.Load(wrapper);

            mate.Dispose();

            Assert.True(wrapper.Dispose__Called);
        }
コード例 #8
0
        public void DisposesTestAssembliesWhichDisposesWrapper()
        {
            var wrapper = CreateStubExecutor();
            var mate = new TestableMultiAssemblyTestEnvironment();
            var assembly = mate.Load(wrapper);

            mate.Dispose();

            Assert.True(wrapper.Dispose__Called);
        }
コード例 #9
0
        public void ExecutorShouldBeDisposedOnUnload()
        {
            var wrapper  = CreateStubExecutor();
            var mate     = new TestableMultiAssemblyTestEnvironment();
            var assembly = mate.Load(wrapper);

            mate.Unload(assembly);

            Assert.True(wrapper.Dispose__Called);
        }
コード例 #10
0
        public void LoadedAssemblyIsPartOfEnumeratedAssemblyList()
        {
            var wrapper  = CreateStubExecutor();
            var mate     = new TestableMultiAssemblyTestEnvironment();
            var assembly = mate.Load(wrapper);

            mate.Unload(assembly);

            Assert.Equal(0, mate.EnumerateTestAssemblies().Count());
        }
コード例 #11
0
        public void LoadedAssemblyIsPartOfEnumeratedAssemblyList()
        {
            var wrapper = CreateStubExecutor();
            var mate = new TestableMultiAssemblyTestEnvironment();
            var assembly = mate.Load(wrapper);

            var assemblies = mate.EnumerateTestAssemblies();

            TestAssembly testAssembly = Assert.Single(assemblies);
            Assert.Same(assembly, testAssembly);
        }
コード例 #12
0
        public void LoadedAssemblyIsPartOfEnumeratedAssemblyList()
        {
            var wrapper  = CreateStubExecutor();
            var mate     = new TestableMultiAssemblyTestEnvironment();
            var assembly = mate.Load(wrapper);

            var assemblies = mate.EnumerateTestAssemblies();

            TestAssembly testAssembly = Assert.Single(assemblies);

            Assert.Same(assembly, testAssembly);
        }
コード例 #13
0
        public void LoadedAssemblyIsPartOfEnumeratedAssemblyList()
        {
            var wrapper = CreateStubExecutor();
            var mate = new TestableMultiAssemblyTestEnvironment();
            var assembly = mate.Load(wrapper);

            mate.Unload(assembly);

            Assert.Equal(0, mate.EnumerateTestAssemblies().Count());
        }
コード例 #14
0
        public void ExecutorShouldBeDisposedOnUnload()
        {
            var wrapper = CreateStubExecutor();
            var mate = new TestableMultiAssemblyTestEnvironment();
            var assembly = mate.Load(wrapper);

            mate.Unload(assembly);

            Assert.True(wrapper.Dispose__Called);
        }
コード例 #15
0
        public void ReturnsLoadedAssembly()
        {
            var wrapper = CreateStubExecutor();
            var mate = new TestableMultiAssemblyTestEnvironment();

            var testAssembly = mate.Load(wrapper);

            Assert.Same(wrapper, testAssembly.ExecutorWrapper);
        }
コード例 #16
0
        public void NullExecutorWrapperThrows()
        {
            var mate = new TestableMultiAssemblyTestEnvironment();

            Assert.Throws<ArgumentNullException>(() => mate.Load((IExecutorWrapper)null));
        }
コード例 #17
0
        public void NullAssemblyNameThrows()
        {
            var mate = new TestableMultiAssemblyTestEnvironment();

            Assert.Throws<ArgumentNullException>(() => mate.Load((string)null));
            Assert.Throws<ArgumentNullException>(() => mate.Load(null, "configFile"));
        }
コード例 #18
0
        public void UnfilteredReturnsAllTestsFromAllClasses()
        {
            var mate = new TestableMultiAssemblyTestEnvironment();
            var assembly1 = mate.Load(CreateStubExecutor());
            var assembly2 = mate.Load(CreateStubExecutor("assembly", "config"));

            var tests = mate.EnumerateTestMethods();

            Assert.Equal(8, tests.Count());
            Assert.True(tests.Any(tm => tm.TestClass.TestAssembly == assembly1 &&
                                        tm.DisplayName == "ThisIsTheType.NonSkipMethod"));
            Assert.True(tests.Any(tm => tm.TestClass.TestAssembly == assembly1 &&
                                        tm.DisplayName == "ThisIsTheType.SkipMethod"));
            Assert.True(tests.Any(tm => tm.TestClass.TestAssembly == assembly1 &&
                                        tm.DisplayName == "This is a custom display name"));
            Assert.True(tests.Any(tm => tm.TestClass.TestAssembly == assembly1 &&
                                        tm.DisplayName == "Monkey.DummyMethod"));
            Assert.True(tests.Any(tm => tm.TestClass.TestAssembly == assembly2 &&
                                        tm.DisplayName == "ThisIsTheType.NonSkipMethod"));
            Assert.True(tests.Any(tm => tm.TestClass.TestAssembly == assembly2 &&
                                        tm.DisplayName == "ThisIsTheType.SkipMethod"));
            Assert.True(tests.Any(tm => tm.TestClass.TestAssembly == assembly2 &&
                                        tm.DisplayName == "This is a custom display name"));
            Assert.True(tests.Any(tm => tm.TestClass.TestAssembly == assembly2 &&
                                        tm.DisplayName == "Monkey.DummyMethod"));
        }
コード例 #19
0
        public void FilterWithFalsePredicate()
        {
            var mate = new TestableMultiAssemblyTestEnvironment();
            var assembly1 = mate.Load(CreateStubExecutor());
            var assembly2 = mate.Load(CreateStubExecutor("assembly", "config"));

            var tests = mate.EnumerateTestMethods(testMethod => false);

            Assert.Equal(0, tests.Count());
        }
コード例 #20
0
        public void NullExecutorWrapperThrows()
        {
            var mate = new TestableMultiAssemblyTestEnvironment();

            Assert.Throws <ArgumentNullException>(() => mate.Load((IExecutorWrapper)null));
        }