Ejemplo n.º 1
0
        public void RunAssemblyPassesCorrectOptionsToTheLauncher()
        {
            StubbedLocalTestRunner tr = new StubbedLocalTestRunner();

            Assembly assembly     = typeof(TDNetAddInTests).Assembly;
            string   assemblyPath = AssemblyUtils.GetAssemblyLocalPath(assembly);

            tr.SetRunLauncherAction(delegate(TestLauncher launcher)
            {
                AssertTestLauncherOptions(launcher, assemblyPath, "*");

                return(new TestLauncherResult(new Report()));
            });

            FacadeOptions facadeOptions = new FacadeOptions();

            tr.Run(MockRepository.GenerateStub <IFacadeTestListener>(), assemblyPath, null, facadeOptions);
        }
Ejemplo n.º 2
0
        public void RunReturnsCorrectResultCode(int resultCode, FacadeTestRunState expectedRunState)
        {
            StubbedLocalTestRunner tr = new StubbedLocalTestRunner();

            Assembly assembly     = typeof(TDNetAddInTests).Assembly;
            string   assemblyPath = AssemblyUtils.GetAssemblyLocalPath(assembly);

            tr.SetRunLauncherAction(delegate
            {
                TestLauncherResult result = new TestLauncherResult(new Report());
                result.SetResultCode(resultCode);
                return(result);
            });

            FacadeOptions      facadeOptions = new FacadeOptions();
            FacadeTestRunState runResult     = tr.Run(MockRepository.GenerateStub <IFacadeTestListener>(), assemblyPath, null, facadeOptions);

            Assert.AreEqual(expectedRunState, runResult);
        }
Ejemplo n.º 3
0
        public void RunNamespacePassesCorrectOptionsToTheLauncher()
        {
            StubbedLocalTestRunner tr = new StubbedLocalTestRunner();

            Assembly assembly     = typeof(TDNetAddInTests).Assembly;
            string   assemblyPath = AssemblyUtils.GetAssemblyLocalPath(assembly);
            string   @namespace   = "Foo";

            tr.SetRunLauncherAction(delegate(TestLauncher launcher)
            {
                AssertTestLauncherOptions(launcher, AssemblyUtils.GetAssemblyLocalPath(assembly),
                                          string.Format("Namespace: {0}", @namespace));

                return(new TestLauncherResult(new Report()));
            });

            FacadeOptions facadeOptions = new FacadeOptions();

            tr.Run(MockRepository.GenerateStub <IFacadeTestListener>(), assemblyPath, "N:" + @namespace, facadeOptions);
        }
Ejemplo n.º 4
0
        public void RunMemberWithTypePassesCorrectOptionsToTheLauncher()
        {
            StubbedLocalTestRunner tr = new StubbedLocalTestRunner();

            Type     type         = typeof(TDNetAddInTests);
            Assembly assembly     = type.Assembly;
            string   assemblyPath = AssemblyUtils.GetAssemblyLocalPath(assembly);

            tr.SetRunLauncherAction(delegate(TestLauncher launcher)
            {
                AssertTestLauncherOptions(launcher, assemblyPath,
                                          string.Format("Type: {0}", type.FullName));

                return(new TestLauncherResult(new Report()));
            });

            FacadeOptions facadeOptions = new FacadeOptions();

            tr.Run(MockRepository.GenerateStub <IFacadeTestListener>(), assemblyPath, "T:" + type.FullName, facadeOptions);
        }
Ejemplo n.º 5
0
        public void RunMemberWithMethodPassesCorrectOptionsToTheLauncher()
        {
            StubbedLocalTestRunner tr = new StubbedLocalTestRunner();

            MethodBase method       = Reflector.GetExecutingFunction().Resolve(true);
            Assembly   assembly     = method.DeclaringType.Assembly;
            string     assemblyPath = AssemblyUtils.GetAssemblyLocalPath(assembly);

            tr.SetRunLauncherAction(delegate(TestLauncher launcher)
            {
                AssertTestLauncherOptions(launcher, AssemblyUtils.GetAssemblyLocalPath(assembly),
                                          string.Format("(Type: {0} and Member: {1})", method.DeclaringType.FullName, method.Name));

                return(new TestLauncherResult(new Report()));
            });

            FacadeOptions facadeOptions = new FacadeOptions();

            tr.Run(MockRepository.GenerateStub <IFacadeTestListener>(), assemblyPath,
                   "M:" + method.DeclaringType.FullName + "." + method.Name, facadeOptions);
        }
Ejemplo n.º 6
0
        public void RunWithExclusionCategoryFilterPassesCorrectOptionsToTheLauncher()
        {
            StubbedLocalTestRunner tr = new StubbedLocalTestRunner();

            Assembly assembly     = typeof(TDNetAddInTests).Assembly;
            string   assemblyPath = AssemblyUtils.GetAssemblyLocalPath(assembly);
            string   @namespace   = "Foo";

            tr.SetRunLauncherAction(delegate(TestLauncher launcher)
            {
                AssertTestLauncherOptions(launcher, AssemblyUtils.GetAssemblyLocalPath(assembly),
                                          string.Format("exclude Category: {0}, {1} include Namespace: {2}", "abc", "def", @namespace));

                return(new TestLauncherResult(new Report()));
            });

            FacadeOptions facadeOptions = new FacadeOptions()
            {
                FilterCategoryMode  = FacadeFilterCategoryMode.Exclude,
                FilterCategoryNames = new string[] { "abc", "def" }
            };

            tr.Run(MockRepository.GenerateStub <IFacadeTestListener>(), assemblyPath, "N:" + @namespace, facadeOptions);
        }
