Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2750 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
3 changed files with 66 additions and 1 deletions
@ -0,0 +1,63 @@ |
|||||||
|
// <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 System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using ICSharpCode.CodeCoverage; |
||||||
|
using NUnit.Framework; |
||||||
|
|
||||||
|
namespace ICSharpCode.CodeCoverage.Tests |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// If there are two namespaces that start the same and match up
|
||||||
|
/// to at least the start of the dot character then the
|
||||||
|
/// CodeCoverageMethod.GetChildNamespaces fails to correctly identify
|
||||||
|
/// child namespaces.
|
||||||
|
///
|
||||||
|
/// For example:
|
||||||
|
///
|
||||||
|
/// Root.Tests
|
||||||
|
/// RootBar
|
||||||
|
///
|
||||||
|
/// If we look for child namespaces using the string "Root" the
|
||||||
|
/// code should only return "Tests", but it will also return
|
||||||
|
/// "Bar" due to a bug matching only the start of the class namespace
|
||||||
|
/// without taking into account the dot character.
|
||||||
|
/// </summary>
|
||||||
|
[TestFixture] |
||||||
|
public class SimilarRootNamespaceTestFixture |
||||||
|
{ |
||||||
|
List<string> childNamespaces = new List<string>(); |
||||||
|
|
||||||
|
[TestFixtureSetUp] |
||||||
|
public void SetUpFixture() |
||||||
|
{ |
||||||
|
CodeCoverageModule module = new CodeCoverageModule("Root.Tests"); |
||||||
|
|
||||||
|
// Add two methods in namespaces that start with the
|
||||||
|
// same initial characters.
|
||||||
|
CodeCoverageMethod rootTestsMethod = new CodeCoverageMethod("RunThis", "Root.Tests.MyTestFixture"); |
||||||
|
module.Methods.Add(rootTestsMethod); |
||||||
|
CodeCoverageMethod rootBarMethod = new CodeCoverageMethod("RunThis", "RootBar.MyTestFixture"); |
||||||
|
module.Methods.Add(rootBarMethod); |
||||||
|
|
||||||
|
childNamespaces = CodeCoverageMethod.GetChildNamespaces(module.Methods, "Root"); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void RootNamespaceHasOneChildNamespace() |
||||||
|
{ |
||||||
|
Assert.AreEqual(1, childNamespaces.Count); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void RootNamespaceChildNamespaceIsTests() |
||||||
|
{ |
||||||
|
Assert.AreEqual("Tests", childNamespaces[0]); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue