Пример #1
0
        public void RunOnlyCallsRunOnAssembliesWithMethodsToBeRun()
        {
            var        mate             = TestableMultiAssemblyTestEnvironment.Create();
            var        callback         = new Mock <ITestMethodRunnerCallback>();
            TestMethod assembly1Method1 = mate.Assembly1.Object.EnumerateTestMethods().First();
            TestMethod assembly2Method2 = mate.Assembly2.Object.EnumerateTestMethods().First();

            mate.Assembly1.Setup(a => a.Run(new[] { assembly1Method1 }, callback.Object))
            .Returns("<assembly1/>")
            .Verifiable();

            mate.Run(new[] { assembly1Method1 }, callback.Object);

            mate.Assembly1.Verify();
            mate.Assembly2.Verify(c => c.Run(It.IsAny <IEnumerable <TestMethod> >(), callback.Object), Times.Never());
        }
Пример #2
0
        public void RunReturnsAssembliesXml()
        {
            var        mate             = TestableMultiAssemblyTestEnvironment.Create();
            var        callback         = new Mock <ITestMethodRunnerCallback>();
            TestMethod assembly1Method1 = mate.Assembly1.Object.EnumerateTestMethods().First();
            TestMethod assembly2Method2 = mate.Assembly2.Object.EnumerateTestMethods().First();

            mate.Assembly1.Setup(a => a.Run(new[] { assembly1Method1 }, callback.Object))
            .Returns("<assembly1/>")
            .Verifiable();
            mate.Assembly2.Setup(c => c.Run(new[] { assembly2Method2 }, callback.Object))
            .Returns("<assembly2/>")
            .Verifiable();

            var result = mate.Run(mate.EnumerateTestMethods(), callback.Object);

            Assert.Equal("<assemblies><assembly1/><assembly2/></assemblies>", result);
        }
Пример #3
0
        public void RunSortsClassesByAssemblyAndCallsRunOnAssemblies()
        {
            var        mate             = TestableMultiAssemblyTestEnvironment.Create();
            var        callback         = new Mock <ITestMethodRunnerCallback>();
            TestMethod assembly1Method1 = mate.Assembly1.Object.EnumerateTestMethods().First();
            TestMethod assembly2Method2 = mate.Assembly2.Object.EnumerateTestMethods().First();

            mate.Assembly1.Setup(a => a.Run(new[] { assembly1Method1 }, callback.Object))
            .Returns("<assembly1/>")
            .Verifiable();
            mate.Assembly2.Setup(c => c.Run(new[] { assembly2Method2 }, callback.Object))
            .Returns("<assembly2/>")
            .Verifiable();

            mate.Run(mate.EnumerateTestMethods(), callback.Object);

            mate.Assembly1.Verify();
            mate.Assembly2.Verify();
        }