Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1171 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
15 changed files with 337 additions and 23 deletions
@ -0,0 +1,53 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
using ICSharpCode.CodeCoverage; |
||||||
|
using NUnit.Framework; |
||||||
|
using System; |
||||||
|
using System.IO; |
||||||
|
|
||||||
|
namespace ICSharpCode.CodeCoverage.Tests |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Tests that results with the excluded attribute set are not included
|
||||||
|
/// in the code coverage results.
|
||||||
|
/// </summary>
|
||||||
|
[TestFixture] |
||||||
|
public class ExcludedMethodResultsTestFixture |
||||||
|
{ |
||||||
|
CodeCoverageResults results; |
||||||
|
CodeCoverageModule module; |
||||||
|
|
||||||
|
[TestFixtureSetUp] |
||||||
|
public void SetUpFixture() |
||||||
|
{ |
||||||
|
string xml = "<coverage>\r\n" + |
||||||
|
"\t<module name=\"C:\\Projects\\Foo.Tests\\bin\\Debug\\Foo.Tests.dll\" assembly=\"Foo.Tests\">\r\n" + |
||||||
|
"\t\t<method name=\"ExcludedTest\" class=\"Foo.Tests.FooTestFixture\">\r\n" + |
||||||
|
"\t\t\t<seqpnt visitcount=\"0\" line=\"20\" column=\"3\" endline=\"20\" excluded=\"true\" endcolumn=\"4\" document=\"c:\\Projects\\Foo\\FooTestFixture.cs\" />\r\n" + |
||||||
|
"\t\t\t<seqpnt visitcount=\"0\" line=\"21\" column=\"13\" endline=\"21\" excluded=\"true\" endcolumn=\"32\" document=\"c:\\Projects\\Foo\\FooTestFixture.cs\" />\r\n" + |
||||||
|
"\t\t\t<seqpnt visitcount=\"0\" line=\"24\" column=\"3\" endline=\"24\" excluded=\"true\" endcolumn=\"4\" document=\"c:\\Projects\\Foo\\FooTestFixture.cs\" />\r\n" + |
||||||
|
"\t\t</method>\r\n" + |
||||||
|
"\t\t<method name=\"SimpleTest\" class=\"Foo.Tests.FooTestFixture\">\r\n" + |
||||||
|
"\t\t\t<seqpnt visitcount=\"0\" line=\"20\" column=\"3\" endline=\"20\" excluded=\"false\" endcolumn=\"4\" document=\"c:\\Projects\\Foo\\FooTestFixture.cs\" />\r\n" + |
||||||
|
"\t\t\t<seqpnt visitcount=\"0\" line=\"21\" column=\"13\" endline=\"21\" excluded=\"false\" endcolumn=\"32\" document=\"c:\\Projects\\Foo\\FooTestFixture.cs\" />\r\n" + |
||||||
|
"\t\t\t<seqpnt visitcount=\"0\" line=\"24\" column=\"3\" endline=\"24\" excluded=\"false\" endcolumn=\"4\" document=\"c:\\Projects\\Foo\\FooTestFixture.cs\" />\r\n" + |
||||||
|
"\t\t</method>\r\n" + |
||||||
|
"\t</module>\r\n" + |
||||||
|
"</coverage>"; |
||||||
|
results = new CodeCoverageResults(new StringReader(xml)); |
||||||
|
module = results.Modules[0]; |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void OneMethod() |
||||||
|
{ |
||||||
|
Assert.AreEqual(1, module.Methods.Count); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
@ -0,0 +1,31 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
using ICSharpCode.CodeCoverage; |
||||||
|
using NUnit.Framework; |
||||||
|
using System; |
||||||
|
|
||||||
|
namespace ICSharpCode.CodeCoverage.Tests |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Ensures that a code coverage method that has no included sequence
|
||||||
|
/// points is flagged as excluded.
|
||||||
|
/// </summary>
|
||||||
|
[TestFixture] |
||||||
|
public class ExcludedMethodTestFixture |
||||||
|
{ |
||||||
|
[Test] |
||||||
|
public void IsExcluded() |
||||||
|
{ |
||||||
|
CodeCoverageMethod method = new CodeCoverageMethod("Test1", "MyTestFixture"); |
||||||
|
CodeCoverageSequencePoint pt = new CodeCoverageSequencePoint(@"c:\test\MyTestFixture.cs", 0, 10, 0, 10, 20, true); |
||||||
|
method.SequencePoints.Add(pt); |
||||||
|
|
||||||
|
Assert.IsTrue(method.IsExcluded, "Method should be excluded."); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,45 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
using ICSharpCode.CodeCoverage; |
||||||
|
using NUnit.Framework; |
||||||
|
using System; |
||||||
|
using System.IO; |
||||||
|
|
||||||
|
namespace ICSharpCode.CodeCoverage.Tests |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Tests that results with the excluded attribute set are not included
|
||||||
|
/// in the code coverage results.
|
||||||
|
/// </summary>
|
||||||
|
[TestFixture] |
||||||
|
public class ExcludedModuleResultsTestFixture |
||||||
|
{ |
||||||
|
CodeCoverageResults results; |
||||||
|
|
||||||
|
[TestFixtureSetUp] |
||||||
|
public void SetUpFixture() |
||||||
|
{ |
||||||
|
string xml = "<coverage>\r\n" + |
||||||
|
"\t<module name=\"C:\\Projects\\Foo.Tests\\bin\\Debug\\Foo.Tests.dll\" assembly=\"Foo.Tests\">\r\n" + |
||||||
|
"\t\t<method name=\"SimpleTest\" class=\"Foo.Tests.FooTestFixture\">\r\n" + |
||||||
|
"\t\t\t<seqpnt visitcount=\"0\" line=\"20\" column=\"3\" endline=\"20\" excluded=\"true\" endcolumn=\"4\" document=\"c:\\Projects\\Foo\\FooTestFixture.cs\" />\r\n" + |
||||||
|
"\t\t\t<seqpnt visitcount=\"0\" line=\"21\" column=\"13\" endline=\"21\" excluded=\"true\" endcolumn=\"32\" document=\"c:\\Projects\\Foo\\FooTestFixture.cs\" />\r\n" + |
||||||
|
"\t\t\t<seqpnt visitcount=\"0\" line=\"24\" column=\"3\" endline=\"24\" excluded=\"true\" endcolumn=\"4\" document=\"c:\\Projects\\Foo\\FooTestFixture.cs\" />\r\n" + |
||||||
|
"\t\t</method>\r\n" + |
||||||
|
"\t</module>\r\n" + |
||||||
|
"</coverage>"; |
||||||
|
results = new CodeCoverageResults(new StringReader(xml)); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void NoModules() |
||||||
|
{ |
||||||
|
Assert.AreEqual(0, results.Modules.Count, "All modules should be excluded"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,33 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
using ICSharpCode.CodeCoverage; |
||||||
|
using NUnit.Framework; |
||||||
|
using System; |
||||||
|
|
||||||
|
namespace ICSharpCode.CodeCoverage.Tests |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Ensures that a code coverage module that has no included methods
|
||||||
|
/// points is flagged as excluded.
|
||||||
|
/// </summary>
|
||||||
|
[TestFixture] |
||||||
|
public class ExcludedModuleTestFixture |
||||||
|
{ |
||||||
|
[Test] |
||||||
|
public void IsExcluded() |
||||||
|
{ |
||||||
|
CodeCoverageModule module = new CodeCoverageModule("test"); |
||||||
|
CodeCoverageMethod method = new CodeCoverageMethod("Test1", "MyTestFixture"); |
||||||
|
CodeCoverageSequencePoint pt = new CodeCoverageSequencePoint(@"c:\test\MyTestFixture.cs", 0, 10, 0, 10, 20, true); |
||||||
|
method.SequencePoints.Add(pt); |
||||||
|
module.Methods.Add(method); |
||||||
|
|
||||||
|
Assert.IsTrue(module.IsExcluded, "Module should be excluded."); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
Loading…
Reference in new issue