public void RunTests_WorkingDirSetForProject_TestPasses()
        {
            TestCase testCase = TestDataCreator.GetTestCases("WorkingDir.IsSolutionDirectory").First();
            var      settings = CreateSettings("foo", SettingsWrapper.SolutionDirPlaceholder);
            var      runner   = new SequentialTestRunner("", 0, "", MockFrameworkReporter.Object, TestEnvironment.Logger, settings, new SchedulingAnalyzer(TestEnvironment.Logger));

            runner.RunTests(testCase.Yield(), false, ProcessExecutorFactory);

            MockLogger.Verify(l => l.LogError(It.IsAny <string>()), Times.Never);
            MockFrameworkReporter.Verify(r => r.ReportTestResults(
                                             It.Is <IEnumerable <TestResult> >(tr => CheckSingleResultHasOutcome(tr, TestOutcome.Passed))), Times.Once);
        }
        public void RunTests_WorkingDirNotSet_TestFails()
        {
            var testCase = TestDataCreator.GetTestCases("WorkingDir.IsSolutionDirectory").First();
            var settings = CreateSettings(null, null);
            var runner   = new SequentialTestRunner("", 0, "", MockFrameworkReporter.Object, TestEnvironment.Logger, settings, new SchedulingAnalyzer(TestEnvironment.Logger));
            var executor = new ProcessExecutor(null, MockLogger.Object);

            runner.RunTests(testCase.Yield(), false, null, executor);

            MockLogger.Verify(l => l.LogError(It.IsAny <string>()), Times.Never);
            MockFrameworkReporter.Verify(r => r.ReportTestResults(
                                             It.Is <IEnumerable <TestResult> >(tr => CheckSingleResultHasOutcome(tr, TestOutcome.Failed))), Times.Once);
        }
        public void ReportExitCodeTestCases_Fail_CorrectResult()
        {
            _mockAggregator.Setup(a => a.ComputeAggregatedResults(It.IsAny <IEnumerable <ExecutableResult> >())).Returns(
                new List <ExecutableResult>
            {
                new ExecutableResult("Foo", 1)
            });
            _reporter.ReportExitCodeTestCases(null, false);

            MockFrameworkReporter
            .Verify(r => r.ReportTestResults(It.Is <IEnumerable <TestResult> >(
                                                 results => CheckResult(results.Single(), "Foo", TestOutcome.Failed))),
                    Times.Once);
        }
        public void ReportExitCodeTestCases_EmptyInput_EmptyResult()
        {
            MockOptions.Setup(o => o.ExitCodeTestCase).Returns("");
            _mockAggregator.Setup(a => a.ComputeAggregatedResults(It.IsAny <IEnumerable <ExecutableResult> >())).Returns(
                new List <ExecutableResult>
            {
                new ExecutableResult("Foo")
            });

            _reporter.ReportExitCodeTestCases(null, false);

            MockFrameworkReporter
            .Verify(r => r.ReportTestResults(It.IsAny <IEnumerable <TestResult> >()), Times.Never);
        }
        public void ReportExitCodeTestCases_PassWithOutput_CorrectResult()
        {
            _mockAggregator.Setup(a => a.ComputeAggregatedResults(It.IsAny <IEnumerable <ExecutableResult> >())).Returns(
                new List <ExecutableResult>
            {
                new ExecutableResult("Foo", exitCodeOutput: new List <string> {
                    "Output 1", "", "Output 2"
                })
            });
            _reporter.ReportExitCodeTestCases(null, false);

            MockFrameworkReporter
            .Verify(r => r.ReportTestResults(It.Is <IEnumerable <TestResult> >(
                                                 results => CheckResult(results.Single(), "Foo", TestOutcome.Passed, "Output 1", "Output 2"))),
                    Times.Once);
        }