Browse Source
Extended TestExecutionOptions to allow post processing of the NUnit ProcessStartInfo. Drop down button in Code Coverage pad is not working. Commented out some unit tests and code temporarily.newNRvisualizers
45 changed files with 1205 additions and 1057 deletions
@ -0,0 +1,47 @@
@@ -0,0 +1,47 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.IO; |
||||
|
||||
namespace ICSharpCode.CodeCoverage |
||||
{ |
||||
public class CodeCoverageResultsReader |
||||
{ |
||||
List<string> fileNames = new List<string>(); |
||||
IFileSystem fileSystem = new FileSystem(); |
||||
List<string> missingFileNames = new List<string>(); |
||||
|
||||
public CodeCoverageResultsReader() |
||||
{ |
||||
} |
||||
|
||||
public void AddResultsFile(string fileName) |
||||
{ |
||||
fileNames.Add(fileName); |
||||
} |
||||
|
||||
public IEnumerable<CodeCoverageResults> GetResults() |
||||
{ |
||||
foreach (string fileName in fileNames) { |
||||
if (fileSystem.FileExists(fileName)) { |
||||
yield return ReadCodeCoverageResults(fileName); |
||||
} else { |
||||
missingFileNames.Add(fileName); |
||||
} |
||||
} |
||||
} |
||||
|
||||
CodeCoverageResults ReadCodeCoverageResults(string fileName) |
||||
{ |
||||
TextReader reader = fileSystem.CreateTextReader(fileName); |
||||
return new CodeCoverageResults(reader); |
||||
} |
||||
|
||||
public IEnumerable<string> GetMissingResultsFiles() |
||||
{ |
||||
return missingFileNames; |
||||
} |
||||
} |
||||
} |
||||
@ -1,110 +1,110 @@
@@ -1,110 +1,110 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Diagnostics; |
||||
using System.IO; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using ICSharpCode.UnitTesting; |
||||
|
||||
namespace ICSharpCode.CodeCoverage |
||||
{ |
||||
public class CodeCoverageTestRunner : TestProcessRunnerBase |
||||
{ |
||||
UnitTestingOptions options; |
||||
IFileSystem fileSystem; |
||||
OpenCoverApplication partCoverApplication; |
||||
OpenCoverSettingsFactory settingsFactory; |
||||
|
||||
public CodeCoverageTestRunner() |
||||
: this(new CodeCoverageTestRunnerContext()) |
||||
{ |
||||
} |
||||
|
||||
public CodeCoverageTestRunner(CodeCoverageTestRunnerContext context) |
||||
: base(context) |
||||
{ |
||||
this.options = context.Options; |
||||
this.fileSystem = context.CodeCoverageFileSystem; |
||||
settingsFactory = new OpenCoverSettingsFactory(fileSystem); |
||||
} |
||||
|
||||
public bool HasCodeCoverageResults() |
||||
{ |
||||
return fileSystem.FileExists(CodeCoverageResultsFileName); |
||||
} |
||||
|
||||
public CodeCoverageResults ReadCodeCoverageResults() |
||||
{ |
||||
TextReader reader = fileSystem.CreateTextReader(CodeCoverageResultsFileName); |
||||
return new CodeCoverageResults(reader); |
||||
} |
||||
|
||||
public string CodeCoverageResultsFileName { |
||||
get { return partCoverApplication.CodeCoverageResultsFileName; } |
||||
} |
||||
|
||||
public override void Start(SelectedTests selectedTests) |
||||
{ |
||||
AddProfilerEnvironmentVariableToProcessRunner(); |
||||
CreatePartCoverApplication(selectedTests); |
||||
RemoveExistingCodeCoverageResultsFile(); |
||||
CreateDirectoryForCodeCoverageResultsFile(); |
||||
AppendRunningCodeCoverageMessage(); |
||||
|
||||
base.Start(selectedTests); |
||||
} |
||||
|
||||
void AddProfilerEnvironmentVariableToProcessRunner() |
||||
{ |
||||
ProcessRunner.EnvironmentVariables.Add("COMPLUS_ProfAPI_ProfilerCompatibilitySetting", "EnableV2Profiler"); |
||||
} |
||||
|
||||
void CreatePartCoverApplication(SelectedTests selectedTests) |
||||
{ |
||||
NUnitConsoleApplication nunitConsoleApp = new NUnitConsoleApplication(selectedTests, options); |
||||
nunitConsoleApp.Results = base.TestResultsMonitor.FileName; |
||||
|
||||
OpenCoverSettings settings = settingsFactory.CreateOpenCoverSettings(selectedTests.Project); |
||||
partCoverApplication = new OpenCoverApplication(nunitConsoleApp, settings); |
||||
} |
||||
|
||||
void RemoveExistingCodeCoverageResultsFile() |
||||
{ |
||||
string fileName = CodeCoverageResultsFileName; |
||||
if (fileSystem.FileExists(fileName)) { |
||||
fileSystem.DeleteFile(fileName); |
||||
} |
||||
} |
||||
|
||||
void CreateDirectoryForCodeCoverageResultsFile() |
||||
{ |
||||
string directory = Path.GetDirectoryName(CodeCoverageResultsFileName); |
||||
if (!fileSystem.DirectoryExists(directory)) { |
||||
fileSystem.CreateDirectory(directory); |
||||
} |
||||
} |
||||
|
||||
void AppendRunningCodeCoverageMessage() |
||||
{ |
||||
string message = ParseString("${res:ICSharpCode.CodeCoverage.RunningCodeCoverage}"); |
||||
OnMessageReceived(message); |
||||
} |
||||
|
||||
protected virtual string ParseString(string text) |
||||
{ |
||||
return StringParser.Parse(text); |
||||
} |
||||
|
||||
protected override ProcessStartInfo GetProcessStartInfo(SelectedTests selectedTests) |
||||
{ |
||||
return partCoverApplication.GetProcessStartInfo(); |
||||
} |
||||
|
||||
protected override TestResult CreateTestResultForTestFramework(TestResult testResult) |
||||
{ |
||||
return new NUnitTestResult(testResult); |
||||
} |
||||
} |
||||
} |
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using System.Diagnostics;
|
||||
//using System.IO;
|
||||
//using ICSharpCode.Core;
|
||||
//using ICSharpCode.SharpDevelop.Project;
|
||||
//using ICSharpCode.UnitTesting;
|
||||
//
|
||||
//namespace ICSharpCode.CodeCoverage
|
||||
//{
|
||||
// public class CodeCoverageTestRunner : TestProcessRunnerBase
|
||||
// {
|
||||
// UnitTestingOptions options;
|
||||
// IFileSystem fileSystem;
|
||||
// OpenCoverApplication partCoverApplication;
|
||||
// OpenCoverSettingsFactory settingsFactory;
|
||||
//
|
||||
// public CodeCoverageTestRunner()
|
||||
// : this(new CodeCoverageTestRunnerContext())
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public CodeCoverageTestRunner(CodeCoverageTestRunnerContext context)
|
||||
// : base(context)
|
||||
// {
|
||||
// this.options = context.Options;
|
||||
// this.fileSystem = context.CodeCoverageFileSystem;
|
||||
// settingsFactory = new OpenCoverSettingsFactory(fileSystem);
|
||||
// }
|
||||
//
|
||||
// public bool HasCodeCoverageResults()
|
||||
// {
|
||||
// return fileSystem.FileExists(CodeCoverageResultsFileName);
|
||||
// }
|
||||
//
|
||||
// public CodeCoverageResults ReadCodeCoverageResults()
|
||||
// {
|
||||
// TextReader reader = fileSystem.CreateTextReader(CodeCoverageResultsFileName);
|
||||
// return new CodeCoverageResults(reader);
|
||||
// }
|
||||
//
|
||||
// public string CodeCoverageResultsFileName {
|
||||
// get { return partCoverApplication.CodeCoverageResultsFileName; }
|
||||
// }
|
||||
//
|
||||
// public override void Start(SelectedTests selectedTests)
|
||||
// {
|
||||
// AddProfilerEnvironmentVariableToProcessRunner();
|
||||
// CreatePartCoverApplication(selectedTests);
|
||||
// RemoveExistingCodeCoverageResultsFile();
|
||||
// CreateDirectoryForCodeCoverageResultsFile();
|
||||
// AppendRunningCodeCoverageMessage();
|
||||
//
|
||||
// base.Start(selectedTests);
|
||||
// }
|
||||
//
|
||||
// void AddProfilerEnvironmentVariableToProcessRunner()
|
||||
// {
|
||||
// ProcessRunner.EnvironmentVariables.Add("COMPLUS_ProfAPI_ProfilerCompatibilitySetting", "EnableV2Profiler");
|
||||
// }
|
||||
//
|
||||
// void CreatePartCoverApplication(SelectedTests selectedTests)
|
||||
// {
|
||||
// NUnitConsoleApplication nunitConsoleApp = new NUnitConsoleApplication(selectedTests, options);
|
||||
// nunitConsoleApp.Results = base.TestResultsMonitor.FileName;
|
||||
//
|
||||
// OpenCoverSettings settings = settingsFactory.CreateOpenCoverSettings(selectedTests.Project);
|
||||
// partCoverApplication = new OpenCoverApplication(nunitConsoleApp, settings);
|
||||
// }
|
||||
//
|
||||
// void RemoveExistingCodeCoverageResultsFile()
|
||||
// {
|
||||
// string fileName = CodeCoverageResultsFileName;
|
||||
// if (fileSystem.FileExists(fileName)) {
|
||||
// fileSystem.DeleteFile(fileName);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// void CreateDirectoryForCodeCoverageResultsFile()
|
||||
// {
|
||||
// string directory = Path.GetDirectoryName(CodeCoverageResultsFileName);
|
||||
// if (!fileSystem.DirectoryExists(directory)) {
|
||||
// fileSystem.CreateDirectory(directory);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// void AppendRunningCodeCoverageMessage()
|
||||
// {
|
||||
// string message = ParseString("${res:ICSharpCode.CodeCoverage.RunningCodeCoverage}");
|
||||
// OnMessageReceived(message);
|
||||
// }
|
||||
//
|
||||
// protected virtual string ParseString(string text)
|
||||
// {
|
||||
// return StringParser.Parse(text);
|
||||
// }
|
||||
//
|
||||
// protected override ProcessStartInfo GetProcessStartInfo(SelectedTests selectedTests)
|
||||
// {
|
||||
// return partCoverApplication.GetProcessStartInfo();
|
||||
// }
|
||||
//
|
||||
// protected override TestResult CreateTestResultForTestFramework(TestResult testResult)
|
||||
// {
|
||||
// return new NUnitTestResult(testResult);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,40 +1,40 @@
@@ -1,40 +1,40 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.UnitTesting; |
||||
|
||||
namespace ICSharpCode.CodeCoverage |
||||
{ |
||||
public class CodeCoverageTestRunnerContext : TestProcessRunnerBaseContext |
||||
{ |
||||
UnitTestingOptions options; |
||||
|
||||
public CodeCoverageTestRunnerContext() |
||||
: this(new UnitTestProcessRunner(), |
||||
new TestResultsMonitor(), |
||||
new FileSystem(), |
||||
new UnitTestMessageService(), |
||||
new UnitTestingOptions()) |
||||
{ |
||||
} |
||||
|
||||
public CodeCoverageTestRunnerContext(IUnitTestProcessRunner processRunner, |
||||
ITestResultsMonitor testResultsMonitor, |
||||
ICSharpCode.CodeCoverage.IFileSystem fileSystem, |
||||
IUnitTestMessageService messageService, |
||||
UnitTestingOptions options) |
||||
: base(processRunner, testResultsMonitor, fileSystem, messageService) |
||||
{ |
||||
this.options = options; |
||||
} |
||||
|
||||
public UnitTestingOptions Options { |
||||
get { return options; } |
||||
} |
||||
|
||||
public ICSharpCode.CodeCoverage.IFileSystem CodeCoverageFileSystem { |
||||
get { return base.FileSystem as ICSharpCode.CodeCoverage.IFileSystem; } |
||||
} |
||||
} |
||||
} |
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.UnitTesting;
|
||||
//
|
||||
//namespace ICSharpCode.CodeCoverage
|
||||
//{
|
||||
// public class CodeCoverageTestRunnerContext : TestProcessRunnerBaseContext
|
||||
// {
|
||||
// UnitTestingOptions options;
|
||||
//
|
||||
// public CodeCoverageTestRunnerContext()
|
||||
// : this(new UnitTestProcessRunner(),
|
||||
// new TestResultsMonitor(),
|
||||
// new FileSystem(),
|
||||
// new UnitTestMessageService(),
|
||||
// new UnitTestingOptions())
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public CodeCoverageTestRunnerContext(IUnitTestProcessRunner processRunner,
|
||||
// ITestResultsMonitor testResultsMonitor,
|
||||
// ICSharpCode.CodeCoverage.IFileSystem fileSystem,
|
||||
// IUnitTestMessageService messageService,
|
||||
// UnitTestingOptions options)
|
||||
// : base(processRunner, testResultsMonitor, fileSystem, messageService)
|
||||
// {
|
||||
// this.options = options;
|
||||
// }
|
||||
//
|
||||
// public UnitTestingOptions Options {
|
||||
// get { return options; }
|
||||
// }
|
||||
//
|
||||
// public ICSharpCode.CodeCoverage.IFileSystem CodeCoverageFileSystem {
|
||||
// get { return base.FileSystem as ICSharpCode.CodeCoverage.IFileSystem; }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,16 +1,16 @@
@@ -1,16 +1,16 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.UnitTesting; |
||||
|
||||
namespace ICSharpCode.CodeCoverage |
||||
{ |
||||
public class CodeCoverageTestRunnerFactory : ICodeCoverageTestRunnerFactory |
||||
{ |
||||
public CodeCoverageTestRunner CreateCodeCoverageTestRunner() |
||||
{ |
||||
return new CodeCoverageTestRunner(); |
||||
} |
||||
} |
||||
} |
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.UnitTesting;
|
||||
//
|
||||
//namespace ICSharpCode.CodeCoverage
|
||||
//{
|
||||
// public class CodeCoverageTestRunnerFactory : ICodeCoverageTestRunnerFactory
|
||||
// {
|
||||
// public CodeCoverageTestRunner CreateCodeCoverageTestRunner()
|
||||
// {
|
||||
// return new CodeCoverageTestRunner();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,12 +1,12 @@
@@ -1,12 +1,12 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
|
||||
namespace ICSharpCode.CodeCoverage |
||||
{ |
||||
public interface ICodeCoverageTestRunnerFactory |
||||
{ |
||||
CodeCoverageTestRunner CreateCodeCoverageTestRunner(); |
||||
} |
||||
} |
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//
|
||||
//namespace ICSharpCode.CodeCoverage
|
||||
//{
|
||||
// public interface ICodeCoverageTestRunnerFactory
|
||||
// {
|
||||
// CodeCoverageTestRunner CreateCodeCoverageTestRunner();
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,237 +1,237 @@
@@ -1,237 +1,237 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Diagnostics; |
||||
using System.IO; |
||||
using System.Text; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.CodeCoverage; |
||||
using ICSharpCode.CodeCoverage.Tests.Utils; |
||||
using ICSharpCode.SharpDevelop; |
||||
using ICSharpCode.UnitTesting; |
||||
using NUnit.Framework; |
||||
using UnitTesting.Tests.Utils; |
||||
|
||||
namespace ICSharpCode.CodeCoverage.Tests.Testing |
||||
{ |
||||
[TestFixture] |
||||
public class CodeCoverageTestRunnerTests |
||||
{ |
||||
MockProcessRunner processRunner; |
||||
MockTestResultsMonitor testResultsMonitor; |
||||
UnitTestingOptions options; |
||||
DerivedCodeCoverageTestRunner testRunner; |
||||
MockFileSystem fileSystem; |
||||
MockMessageService messageService; |
||||
|
||||
[SetUp] |
||||
public void Init() |
||||
{ |
||||
processRunner = new MockProcessRunner(); |
||||
testResultsMonitor = new MockTestResultsMonitor(); |
||||
options = new UnitTestingOptions(new Properties()); |
||||
fileSystem = new MockFileSystem(); |
||||
messageService = new MockMessageService(); |
||||
testRunner = new DerivedCodeCoverageTestRunner(processRunner, testResultsMonitor, options, fileSystem, messageService); |
||||
} |
||||
|
||||
[Test] |
||||
public void CreateTestResultForTestFrameworkReturnsNUnitTestResult() |
||||
{ |
||||
TestResult testResult = new TestResult("abc"); |
||||
Assert.IsInstanceOf(typeof(NUnitTestResult), testRunner.CallCreateTestResultForTestFramework(testResult)); |
||||
} |
||||
|
||||
[Test] |
||||
public void HasCodeCoverageResultsWhenCoverageFileExistsReturnsTrue() |
||||
{ |
||||
StartTestRunner(); |
||||
|
||||
fileSystem.FileExistsReturnValue = true; |
||||
|
||||
Assert.IsTrue(testRunner.HasCodeCoverageResults()); |
||||
} |
||||
|
||||
void StartTestRunner() |
||||
{ |
||||
FileUtility.ApplicationRootPath = @"d:\sharpdevelop"; |
||||
MockCSharpProject project = new MockCSharpProject(); |
||||
SelectedTests tests = new SelectedTests(project); |
||||
testRunner.Start(tests); |
||||
} |
||||
|
||||
[Test] |
||||
public void HasCodeCoverageResultsWhenCoverageFileDoesNotExistsReturnsFalse() |
||||
{ |
||||
fileSystem.FileExistsReturnValue = false; |
||||
StartTestRunner(); |
||||
Assert.IsFalse(testRunner.HasCodeCoverageResults()); |
||||
} |
||||
|
||||
[Test] |
||||
public void HasCodeCoverageResultsAfterTestRunChecksPassesCodeCoverageFileToFileExistsMethod() |
||||
{ |
||||
fileSystem.FileExistsReturnValue = false; |
||||
fileSystem.FileExistsPathParameter = null; |
||||
StartTestRunner(); |
||||
testRunner.HasCodeCoverageResults(); |
||||
|
||||
string expectedFileName = |
||||
@"c:\projects\MyTests\OpenCover\coverage.xml"; |
||||
|
||||
Assert.AreEqual(expectedFileName, fileSystem.FileExistsPathParameter); |
||||
} |
||||
|
||||
[Test] |
||||
public void ReadCodeCoverageResultsAfterTestRunChecksPassesCodeCoverageFileToCreateTextReaderMethod() |
||||
{ |
||||
StartTestRunner(); |
||||
|
||||
fileSystem.FileExistsReturnValue = true; |
||||
fileSystem.CreateTextReaderPathParameter = null; |
||||
fileSystem.CreateTextReaderReturnValue = new StringReader("<abc/>"); |
||||
|
||||
testRunner.ReadCodeCoverageResults(); |
||||
|
||||
string expectedFileName = |
||||
@"c:\projects\MyTests\OpenCover\coverage.xml"; |
||||
|
||||
Assert.AreEqual(expectedFileName, fileSystem.CreateTextReaderPathParameter); |
||||
} |
||||
|
||||
[Test] |
||||
public void GetProcessStartInfoWhenTestResultsFileNameSetReturnsCommandLineWithTestResultsFileName() |
||||
{ |
||||
FileUtility.ApplicationRootPath = @"d:\sharpdevelop"; |
||||
testResultsMonitor.FileName = @"d:\temp\results.txt"; |
||||
|
||||
fileSystem.CreateTextReaderReturnValue = CreatePartCoverSettingsTextReader(); |
||||
fileSystem.FileExistsReturnValue = true; |
||||
|
||||
MockCSharpProject project = new MockCSharpProject(); |
||||
SelectedTests tests = new SelectedTests(project); |
||||
testRunner.Start(tests); |
||||
ProcessStartInfo processStartInfo = testRunner.CallGetProcessStartInfo(tests); |
||||
|
||||
string expectedCommandLine = |
||||
"-register:user -target:\"d:\\sharpdevelop\\bin\\Tools\\NUnit\\nunit-console-x86.exe\" " + |
||||
"-targetdir:\"c:\\projects\\MyTests\\bin\\Debug\" " + |
||||
"-targetargs:\"\\\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\\\" /noxml /results=\\\"d:\\temp\\results.txt\\\"\" " + |
||||
"-output:\"c:\\projects\\MyTests\\OpenCover\\coverage.xml\" " + |
||||
"-filter:\"+[MyTests]* \""; |
||||
|
||||
Assert.AreEqual(expectedCommandLine, processStartInfo.Arguments); |
||||
} |
||||
|
||||
TextReader CreatePartCoverSettingsTextReader() |
||||
{ |
||||
OpenCoverSettings settings = new OpenCoverSettings(); |
||||
settings.Include.Add("[MyTests]*"); |
||||
StringBuilder text = new StringBuilder(); |
||||
StringWriter writer = new StringWriter(text); |
||||
settings.Save(writer); |
||||
|
||||
return new StringReader(text.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void StartSetsProfilerEnvironmentVariableInProcessRunner() |
||||
{ |
||||
StartTestRunner(); |
||||
string environmentVariableValue = processRunner.EnvironmentVariables["COMPLUS_ProfAPI_ProfilerCompatibilitySetting"]; |
||||
Assert.AreEqual("EnableV2Profiler", environmentVariableValue); |
||||
} |
||||
|
||||
[Test] |
||||
public void StartWhenCodeCoverageResultsFileExistsDeletesExistingCodeCoverageResultsFile() |
||||
{ |
||||
fileSystem.FileExistsReturnValue = true; |
||||
fileSystem.CreateTextReaderReturnValue = new StringReader("<abc/>"); |
||||
StartTestRunner(); |
||||
|
||||
string expectedFileName = @"c:\projects\MyTests\OpenCover\coverage.xml"; |
||||
Assert.AreEqual(expectedFileName, fileSystem.DeleteFilePathParameter); |
||||
} |
||||
|
||||
[Test] |
||||
public void StartWhenCodeCoverageResultsFileDoesNotExistsCodeCoverageResultsFileIsNotDeleted() |
||||
{ |
||||
fileSystem.FileExistsReturnValue = false; |
||||
StartTestRunner(); |
||||
|
||||
Assert.IsNull(fileSystem.DeleteFilePathParameter); |
||||
} |
||||
|
||||
[Test] |
||||
public void StartCreatesDirectoryCodeCoverageResultsFileIfDoesNotExist() |
||||
{ |
||||
fileSystem.DirectoryExistsReturnValue = false; |
||||
StartTestRunner(); |
||||
|
||||
string expectedDirectory = @"c:\projects\MyTests\OpenCover"; |
||||
Assert.AreEqual(expectedDirectory, fileSystem.CreateDirectoryPathParameter); |
||||
} |
||||
|
||||
[Test] |
||||
public void StartChecksDirectoryForCodeCoverageResultsExists() |
||||
{ |
||||
fileSystem.DirectoryExistsReturnValue = true; |
||||
StartTestRunner(); |
||||
|
||||
string expectedDirectory = @"c:\projects\MyTests\OpenCover"; |
||||
Assert.AreEqual(expectedDirectory, fileSystem.DirectoryExistsPathParameter); |
||||
} |
||||
|
||||
[Test] |
||||
public void StartDoesNotCreateDirectoryForCodeCoverageResultsFileIfItExists() |
||||
{ |
||||
fileSystem.DirectoryExistsReturnValue = true; |
||||
StartTestRunner(); |
||||
|
||||
Assert.IsNull(fileSystem.CreateDirectoryPathParameter); |
||||
} |
||||
|
||||
[Test] |
||||
public void StartFiresMessagesReceivedEventTwice() |
||||
{ |
||||
List<string> messages = new List<string>(); |
||||
testRunner.MessageReceived += delegate(object o, MessageReceivedEventArgs e) { |
||||
messages.Add(e.Message); |
||||
}; |
||||
|
||||
testRunner.ParseStringReturnValue = "Running code coverage"; |
||||
StartTestRunner(); |
||||
|
||||
string[] expectedMessages = new string[] { |
||||
"Running code coverage", |
||||
GetCodeCoverageCommandLine() |
||||
}; |
||||
|
||||
Assert.AreEqual(expectedMessages, messages.ToArray()); |
||||
} |
||||
|
||||
string GetCodeCoverageCommandLine() |
||||
{ |
||||
return |
||||
"\"d:\\sharpdevelop\\bin\\Tools\\OpenCover\\OpenCover.Console.exe\" -register:user " + |
||||
"-target:\"d:\\sharpdevelop\\bin\\Tools\\NUnit\\nunit-console-x86.exe\" " + |
||||
"-targetdir:\"c:\\projects\\MyTests\\bin\\Debug\" " + |
||||
"-targetargs:\"\\\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\\\" /noxml\" " + |
||||
"-output:\"c:\\projects\\MyTests\\OpenCover\\coverage.xml\" " + |
||||
"-filter:\"+[*]* \""; |
||||
} |
||||
|
||||
[Test] |
||||
public void StartParsesTextForRunningCodeCoverageMessages() |
||||
{ |
||||
testRunner.ParseStringReturnValue = "Running code coverage"; |
||||
StartTestRunner(); |
||||
|
||||
string expectedStringResource = "${res:ICSharpCode.CodeCoverage.RunningCodeCoverage}"; |
||||
|
||||
Assert.AreEqual(expectedStringResource, testRunner.ParseStringParameter); |
||||
} |
||||
} |
||||
} |
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Diagnostics;
|
||||
//using System.IO;
|
||||
//using System.Text;
|
||||
//using ICSharpCode.Core;
|
||||
//using ICSharpCode.CodeCoverage;
|
||||
//using ICSharpCode.CodeCoverage.Tests.Utils;
|
||||
//using ICSharpCode.SharpDevelop;
|
||||
//using ICSharpCode.UnitTesting;
|
||||
//using NUnit.Framework;
|
||||
//using UnitTesting.Tests.Utils;
|
||||
//
|
||||
//namespace ICSharpCode.CodeCoverage.Tests.Testing
|
||||
//{
|
||||
// [TestFixture]
|
||||
// public class CodeCoverageTestRunnerTests
|
||||
// {
|
||||
// MockProcessRunner processRunner;
|
||||
// MockTestResultsMonitor testResultsMonitor;
|
||||
// UnitTestingOptions options;
|
||||
// DerivedCodeCoverageTestRunner testRunner;
|
||||
// MockFileSystem fileSystem;
|
||||
// MockMessageService messageService;
|
||||
//
|
||||
// [SetUp]
|
||||
// public void Init()
|
||||
// {
|
||||
// processRunner = new MockProcessRunner();
|
||||
// testResultsMonitor = new MockTestResultsMonitor();
|
||||
// options = new UnitTestingOptions(new Properties());
|
||||
// fileSystem = new MockFileSystem();
|
||||
// messageService = new MockMessageService();
|
||||
// testRunner = new DerivedCodeCoverageTestRunner(processRunner, testResultsMonitor, options, fileSystem, messageService);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void CreateTestResultForTestFrameworkReturnsNUnitTestResult()
|
||||
// {
|
||||
// TestResult testResult = new TestResult("abc");
|
||||
// Assert.IsInstanceOf(typeof(NUnitTestResult), testRunner.CallCreateTestResultForTestFramework(testResult));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void HasCodeCoverageResultsWhenCoverageFileExistsReturnsTrue()
|
||||
// {
|
||||
// StartTestRunner();
|
||||
//
|
||||
// fileSystem.FileExistsReturnValue = true;
|
||||
//
|
||||
// Assert.IsTrue(testRunner.HasCodeCoverageResults());
|
||||
// }
|
||||
//
|
||||
// void StartTestRunner()
|
||||
// {
|
||||
// FileUtility.ApplicationRootPath = @"d:\sharpdevelop";
|
||||
// MockCSharpProject project = new MockCSharpProject();
|
||||
// SelectedTests tests = new SelectedTests(project);
|
||||
// testRunner.Start(tests);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void HasCodeCoverageResultsWhenCoverageFileDoesNotExistsReturnsFalse()
|
||||
// {
|
||||
// fileSystem.FileExistsReturnValue = false;
|
||||
// StartTestRunner();
|
||||
// Assert.IsFalse(testRunner.HasCodeCoverageResults());
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void HasCodeCoverageResultsAfterTestRunChecksPassesCodeCoverageFileToFileExistsMethod()
|
||||
// {
|
||||
// fileSystem.FileExistsReturnValue = false;
|
||||
// fileSystem.FileExistsPathParameter = null;
|
||||
// StartTestRunner();
|
||||
// testRunner.HasCodeCoverageResults();
|
||||
//
|
||||
// string expectedFileName =
|
||||
// @"c:\projects\MyTests\OpenCover\coverage.xml";
|
||||
//
|
||||
// Assert.AreEqual(expectedFileName, fileSystem.FileExistsPathParameter);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ReadCodeCoverageResultsAfterTestRunChecksPassesCodeCoverageFileToCreateTextReaderMethod()
|
||||
// {
|
||||
// StartTestRunner();
|
||||
//
|
||||
// fileSystem.FileExistsReturnValue = true;
|
||||
// fileSystem.CreateTextReaderPathParameter = null;
|
||||
// fileSystem.CreateTextReaderReturnValue = new StringReader("<abc/>");
|
||||
//
|
||||
// testRunner.ReadCodeCoverageResults();
|
||||
//
|
||||
// string expectedFileName =
|
||||
// @"c:\projects\MyTests\OpenCover\coverage.xml";
|
||||
//
|
||||
// Assert.AreEqual(expectedFileName, fileSystem.CreateTextReaderPathParameter);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void GetProcessStartInfoWhenTestResultsFileNameSetReturnsCommandLineWithTestResultsFileName()
|
||||
// {
|
||||
// FileUtility.ApplicationRootPath = @"d:\sharpdevelop";
|
||||
// testResultsMonitor.FileName = @"d:\temp\results.txt";
|
||||
//
|
||||
// fileSystem.CreateTextReaderReturnValue = CreatePartCoverSettingsTextReader();
|
||||
// fileSystem.FileExistsReturnValue = true;
|
||||
//
|
||||
// MockCSharpProject project = new MockCSharpProject();
|
||||
// SelectedTests tests = new SelectedTests(project);
|
||||
// testRunner.Start(tests);
|
||||
// ProcessStartInfo processStartInfo = testRunner.CallGetProcessStartInfo(tests);
|
||||
//
|
||||
// string expectedCommandLine =
|
||||
// "-register:user -target:\"d:\\sharpdevelop\\bin\\Tools\\NUnit\\nunit-console-x86.exe\" " +
|
||||
// "-targetdir:\"c:\\projects\\MyTests\\bin\\Debug\" " +
|
||||
// "-targetargs:\"\\\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\\\" /noxml /results=\\\"d:\\temp\\results.txt\\\"\" " +
|
||||
// "-output:\"c:\\projects\\MyTests\\OpenCover\\coverage.xml\" " +
|
||||
// "-filter:\"+[MyTests]* \"";
|
||||
//
|
||||
// Assert.AreEqual(expectedCommandLine, processStartInfo.Arguments);
|
||||
// }
|
||||
//
|
||||
// TextReader CreatePartCoverSettingsTextReader()
|
||||
// {
|
||||
// OpenCoverSettings settings = new OpenCoverSettings();
|
||||
// settings.Include.Add("[MyTests]*");
|
||||
// StringBuilder text = new StringBuilder();
|
||||
// StringWriter writer = new StringWriter(text);
|
||||
// settings.Save(writer);
|
||||
//
|
||||
// return new StringReader(text.ToString());
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void StartSetsProfilerEnvironmentVariableInProcessRunner()
|
||||
// {
|
||||
// StartTestRunner();
|
||||
// string environmentVariableValue = processRunner.EnvironmentVariables["COMPLUS_ProfAPI_ProfilerCompatibilitySetting"];
|
||||
// Assert.AreEqual("EnableV2Profiler", environmentVariableValue);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void StartWhenCodeCoverageResultsFileExistsDeletesExistingCodeCoverageResultsFile()
|
||||
// {
|
||||
// fileSystem.FileExistsReturnValue = true;
|
||||
// fileSystem.CreateTextReaderReturnValue = new StringReader("<abc/>");
|
||||
// StartTestRunner();
|
||||
//
|
||||
// string expectedFileName = @"c:\projects\MyTests\OpenCover\coverage.xml";
|
||||
// Assert.AreEqual(expectedFileName, fileSystem.DeleteFilePathParameter);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void StartWhenCodeCoverageResultsFileDoesNotExistsCodeCoverageResultsFileIsNotDeleted()
|
||||
// {
|
||||
// fileSystem.FileExistsReturnValue = false;
|
||||
// StartTestRunner();
|
||||
//
|
||||
// Assert.IsNull(fileSystem.DeleteFilePathParameter);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void StartCreatesDirectoryCodeCoverageResultsFileIfDoesNotExist()
|
||||
// {
|
||||
// fileSystem.DirectoryExistsReturnValue = false;
|
||||
// StartTestRunner();
|
||||
//
|
||||
// string expectedDirectory = @"c:\projects\MyTests\OpenCover";
|
||||
// Assert.AreEqual(expectedDirectory, fileSystem.CreateDirectoryPathParameter);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void StartChecksDirectoryForCodeCoverageResultsExists()
|
||||
// {
|
||||
// fileSystem.DirectoryExistsReturnValue = true;
|
||||
// StartTestRunner();
|
||||
//
|
||||
// string expectedDirectory = @"c:\projects\MyTests\OpenCover";
|
||||
// Assert.AreEqual(expectedDirectory, fileSystem.DirectoryExistsPathParameter);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void StartDoesNotCreateDirectoryForCodeCoverageResultsFileIfItExists()
|
||||
// {
|
||||
// fileSystem.DirectoryExistsReturnValue = true;
|
||||
// StartTestRunner();
|
||||
//
|
||||
// Assert.IsNull(fileSystem.CreateDirectoryPathParameter);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void StartFiresMessagesReceivedEventTwice()
|
||||
// {
|
||||
// List<string> messages = new List<string>();
|
||||
// testRunner.MessageReceived += delegate(object o, MessageReceivedEventArgs e) {
|
||||
// messages.Add(e.Message);
|
||||
// };
|
||||
//
|
||||
// testRunner.ParseStringReturnValue = "Running code coverage";
|
||||
// StartTestRunner();
|
||||
//
|
||||
// string[] expectedMessages = new string[] {
|
||||
// "Running code coverage",
|
||||
// GetCodeCoverageCommandLine()
|
||||
// };
|
||||
//
|
||||
// Assert.AreEqual(expectedMessages, messages.ToArray());
|
||||
// }
|
||||
//
|
||||
// string GetCodeCoverageCommandLine()
|
||||
// {
|
||||
// return
|
||||
// "\"d:\\sharpdevelop\\bin\\Tools\\OpenCover\\OpenCover.Console.exe\" -register:user " +
|
||||
// "-target:\"d:\\sharpdevelop\\bin\\Tools\\NUnit\\nunit-console-x86.exe\" " +
|
||||
// "-targetdir:\"c:\\projects\\MyTests\\bin\\Debug\" " +
|
||||
// "-targetargs:\"\\\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\\\" /noxml\" " +
|
||||
// "-output:\"c:\\projects\\MyTests\\OpenCover\\coverage.xml\" " +
|
||||
// "-filter:\"+[*]* \"";
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void StartParsesTextForRunningCodeCoverageMessages()
|
||||
// {
|
||||
// testRunner.ParseStringReturnValue = "Running code coverage";
|
||||
// StartTestRunner();
|
||||
//
|
||||
// string expectedStringResource = "${res:ICSharpCode.CodeCoverage.RunningCodeCoverage}";
|
||||
//
|
||||
// Assert.AreEqual(expectedStringResource, testRunner.ParseStringParameter);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,272 +1,272 @@
@@ -1,272 +1,272 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.IO; |
||||
using ICSharpCode.SharpDevelop; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.UnitTesting; |
||||
using NUnit.Framework; |
||||
using ICSharpCode.CodeCoverage.Tests.Utils; |
||||
using UnitTesting.Tests.Utils; |
||||
|
||||
namespace ICSharpCode.CodeCoverage.Tests.Testing |
||||
{ |
||||
[TestFixture] |
||||
public class RunTestWithCodeCoverageCommandTests |
||||
{ |
||||
DerivedRunTestWithCodeCoverageCommand command; |
||||
MockRunTestCommandContext context; |
||||
MockCodeCoverageTestRunnerFactory mockCodeCoverageTestRunnerFactory; |
||||
|
||||
[SetUp] |
||||
public void Init() |
||||
{ |
||||
context = new MockRunTestCommandContext(); |
||||
mockCodeCoverageTestRunnerFactory = new MockCodeCoverageTestRunnerFactory(); |
||||
command = new DerivedRunTestWithCodeCoverageCommand(context, mockCodeCoverageTestRunnerFactory); |
||||
} |
||||
|
||||
[Test] |
||||
public void OnBeforeRunTestsWhenNoCodeCoverageMessageViewCreatedCreatesNewMessageViewCategory() |
||||
{ |
||||
command.CodeCoverageMessageViewCategory = null; |
||||
command.CallOnBeforeRunTests(); |
||||
|
||||
Assert.AreEqual("CodeCoverage", command.CodeCoverageMessageViewCategory.Category); |
||||
} |
||||
|
||||
[Test] |
||||
public void OnBeforeRunTestsWhenNoCodeCoverageMessageViewCreatedCreatesNewMessageViewCategoryWithCodeCoverageDisplayCategoryName() |
||||
{ |
||||
command.CodeCoverageMessageViewCategory = null; |
||||
command.ParsedStringToReturn = "Code Coverage"; |
||||
command.CallOnBeforeRunTests(); |
||||
|
||||
string expectedDisplayCategoryName = "Code Coverage"; |
||||
Assert.AreEqual(expectedDisplayCategoryName, command.CodeCoverageMessageViewCategory.DisplayCategory); |
||||
} |
||||
|
||||
[Test] |
||||
public void OnBeforeRunTestsWhenNoCodeCoverageMessageViewCreatedPassedStringResourceToStringParser() |
||||
{ |
||||
command.CodeCoverageMessageViewCategory = null; |
||||
command.ParsedString = null; |
||||
command.CallOnBeforeRunTests(); |
||||
|
||||
string expectedStringResourceName = "${res:ICSharpCode.UnitTesting.CodeCoverage}"; |
||||
Assert.AreEqual(expectedStringResourceName, command.ParsedString); |
||||
} |
||||
|
||||
[Test] |
||||
public void OnBeforeRunTestsWhenCodeCoverageMessageViewCreatedPreviouslyDoesNotCreateAnotherMessageView() |
||||
{ |
||||
MessageViewCategory view = new MessageViewCategory("Test"); |
||||
command.CodeCoverageMessageViewCategory = view; |
||||
command.CallOnBeforeRunTests(); |
||||
Assert.AreEqual(view, command.CodeCoverageMessageViewCategory); |
||||
} |
||||
|
||||
[Test] |
||||
public void OnBeforeRunTestsClearsCodeCoverageMessageViewTextWithSafeAsyncCall() |
||||
{ |
||||
MessageViewCategory view = new MessageViewCategory("Test"); |
||||
view.AppendText("abc"); |
||||
command.CodeCoverageMessageViewCategory = view; |
||||
command.CallOnBeforeRunTests(); |
||||
|
||||
Assert.AreEqual(String.Empty, view.Text); |
||||
} |
||||
|
||||
[Test] |
||||
public void OnBeforeRunTestsClearsCodeCoverageResults() |
||||
{ |
||||
command.CallOnBeforeRunTests(); |
||||
|
||||
Action expectedAction = CodeCoverageService.ClearResults; |
||||
Assert.AreEqual(expectedAction, context.MockUnitTestWorkbench.SafeThreadAsyncMethodCalls[0]); |
||||
} |
||||
|
||||
[Test] |
||||
public void OnAfterRunTestsWhenNoCriticalTestErrorsCodeCoveragePadIsShown() |
||||
{ |
||||
context.MockTaskService.HasCriticalErrorsReturnValue = false; |
||||
PadDescriptor padDescriptor = AddCodeCoveragePadToMockWorkbench(); |
||||
command.CallOnAfterRunTests(); |
||||
|
||||
Action expectedAction = padDescriptor.BringPadToFront; |
||||
Assert.AreEqual(expectedAction, context.MockUnitTestWorkbench.SafeThreadAsyncMethodCalls[0]); |
||||
} |
||||
|
||||
PadDescriptor AddCodeCoveragePadToMockWorkbench() |
||||
{ |
||||
PadDescriptor padDescriptor = new PadDescriptor(typeof(CodeCoveragePad), "Code Coverage", String.Empty); |
||||
context.MockUnitTestWorkbench.AddPadDescriptor(padDescriptor); |
||||
return padDescriptor; |
||||
} |
||||
|
||||
[Test] |
||||
public void OnAfterRunTestsWhenCriticalErrorsCodeCoveragePadIsNotShown() |
||||
{ |
||||
context.MockTaskService.HasCriticalErrorsReturnValue = true; |
||||
PadDescriptor padDescriptor = AddCodeCoveragePadToMockWorkbench(); |
||||
command.CallOnAfterRunTests(); |
||||
|
||||
Assert.AreEqual(0, context.MockUnitTestWorkbench.SafeThreadAsyncMethodCalls.Count); |
||||
} |
||||
|
||||
[Test] |
||||
public void OnAfterRunTestsDoesNotTreatWarningsAsErrors() |
||||
{ |
||||
context.MockTaskService.TreatWarningsAsErrorsParameterPassedToHasCriticalErrors = true; |
||||
AddCodeCoveragePadToMockWorkbench(); |
||||
command.CallOnAfterRunTests(); |
||||
|
||||
Assert.IsFalse(context.MockTaskService.TreatWarningsAsErrorsParameterPassedToHasCriticalErrors); |
||||
} |
||||
|
||||
[Test] |
||||
public void MessageReceivedFromTestRunnerIsAddedToCodeCoverageMessageViewNotUnitTestsMessageView() |
||||
{ |
||||
command.CodeCoverageMessageViewCategory = null; |
||||
MessageReceivedEventArgs e = new MessageReceivedEventArgs("test"); |
||||
command.CallTestRunnerMessageReceived(this, e); |
||||
string expectedText = "test\r\n"; |
||||
Assert.AreEqual(expectedText, command.CodeCoverageMessageViewCategory.Text); |
||||
} |
||||
|
||||
[Test] |
||||
public void CreateTestRunnerCreatesNewCodeCoverageTestRunner() |
||||
{ |
||||
CodeCoverageTestRunner expectedTestRunner = mockCodeCoverageTestRunnerFactory.TestRunner; |
||||
Assert.AreEqual(expectedTestRunner, command.CallCreateTestRunner(null)); |
||||
} |
||||
|
||||
[Test] |
||||
public void CodeCoverageProcessExitsAndCodeCoverageFileExistsCausesCodeCoverageResultsToBeDisplayed() |
||||
{ |
||||
ActionArguments<CodeCoverageResults> actionArgs = |
||||
CreateTestRunnerAndFireCodeCoverageProcessExitEvent(); |
||||
|
||||
Action<CodeCoverageResults> expectedAction = CodeCoverageService.ShowResults; |
||||
Assert.AreEqual(expectedAction, actionArgs.Action); |
||||
} |
||||
|
||||
ActionArguments<CodeCoverageResults> CreateTestRunnerAndFireCodeCoverageProcessExitEvent() |
||||
{ |
||||
command.CallCreateTestRunner(null); |
||||
MockCSharpProject project = new MockCSharpProject(); |
||||
SelectedTests tests = new SelectedTests(project); |
||||
mockCodeCoverageTestRunnerFactory.FileSystem.FileExistsReturnValue = true; |
||||
mockCodeCoverageTestRunnerFactory.FileSystem.CreateTextReaderReturnValue = new StringReader("<a/>"); |
||||
mockCodeCoverageTestRunnerFactory.TestRunner.Start(tests); |
||||
|
||||
mockCodeCoverageTestRunnerFactory.FileSystem.CreateTextReaderReturnValue = CreateCodeCoverageResultsTextReader(); |
||||
|
||||
mockCodeCoverageTestRunnerFactory.ProcessRunner.FireProcessExitedEvent(); |
||||
|
||||
object actionArgsAsObject = context.MockUnitTestWorkbench.SafeThreadAsyncMethodCallsWithArguments[0]; |
||||
return (ActionArguments<CodeCoverageResults>)actionArgsAsObject; |
||||
} |
||||
|
||||
[Test] |
||||
public void CodeCoverageResultsFromXmlHasModuleCalledMyTests() |
||||
{ |
||||
CodeCoverageResults results = CreateCodeCoverageResults(); |
||||
string expectedName = "MyTests"; |
||||
Assert.AreEqual(expectedName, results.Modules[0].Name); |
||||
} |
||||
|
||||
CodeCoverageResults CreateCodeCoverageResults() |
||||
{ |
||||
TextReader reader = CreateCodeCoverageResultsTextReader(); |
||||
return new CodeCoverageResults(reader); |
||||
} |
||||
|
||||
TextReader CreateCodeCoverageResultsTextReader() |
||||
{ |
||||
string xml = |
||||
"<CoverageSession xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n" + |
||||
" <Modules>\r\n" + |
||||
" <Module hash=\"44-54-B6-13-97-49-45-F8-6A-74-9E-49-0C-77-87-C6-9C-54-47-7A\">\r\n" + |
||||
" <FullName>C:\\Projects\\MyTests\\bin\\MyTests.DLL</FullName>\r\n" + |
||||
" <ModuleName>MyTests</ModuleName>\r\n" + |
||||
" <Files>\r\n" + |
||||
" <File uid=\"1\" fullPath=\"c:\\Projects\\MyTests\\MyTestFixture.cs\" />\r\n" + |
||||
" </Files>\r\n" + |
||||
" <Classes>\r\n" + |
||||
" <Class>\r\n" + |
||||
" <FullName>MyTests.Tests.MyTestFixture</FullName>\r\n" + |
||||
" <Methods>\r\n" + |
||||
" <Method visited=\"true\" cyclomaticComplexity=\"1\" sequenceCoverage=\"100\" branchCoverage=\"100\" isConstructor=\"false\" isStatic=\"false\" isGetter=\"false\" isSetter=\"false\">\r\n" + |
||||
" <MetadataToken>100663297</MetadataToken>\r\n" + |
||||
" <Name>System.Void MyTests.Tests.MyTestFixture::SimpleTest1()</Name>\r\n" + |
||||
" <FileRef uid=\"1\" />\r\n" + |
||||
" <SequencePoints>\r\n" + |
||||
" <SequencePoint vc='12' sl='20' sc='3' el='20' ec='4'/>\r\n" + |
||||
" </SequencePoints>\r\n" + |
||||
" </Method>\r\n" + |
||||
" </Methods>\r\n" + |
||||
" </Class>\r\n" + |
||||
" </Classes>\r\n" + |
||||
" </Module>\r\n" + |
||||
" </Modules>\r\n" + |
||||
"</CoverageSession>"; |
||||
|
||||
return new StringReader(xml); |
||||
} |
||||
|
||||
[Test] |
||||
public void CodeCoverageProcessExitsAndCodeCoverageFileExistsCausesCodeCoverageResultsToBeReadFromFile() |
||||
{ |
||||
ActionArguments<CodeCoverageResults> actionArgs = |
||||
CreateTestRunnerAndFireCodeCoverageProcessExitEvent(); |
||||
|
||||
CodeCoverageResults result = actionArgs.Arg; |
||||
Assert.AreEqual("MyTests", result.Modules[0].Name); |
||||
} |
||||
|
||||
[Test] |
||||
public void CodeCoverageProcessExitsAndCodeCoverageFileDoesNotExistsAddsTaskToTaskList() |
||||
{ |
||||
ActionArguments<Task> args = CreateTestRunnerAndFirePartCoverProcessExitEventWhenNoCoverageFileProduced(); |
||||
Action<Task> expectedAction = context.MockTaskService.Add; |
||||
Assert.AreEqual(expectedAction, args.Action); |
||||
} |
||||
|
||||
ActionArguments<Task> CreateTestRunnerAndFirePartCoverProcessExitEventWhenNoCoverageFileProduced() |
||||
{ |
||||
command.CallCreateTestRunner(null); |
||||
|
||||
MockCSharpProject project = new MockCSharpProject(); |
||||
SelectedTests tests = new SelectedTests(project); |
||||
|
||||
mockCodeCoverageTestRunnerFactory.FileSystem.FileExistsReturnValue = true; |
||||
mockCodeCoverageTestRunnerFactory.FileSystem.CreateTextReaderReturnValue = new StringReader("<a/>"); |
||||
mockCodeCoverageTestRunnerFactory.TestRunner.Start(tests); |
||||
|
||||
mockCodeCoverageTestRunnerFactory.FileSystem.FileExistsReturnValue = false; |
||||
mockCodeCoverageTestRunnerFactory.ProcessRunner.FireProcessExitedEvent(); |
||||
|
||||
object actionArgsAsObject = context.MockUnitTestWorkbench.SafeThreadAsyncMethodCallsWithArguments[0]; |
||||
return (ActionArguments<Task>)actionArgsAsObject; |
||||
} |
||||
|
||||
[Test] |
||||
public void CodeCoverageProcessExitsAndCodeCoverageFileDoesNotExistsAddsErrorTaskToTaskList() |
||||
{ |
||||
command.ParsedStringToReturn = "No code coverage results file generated."; |
||||
ActionArguments<Task> args = CreateTestRunnerAndFirePartCoverProcessExitEventWhenNoCoverageFileProduced(); |
||||
Task task = args.Arg; |
||||
|
||||
string description = @"No code coverage results file generated. c:\projects\MyTests\OpenCover\coverage.xml"; |
||||
int column = 1; |
||||
int line = 1; |
||||
Task expectedTask = new Task(null, description, column, line, TaskType.Error); |
||||
|
||||
TaskComparison comparison = new TaskComparison(expectedTask, task); |
||||
|
||||
Assert.IsTrue(comparison.IsMatch, comparison.MismatchReason); |
||||
} |
||||
} |
||||
} |
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using System.IO;
|
||||
//using ICSharpCode.SharpDevelop;
|
||||
//using ICSharpCode.SharpDevelop.Gui;
|
||||
//using ICSharpCode.UnitTesting;
|
||||
//using NUnit.Framework;
|
||||
//using ICSharpCode.CodeCoverage.Tests.Utils;
|
||||
//using UnitTesting.Tests.Utils;
|
||||
//
|
||||
//namespace ICSharpCode.CodeCoverage.Tests.Testing
|
||||
//{
|
||||
// [TestFixture]
|
||||
// public class RunTestWithCodeCoverageCommandTests
|
||||
// {
|
||||
// DerivedRunTestWithCodeCoverageCommand command;
|
||||
// MockRunTestCommandContext context;
|
||||
// MockCodeCoverageTestRunnerFactory mockCodeCoverageTestRunnerFactory;
|
||||
//
|
||||
// [SetUp]
|
||||
// public void Init()
|
||||
// {
|
||||
// context = new MockRunTestCommandContext();
|
||||
// mockCodeCoverageTestRunnerFactory = new MockCodeCoverageTestRunnerFactory();
|
||||
// command = new DerivedRunTestWithCodeCoverageCommand(context, mockCodeCoverageTestRunnerFactory);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void OnBeforeRunTestsWhenNoCodeCoverageMessageViewCreatedCreatesNewMessageViewCategory()
|
||||
// {
|
||||
// command.CodeCoverageMessageViewCategory = null;
|
||||
// command.CallOnBeforeRunTests();
|
||||
//
|
||||
// Assert.AreEqual("CodeCoverage", command.CodeCoverageMessageViewCategory.Category);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void OnBeforeRunTestsWhenNoCodeCoverageMessageViewCreatedCreatesNewMessageViewCategoryWithCodeCoverageDisplayCategoryName()
|
||||
// {
|
||||
// command.CodeCoverageMessageViewCategory = null;
|
||||
// command.ParsedStringToReturn = "Code Coverage";
|
||||
// command.CallOnBeforeRunTests();
|
||||
//
|
||||
// string expectedDisplayCategoryName = "Code Coverage";
|
||||
// Assert.AreEqual(expectedDisplayCategoryName, command.CodeCoverageMessageViewCategory.DisplayCategory);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void OnBeforeRunTestsWhenNoCodeCoverageMessageViewCreatedPassedStringResourceToStringParser()
|
||||
// {
|
||||
// command.CodeCoverageMessageViewCategory = null;
|
||||
// command.ParsedString = null;
|
||||
// command.CallOnBeforeRunTests();
|
||||
//
|
||||
// string expectedStringResourceName = "${res:ICSharpCode.UnitTesting.CodeCoverage}";
|
||||
// Assert.AreEqual(expectedStringResourceName, command.ParsedString);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void OnBeforeRunTestsWhenCodeCoverageMessageViewCreatedPreviouslyDoesNotCreateAnotherMessageView()
|
||||
// {
|
||||
// MessageViewCategory view = new MessageViewCategory("Test");
|
||||
// command.CodeCoverageMessageViewCategory = view;
|
||||
// command.CallOnBeforeRunTests();
|
||||
// Assert.AreEqual(view, command.CodeCoverageMessageViewCategory);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void OnBeforeRunTestsClearsCodeCoverageMessageViewTextWithSafeAsyncCall()
|
||||
// {
|
||||
// MessageViewCategory view = new MessageViewCategory("Test");
|
||||
// view.AppendText("abc");
|
||||
// command.CodeCoverageMessageViewCategory = view;
|
||||
// command.CallOnBeforeRunTests();
|
||||
//
|
||||
// Assert.AreEqual(String.Empty, view.Text);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void OnBeforeRunTestsClearsCodeCoverageResults()
|
||||
// {
|
||||
// command.CallOnBeforeRunTests();
|
||||
//
|
||||
// Action expectedAction = CodeCoverageService.ClearResults;
|
||||
// Assert.AreEqual(expectedAction, context.MockUnitTestWorkbench.SafeThreadAsyncMethodCalls[0]);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void OnAfterRunTestsWhenNoCriticalTestErrorsCodeCoveragePadIsShown()
|
||||
// {
|
||||
// context.MockTaskService.HasCriticalErrorsReturnValue = false;
|
||||
// PadDescriptor padDescriptor = AddCodeCoveragePadToMockWorkbench();
|
||||
// command.CallOnAfterRunTests();
|
||||
//
|
||||
// Action expectedAction = padDescriptor.BringPadToFront;
|
||||
// Assert.AreEqual(expectedAction, context.MockUnitTestWorkbench.SafeThreadAsyncMethodCalls[0]);
|
||||
// }
|
||||
//
|
||||
// PadDescriptor AddCodeCoveragePadToMockWorkbench()
|
||||
// {
|
||||
// PadDescriptor padDescriptor = new PadDescriptor(typeof(CodeCoveragePad), "Code Coverage", String.Empty);
|
||||
// context.MockUnitTestWorkbench.AddPadDescriptor(padDescriptor);
|
||||
// return padDescriptor;
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void OnAfterRunTestsWhenCriticalErrorsCodeCoveragePadIsNotShown()
|
||||
// {
|
||||
// context.MockTaskService.HasCriticalErrorsReturnValue = true;
|
||||
// PadDescriptor padDescriptor = AddCodeCoveragePadToMockWorkbench();
|
||||
// command.CallOnAfterRunTests();
|
||||
//
|
||||
// Assert.AreEqual(0, context.MockUnitTestWorkbench.SafeThreadAsyncMethodCalls.Count);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void OnAfterRunTestsDoesNotTreatWarningsAsErrors()
|
||||
// {
|
||||
// context.MockTaskService.TreatWarningsAsErrorsParameterPassedToHasCriticalErrors = true;
|
||||
// AddCodeCoveragePadToMockWorkbench();
|
||||
// command.CallOnAfterRunTests();
|
||||
//
|
||||
// Assert.IsFalse(context.MockTaskService.TreatWarningsAsErrorsParameterPassedToHasCriticalErrors);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void MessageReceivedFromTestRunnerIsAddedToCodeCoverageMessageViewNotUnitTestsMessageView()
|
||||
// {
|
||||
// command.CodeCoverageMessageViewCategory = null;
|
||||
// MessageReceivedEventArgs e = new MessageReceivedEventArgs("test");
|
||||
// command.CallTestRunnerMessageReceived(this, e);
|
||||
// string expectedText = "test\r\n";
|
||||
// Assert.AreEqual(expectedText, command.CodeCoverageMessageViewCategory.Text);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void CreateTestRunnerCreatesNewCodeCoverageTestRunner()
|
||||
// {
|
||||
// CodeCoverageTestRunner expectedTestRunner = mockCodeCoverageTestRunnerFactory.TestRunner;
|
||||
// Assert.AreEqual(expectedTestRunner, command.CallCreateTestRunner(null));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void CodeCoverageProcessExitsAndCodeCoverageFileExistsCausesCodeCoverageResultsToBeDisplayed()
|
||||
// {
|
||||
// ActionArguments<CodeCoverageResults> actionArgs =
|
||||
// CreateTestRunnerAndFireCodeCoverageProcessExitEvent();
|
||||
//
|
||||
// Action<CodeCoverageResults> expectedAction = CodeCoverageService.ShowResults;
|
||||
// Assert.AreEqual(expectedAction, actionArgs.Action);
|
||||
// }
|
||||
//
|
||||
// ActionArguments<CodeCoverageResults> CreateTestRunnerAndFireCodeCoverageProcessExitEvent()
|
||||
// {
|
||||
// command.CallCreateTestRunner(null);
|
||||
// MockCSharpProject project = new MockCSharpProject();
|
||||
// SelectedTests tests = new SelectedTests(project);
|
||||
// mockCodeCoverageTestRunnerFactory.FileSystem.FileExistsReturnValue = true;
|
||||
// mockCodeCoverageTestRunnerFactory.FileSystem.CreateTextReaderReturnValue = new StringReader("<a/>");
|
||||
// mockCodeCoverageTestRunnerFactory.TestRunner.Start(tests);
|
||||
//
|
||||
// mockCodeCoverageTestRunnerFactory.FileSystem.CreateTextReaderReturnValue = CreateCodeCoverageResultsTextReader();
|
||||
//
|
||||
// mockCodeCoverageTestRunnerFactory.ProcessRunner.FireProcessExitedEvent();
|
||||
//
|
||||
// object actionArgsAsObject = context.MockUnitTestWorkbench.SafeThreadAsyncMethodCallsWithArguments[0];
|
||||
// return (ActionArguments<CodeCoverageResults>)actionArgsAsObject;
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void CodeCoverageResultsFromXmlHasModuleCalledMyTests()
|
||||
// {
|
||||
// CodeCoverageResults results = CreateCodeCoverageResults();
|
||||
// string expectedName = "MyTests";
|
||||
// Assert.AreEqual(expectedName, results.Modules[0].Name);
|
||||
// }
|
||||
//
|
||||
// CodeCoverageResults CreateCodeCoverageResults()
|
||||
// {
|
||||
// TextReader reader = CreateCodeCoverageResultsTextReader();
|
||||
// return new CodeCoverageResults(reader);
|
||||
// }
|
||||
//
|
||||
// TextReader CreateCodeCoverageResultsTextReader()
|
||||
// {
|
||||
// string xml =
|
||||
// "<CoverageSession xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n" +
|
||||
// " <Modules>\r\n" +
|
||||
// " <Module hash=\"44-54-B6-13-97-49-45-F8-6A-74-9E-49-0C-77-87-C6-9C-54-47-7A\">\r\n" +
|
||||
// " <FullName>C:\\Projects\\MyTests\\bin\\MyTests.DLL</FullName>\r\n" +
|
||||
// " <ModuleName>MyTests</ModuleName>\r\n" +
|
||||
// " <Files>\r\n" +
|
||||
// " <File uid=\"1\" fullPath=\"c:\\Projects\\MyTests\\MyTestFixture.cs\" />\r\n" +
|
||||
// " </Files>\r\n" +
|
||||
// " <Classes>\r\n" +
|
||||
// " <Class>\r\n" +
|
||||
// " <FullName>MyTests.Tests.MyTestFixture</FullName>\r\n" +
|
||||
// " <Methods>\r\n" +
|
||||
// " <Method visited=\"true\" cyclomaticComplexity=\"1\" sequenceCoverage=\"100\" branchCoverage=\"100\" isConstructor=\"false\" isStatic=\"false\" isGetter=\"false\" isSetter=\"false\">\r\n" +
|
||||
// " <MetadataToken>100663297</MetadataToken>\r\n" +
|
||||
// " <Name>System.Void MyTests.Tests.MyTestFixture::SimpleTest1()</Name>\r\n" +
|
||||
// " <FileRef uid=\"1\" />\r\n" +
|
||||
// " <SequencePoints>\r\n" +
|
||||
// " <SequencePoint vc='12' sl='20' sc='3' el='20' ec='4'/>\r\n" +
|
||||
// " </SequencePoints>\r\n" +
|
||||
// " </Method>\r\n" +
|
||||
// " </Methods>\r\n" +
|
||||
// " </Class>\r\n" +
|
||||
// " </Classes>\r\n" +
|
||||
// " </Module>\r\n" +
|
||||
// " </Modules>\r\n" +
|
||||
// "</CoverageSession>";
|
||||
//
|
||||
// return new StringReader(xml);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void CodeCoverageProcessExitsAndCodeCoverageFileExistsCausesCodeCoverageResultsToBeReadFromFile()
|
||||
// {
|
||||
// ActionArguments<CodeCoverageResults> actionArgs =
|
||||
// CreateTestRunnerAndFireCodeCoverageProcessExitEvent();
|
||||
//
|
||||
// CodeCoverageResults result = actionArgs.Arg;
|
||||
// Assert.AreEqual("MyTests", result.Modules[0].Name);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void CodeCoverageProcessExitsAndCodeCoverageFileDoesNotExistsAddsTaskToTaskList()
|
||||
// {
|
||||
// ActionArguments<Task> args = CreateTestRunnerAndFirePartCoverProcessExitEventWhenNoCoverageFileProduced();
|
||||
// Action<Task> expectedAction = context.MockTaskService.Add;
|
||||
// Assert.AreEqual(expectedAction, args.Action);
|
||||
// }
|
||||
//
|
||||
// ActionArguments<Task> CreateTestRunnerAndFirePartCoverProcessExitEventWhenNoCoverageFileProduced()
|
||||
// {
|
||||
// command.CallCreateTestRunner(null);
|
||||
//
|
||||
// MockCSharpProject project = new MockCSharpProject();
|
||||
// SelectedTests tests = new SelectedTests(project);
|
||||
//
|
||||
// mockCodeCoverageTestRunnerFactory.FileSystem.FileExistsReturnValue = true;
|
||||
// mockCodeCoverageTestRunnerFactory.FileSystem.CreateTextReaderReturnValue = new StringReader("<a/>");
|
||||
// mockCodeCoverageTestRunnerFactory.TestRunner.Start(tests);
|
||||
//
|
||||
// mockCodeCoverageTestRunnerFactory.FileSystem.FileExistsReturnValue = false;
|
||||
// mockCodeCoverageTestRunnerFactory.ProcessRunner.FireProcessExitedEvent();
|
||||
//
|
||||
// object actionArgsAsObject = context.MockUnitTestWorkbench.SafeThreadAsyncMethodCallsWithArguments[0];
|
||||
// return (ActionArguments<Task>)actionArgsAsObject;
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void CodeCoverageProcessExitsAndCodeCoverageFileDoesNotExistsAddsErrorTaskToTaskList()
|
||||
// {
|
||||
// command.ParsedStringToReturn = "No code coverage results file generated.";
|
||||
// ActionArguments<Task> args = CreateTestRunnerAndFirePartCoverProcessExitEventWhenNoCoverageFileProduced();
|
||||
// Task task = args.Arg;
|
||||
//
|
||||
// string description = @"No code coverage results file generated. c:\projects\MyTests\OpenCover\coverage.xml";
|
||||
// int column = 1;
|
||||
// int line = 1;
|
||||
// Task expectedTask = new Task(null, description, column, line, TaskType.Error);
|
||||
//
|
||||
// TaskComparison comparison = new TaskComparison(expectedTask, task);
|
||||
//
|
||||
// Assert.IsTrue(comparison.IsMatch, comparison.MismatchReason);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,41 +1,41 @@
@@ -1,41 +1,41 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Diagnostics; |
||||
using ICSharpCode.CodeCoverage; |
||||
using ICSharpCode.UnitTesting; |
||||
|
||||
namespace ICSharpCode.CodeCoverage.Tests.Utils |
||||
{ |
||||
public class DerivedCodeCoverageTestRunner : CodeCoverageTestRunner |
||||
{ |
||||
public string ParseStringReturnValue; |
||||
public string ParseStringParameter; |
||||
|
||||
public DerivedCodeCoverageTestRunner(IUnitTestProcessRunner processRunner, |
||||
ITestResultsMonitor testResultsMonitor, |
||||
UnitTestingOptions options, |
||||
IFileSystem fileSystem, |
||||
IUnitTestMessageService messageService) |
||||
: base(new CodeCoverageTestRunnerContext(processRunner, testResultsMonitor, fileSystem, messageService, options)) |
||||
{ |
||||
} |
||||
|
||||
public ProcessStartInfo CallGetProcessStartInfo(SelectedTests selectedTests) |
||||
{ |
||||
return base.GetProcessStartInfo(selectedTests); |
||||
} |
||||
|
||||
public TestResult CallCreateTestResultForTestFramework(TestResult testResult) |
||||
{ |
||||
return base.CreateTestResultForTestFramework(testResult); |
||||
} |
||||
|
||||
protected override string ParseString(string text) |
||||
{ |
||||
ParseStringParameter = text; |
||||
return ParseStringReturnValue; |
||||
} |
||||
} |
||||
} |
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using System.Diagnostics;
|
||||
//using ICSharpCode.CodeCoverage;
|
||||
//using ICSharpCode.UnitTesting;
|
||||
//
|
||||
//namespace ICSharpCode.CodeCoverage.Tests.Utils
|
||||
//{
|
||||
// public class DerivedCodeCoverageTestRunner : CodeCoverageTestRunner
|
||||
// {
|
||||
// public string ParseStringReturnValue;
|
||||
// public string ParseStringParameter;
|
||||
//
|
||||
// public DerivedCodeCoverageTestRunner(IUnitTestProcessRunner processRunner,
|
||||
// ITestResultsMonitor testResultsMonitor,
|
||||
// UnitTestingOptions options,
|
||||
// IFileSystem fileSystem,
|
||||
// IUnitTestMessageService messageService)
|
||||
// : base(new CodeCoverageTestRunnerContext(processRunner, testResultsMonitor, fileSystem, messageService, options))
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public ProcessStartInfo CallGetProcessStartInfo(SelectedTests selectedTests)
|
||||
// {
|
||||
// return base.GetProcessStartInfo(selectedTests);
|
||||
// }
|
||||
//
|
||||
// public TestResult CallCreateTestResultForTestFramework(TestResult testResult)
|
||||
// {
|
||||
// return base.CreateTestResultForTestFramework(testResult);
|
||||
// }
|
||||
//
|
||||
// protected override string ParseString(string text)
|
||||
// {
|
||||
// ParseStringParameter = text;
|
||||
// return ParseStringReturnValue;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,59 +1,59 @@
@@ -1,59 +1,59 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.CodeCoverage; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using ICSharpCode.UnitTesting; |
||||
|
||||
namespace ICSharpCode.CodeCoverage.Tests.Utils |
||||
{ |
||||
public class DerivedRunTestWithCodeCoverageCommand : RunTestWithCodeCoverageCommand |
||||
{ |
||||
public string ParsedStringToReturn = String.Empty; |
||||
public string ParsedString; |
||||
|
||||
public DerivedRunTestWithCodeCoverageCommand(IRunTestCommandContext context, |
||||
ICodeCoverageTestRunnerFactory factory) |
||||
: base(context, factory) |
||||
{ |
||||
} |
||||
|
||||
public void CallOnBeforeRunTests() |
||||
{ |
||||
base.OnBeforeRunTests(); |
||||
} |
||||
|
||||
public void CallOnAfterRunTests() |
||||
{ |
||||
base.OnAfterRunTests(); |
||||
} |
||||
|
||||
protected override MessageViewCategory CreateMessageViewCategory(string category, string displayCategory) |
||||
{ |
||||
return new MessageViewCategory(category, displayCategory); |
||||
} |
||||
|
||||
public MessageViewCategory CodeCoverageMessageViewCategory { |
||||
get { return base.Category; } |
||||
set { base.Category = value;} |
||||
} |
||||
|
||||
protected override string StringParse(string text) |
||||
{ |
||||
ParsedString = text; |
||||
return ParsedStringToReturn; |
||||
} |
||||
|
||||
public void CallTestRunnerMessageReceived(object source, MessageReceivedEventArgs e) |
||||
{ |
||||
base.TestRunnerMessageReceived(source, e); |
||||
} |
||||
|
||||
public ITestRunner CallCreateTestRunner(IProject project) |
||||
{ |
||||
return base.CreateTestRunner(project); |
||||
} |
||||
} |
||||
} |
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.CodeCoverage;
|
||||
//using ICSharpCode.SharpDevelop.Gui;
|
||||
//using ICSharpCode.SharpDevelop.Project;
|
||||
//using ICSharpCode.UnitTesting;
|
||||
//
|
||||
//namespace ICSharpCode.CodeCoverage.Tests.Utils
|
||||
//{
|
||||
// public class DerivedRunTestWithCodeCoverageCommand : RunTestWithCodeCoverageCommand
|
||||
// {
|
||||
// public string ParsedStringToReturn = String.Empty;
|
||||
// public string ParsedString;
|
||||
//
|
||||
// public DerivedRunTestWithCodeCoverageCommand(IRunTestCommandContext context,
|
||||
// ICodeCoverageTestRunnerFactory factory)
|
||||
// : base(context, factory)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public void CallOnBeforeRunTests()
|
||||
// {
|
||||
// base.OnBeforeRunTests();
|
||||
// }
|
||||
//
|
||||
// public void CallOnAfterRunTests()
|
||||
// {
|
||||
// base.OnAfterRunTests();
|
||||
// }
|
||||
//
|
||||
// protected override MessageViewCategory CreateMessageViewCategory(string category, string displayCategory)
|
||||
// {
|
||||
// return new MessageViewCategory(category, displayCategory);
|
||||
// }
|
||||
//
|
||||
// public MessageViewCategory CodeCoverageMessageViewCategory {
|
||||
// get { return base.Category; }
|
||||
// set { base.Category = value;}
|
||||
// }
|
||||
//
|
||||
// protected override string StringParse(string text)
|
||||
// {
|
||||
// ParsedString = text;
|
||||
// return ParsedStringToReturn;
|
||||
// }
|
||||
//
|
||||
// public void CallTestRunnerMessageReceived(object source, MessageReceivedEventArgs e)
|
||||
// {
|
||||
// base.TestRunnerMessageReceived(source, e);
|
||||
// }
|
||||
//
|
||||
// public ITestRunner CallCreateTestRunner(IProject project)
|
||||
// {
|
||||
// return base.CreateTestRunner(project);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,40 +1,40 @@
@@ -1,40 +1,40 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.CodeCoverage; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.UnitTesting; |
||||
using UnitTesting.Tests.Utils; |
||||
|
||||
namespace ICSharpCode.CodeCoverage.Tests.Utils |
||||
{ |
||||
public class MockCodeCoverageTestRunnerFactory : ICodeCoverageTestRunnerFactory |
||||
{ |
||||
public MockProcessRunner ProcessRunner; |
||||
public MockTestResultsMonitor TestResultsMonitor; |
||||
public UnitTestingOptions Options; |
||||
public CodeCoverageTestRunner TestRunner; |
||||
public MockFileSystem FileSystem; |
||||
public MockMessageService MessageService; |
||||
|
||||
public MockCodeCoverageTestRunnerFactory() |
||||
{ |
||||
ProcessRunner = new MockProcessRunner(); |
||||
TestResultsMonitor = new MockTestResultsMonitor(); |
||||
Options = new UnitTestingOptions(new Properties()); |
||||
FileSystem = new MockFileSystem(); |
||||
CodeCoverageTestRunnerContext context = new CodeCoverageTestRunnerContext(ProcessRunner, |
||||
TestResultsMonitor, |
||||
FileSystem, |
||||
MessageService, |
||||
Options); |
||||
TestRunner = new CodeCoverageTestRunner(context); |
||||
} |
||||
|
||||
public CodeCoverageTestRunner CreateCodeCoverageTestRunner() |
||||
{ |
||||
return TestRunner; |
||||
} |
||||
} |
||||
} |
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.CodeCoverage;
|
||||
//using ICSharpCode.Core;
|
||||
//using ICSharpCode.UnitTesting;
|
||||
//using UnitTesting.Tests.Utils;
|
||||
//
|
||||
//namespace ICSharpCode.CodeCoverage.Tests.Utils
|
||||
//{
|
||||
// public class MockCodeCoverageTestRunnerFactory : ICodeCoverageTestRunnerFactory
|
||||
// {
|
||||
// public MockProcessRunner ProcessRunner;
|
||||
// public MockTestResultsMonitor TestResultsMonitor;
|
||||
// public UnitTestingOptions Options;
|
||||
// public CodeCoverageTestRunner TestRunner;
|
||||
// public MockFileSystem FileSystem;
|
||||
// public MockMessageService MessageService;
|
||||
//
|
||||
// public MockCodeCoverageTestRunnerFactory()
|
||||
// {
|
||||
// ProcessRunner = new MockProcessRunner();
|
||||
// TestResultsMonitor = new MockTestResultsMonitor();
|
||||
// Options = new UnitTestingOptions(new Properties());
|
||||
// FileSystem = new MockFileSystem();
|
||||
// CodeCoverageTestRunnerContext context = new CodeCoverageTestRunnerContext(ProcessRunner,
|
||||
// TestResultsMonitor,
|
||||
// FileSystem,
|
||||
// MessageService,
|
||||
// Options);
|
||||
// TestRunner = new CodeCoverageTestRunner(context);
|
||||
// }
|
||||
//
|
||||
// public CodeCoverageTestRunner CreateCodeCoverageTestRunner()
|
||||
// {
|
||||
// return TestRunner;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
Loading…
Reference in new issue