Ejemplo n.º 7
0
        public void RunReturnsCorrectResultCode(int resultCode, FacadeTestRunState expectedRunState)
        {
            StubbedLocalTestRunner tr = new StubbedLocalTestRunner();

            Assembly assembly = typeof(TDNetAddInTests).Assembly;
            string assemblyPath = AssemblyUtils.GetAssemblyLocalPath(assembly);
            tr.SetRunLauncherAction(delegate
            {
                TestLauncherResult result = new TestLauncherResult(new Report());
                result.SetResultCode(resultCode);
                return result;
            });

            FacadeOptions facadeOptions = new FacadeOptions();
            FacadeTestRunState runResult = tr.Run(MockRepository.GenerateStub<IFacadeTestListener>(), assemblyPath, null, facadeOptions);
            Assert.AreEqual(expectedRunState, runResult);
        }
Ejemplo n.º 8
0
        public void RunWithExclusionCategoryFilterPassesCorrectOptionsToTheLauncher()
        {
            StubbedLocalTestRunner tr = new StubbedLocalTestRunner();

            Assembly assembly = typeof(TDNetAddInTests).Assembly;
            string assemblyPath = AssemblyUtils.GetAssemblyLocalPath(assembly);
            string @namespace = "Foo";

            tr.SetRunLauncherAction(delegate(TestLauncher launcher)
            {
                AssertTestLauncherOptions(launcher, AssemblyUtils.GetAssemblyLocalPath(assembly),
                    string.Format("exclude Category: {0}, {1} include Namespace: {2}", "abc", "def", @namespace));

                return new TestLauncherResult(new Report());
            });

            FacadeOptions facadeOptions = new FacadeOptions()
            {
                FilterCategoryMode = FacadeFilterCategoryMode.Exclude,
                FilterCategoryNames = new string[] { "abc", "def" }
            };
            tr.Run(MockRepository.GenerateStub<IFacadeTestListener>(), assemblyPath, "N:" + @namespace, facadeOptions);
        }
Ejemplo n.º 9
0
        public void RunNamespacePassesCorrectOptionsToTheLauncher()
        {
            StubbedLocalTestRunner tr = new StubbedLocalTestRunner();

            Assembly assembly = typeof(TDNetAddInTests).Assembly;
            string assemblyPath = AssemblyUtils.GetAssemblyLocalPath(assembly);
            string @namespace = "Foo";

            tr.SetRunLauncherAction(delegate(TestLauncher launcher)
            {
                AssertTestLauncherOptions(launcher, AssemblyUtils.GetAssemblyLocalPath(assembly),
                    string.Format("Namespace: {0}", @namespace));

                return new TestLauncherResult(new Report());
            });

            FacadeOptions facadeOptions = new FacadeOptions();
            tr.Run(MockRepository.GenerateStub<IFacadeTestListener>(), assemblyPath, "N:" + @namespace, facadeOptions);
        }
Ejemplo n.º 10
0
        public void RunMemberWithMethodPassesCorrectOptionsToTheLauncher()
        {
            StubbedLocalTestRunner tr = new StubbedLocalTestRunner();

            MethodBase method = Reflector.GetExecutingFunction().Resolve(true);
            Assembly assembly = method.DeclaringType.Assembly;
            string assemblyPath = AssemblyUtils.GetAssemblyLocalPath(assembly);

            tr.SetRunLauncherAction(delegate(TestLauncher launcher)
            {
                AssertTestLauncherOptions(launcher, AssemblyUtils.GetAssemblyLocalPath(assembly),
                    string.Format("(Type: {0} and Member: {1})", method.DeclaringType.FullName, method.Name));

                return new TestLauncherResult(new Report());
            });

            FacadeOptions facadeOptions = new FacadeOptions();
            tr.Run(MockRepository.GenerateStub<IFacadeTestListener>(), assemblyPath,
                "M:" + method.DeclaringType.FullName + "." + method.Name, facadeOptions);
        }
Ejemplo n.º 11
0
        public void RunMemberWithTypePassesCorrectOptionsToTheLauncher()
        {
            StubbedLocalTestRunner tr = new StubbedLocalTestRunner();

            Type type = typeof(TDNetAddInTests);
            Assembly assembly = type.Assembly;
            string assemblyPath = AssemblyUtils.GetAssemblyLocalPath(assembly);

            tr.SetRunLauncherAction(delegate(TestLauncher launcher)
            {
                AssertTestLauncherOptions(launcher, assemblyPath,
                    string.Format("Type: {0}", type.FullName));

                return new TestLauncherResult(new Report());
            });

            FacadeOptions facadeOptions = new FacadeOptions();
            tr.Run(MockRepository.GenerateStub<IFacadeTestListener>(), assemblyPath, "T:" + type.FullName, facadeOptions);
        }
Ejemplo n.º 12
0
        public void RunAssemblyPassesCorrectOptionsToTheLauncher()
        {
            StubbedLocalTestRunner tr = new StubbedLocalTestRunner();

            Assembly assembly = typeof(TDNetAddInTests).Assembly;
            string assemblyPath = AssemblyUtils.GetAssemblyLocalPath(assembly);

            tr.SetRunLauncherAction(delegate(TestLauncher launcher)
            {
                AssertTestLauncherOptions(launcher, assemblyPath, "*");

                return new TestLauncherResult(new Report());
            });

            FacadeOptions facadeOptions = new FacadeOptions();
            tr.Run(MockRepository.GenerateStub<IFacadeTestListener>(), assemblyPath, null, facadeOptions);
        }