public virtual void RunTests_WithoutPathExtension_ExecutionFails() { string baseDir = TestDataCreator.PreparePathExtensionTest(); try { string targetExe = TestDataCreator.GetPathExtensionExecutable(baseDir); var executor = new TestExecutor(TestEnvironment.Logger, TestEnvironment.Options); executor.RunTests(targetExe.Yield(), MockRunContext.Object, MockFrameworkHandle.Object); MockFrameworkHandle.Verify(h => h.RecordResult(It.IsAny <VsTestResult>()), Times.Never); MockLogger.Verify(l => l.LogError(It.IsAny <string>()), Times.Once); } finally { Utils.DeleteDirectory(baseDir).Should().BeTrue(); } }
public virtual void RunTests_WithPathExtension_ExecutionOk() { string baseDir = TestDataCreator.PreparePathExtensionTest(); try { string targetExe = TestDataCreator.GetPathExtensionExecutable(baseDir); MockOptions.Setup(o => o.PathExtension).Returns(SettingsWrapper.ExecutableDirPlaceholder + @"\..\dll"); var executor = new TestExecutor(TestEnvironment.Logger, TestEnvironment.Options); executor.RunTests(targetExe.Yield(), MockRunContext.Object, MockFrameworkHandle.Object); MockFrameworkHandle.Verify(h => h.RecordResult(It.Is <VsTestResult>(tr => tr.Outcome == VsTestOutcome.Passed)), Times.Once); MockFrameworkHandle.Verify(h => h.RecordResult(It.Is <VsTestResult>(tr => tr.Outcome == VsTestOutcome.Failed)), Times.Once); MockLogger.Verify(l => l.LogError(It.IsAny <string>()), Times.Never); } finally { Utils.DeleteDirectory(baseDir).Should().BeTrue(); } }