public void TestDiscoverTestsComplex()
        {
            QmlTestRunnerMock.Setup(m => m.Execute(It.IsRegex("-functions"), It.IsAny <IDiscoveryContext>())).Returns(
                new QmlTestRunnerResult("", FunctionsComplex, 0));

            TestDiscoverer.DiscoverTests(new string[] { Path }, null, FrameworkHandleMock.Object, DiscoverySinkMock.Object);

            DiscoverySinkMock.Verify(m => m.SendTestCase(It.IsAny <TestCase>()), Times.Exactly(5));
        }
예제 #2
0
        private void Execute(string functions, int functionsExitCode, string xml, int xmlExitCode)
        {
            QmlTestRunnerMock.Setup(m => m.Execute(It.IsRegex("-functions"), It.IsAny <IDiscoveryContext>())).Returns(
                new QmlTestRunnerResult("", functions, functionsExitCode));

            QmlTestRunnerMock.Setup(m => m.Execute(It.IsRegex("-xml"), It.IsAny <IDiscoveryContext>())).Returns(
                new QmlTestRunnerResult(xml, "", xmlExitCode));

            TestExecutor.RunTests(new string[] { Path }, null, FrameworkHandleMock.Object);
        }
        public void TestDiscoverTestsError()
        {
            QmlTestRunnerMock.Setup(m => m.Execute(It.IsRegex("-functions"), It.IsAny <IDiscoveryContext>())).Returns(
                new QmlTestRunnerResult("", FunctionsError, 1));

            TestDiscoverer.DiscoverTests(new string[] { Path }, null, FrameworkHandleMock.Object, DiscoverySinkMock.Object);

            DiscoverySinkMock.Verify(m => m.SendTestCase(It.IsAny <TestCase>()), Times.Never());

            FrameworkHandleMock.Verify(m => m.SendMessage(TestMessageLevel.Error, It.IsAny <string>()),
                                       Times.Once());
        }
        public void TestDiscoverTestsSimple()
        {
            QmlTestRunnerMock.Setup(m => m.Execute(It.IsRegex("-functions"), It.IsAny <IDiscoveryContext>())).Returns(
                new QmlTestRunnerResult("", FunctionsSimple, 0));

            TestDiscoverer.DiscoverTests(new string[] { Path }, null, FrameworkHandleMock.Object, DiscoverySinkMock.Object);

            DiscoverySinkMock.Verify(m => m.SendTestCase(It.Is <TestCase>(tc =>
                                                                          tc.FullyQualifiedName == "simpletest::test_simple" &&
                                                                          tc.CodeFilePath == Path &&
                                                                          tc.ExecutorUri == QmlTestExecutor.ExecutorUri &&
                                                                          tc.Source == Path
                                                                          )), Times.Once);
        }