diff --git a/src/AddIns/Analysis/MachineSpecifications/MachineSpecifications/src/MSpecTestFramework.cs b/src/AddIns/Analysis/MachineSpecifications/MachineSpecifications/src/MSpecTestFramework.cs index b7d0220fd6..41fe139717 100644 --- a/src/AddIns/Analysis/MachineSpecifications/MachineSpecifications/src/MSpecTestFramework.cs +++ b/src/AddIns/Analysis/MachineSpecifications/MachineSpecifications/src/MSpecTestFramework.cs @@ -42,7 +42,7 @@ namespace ICSharpCode.MachineSpecifications { var behaviorFields = ResolveBehaviorFieldsOf(field); var behaviorTestMembers = GetTestMembers(testClass, behaviorFields); - var decoratedTestMembers = behaviorTestMembers.Select(f => new BaseTestMethod(testClass, f)).Cast(); + var decoratedTestMembers = behaviorTestMembers.Select(f => new BaseTestMember(testClass, f)).Cast(); result.AddRange(decoratedTestMembers); } return result; diff --git a/src/AddIns/Analysis/UnitTesting/Src/BaseTestMember.cs b/src/AddIns/Analysis/UnitTesting/Src/BaseTestMember.cs new file mode 100644 index 0000000000..6d9fa01c58 --- /dev/null +++ b/src/AddIns/Analysis/UnitTesting/Src/BaseTestMember.cs @@ -0,0 +1,66 @@ +// 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.SharpDevelop.Dom; + +namespace ICSharpCode.UnitTesting +{ + /// + /// Represents a test member that exists in a base class. + /// + /// + /// In order to have the Unit Test tree run the correct + /// test when we have a class that has a base class with + /// test members is to return the derived class from the + /// DeclaringType's property. Otherwise the base class + /// member is tested and the derived class is not used. + /// + public class BaseTestMember : AbstractMember + { + IMember member; + + /// + /// Creates a new instance of the BaseTestMember. + /// + /// The derived class and not + /// the class where the method is actually defined. + /// The base class's test member. + public BaseTestMember(IClass derivedClass, IMember member) + : base(derivedClass, member.Name) + { + this.member = member; + this.ReturnType = member.ReturnType; + this.Modifiers = member.Modifiers; + this.Region = member.Region; + this.BodyRegion = member.BodyRegion; + this.Documentation = member.Documentation; + } + + /// + /// Gets the actual method used to create this object. + /// + public IMember Member { + get { return member; } + } + + public override EntityType EntityType { + get { + return member.EntityType; + } + } + + public override string DocumentationTag { + get { + return null; + } + } + + public override string Documentation {get;set;} + + public override IMember Clone() + { + return new BaseTestMember(DeclaringType, Member); + } + } +} diff --git a/src/AddIns/Analysis/UnitTesting/Src/BaseTestMethod.cs b/src/AddIns/Analysis/UnitTesting/Src/BaseTestMethod.cs deleted file mode 100644 index b58eef3130..0000000000 --- a/src/AddIns/Analysis/UnitTesting/Src/BaseTestMethod.cs +++ /dev/null @@ -1,42 +0,0 @@ -// 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.SharpDevelop.Dom; - -namespace ICSharpCode.UnitTesting -{ - /// - /// Represents a test method that exists in a base class. - /// - /// - /// In order to have the Unit Test tree run the correct - /// test when we have a class that has a base class with - /// test methods is to return the derived class from the - /// DeclaringType's property. Otherwise the base class - /// method is tested and the derived class is not used. - /// - public class BaseTestMethod : DefaultMethod - { - IMember method; - - /// - /// Creates a new instance of the BaseTestMethod. - /// - /// The derived class and not - /// the class where the method is actually defined. - /// The base class's test method. - public BaseTestMethod(IClass derivedClass, IMember method) - : base(method.Name, method.ReturnType, method.Modifiers, method.Region, method.BodyRegion, derivedClass) - { - this.method = method; - } - - /// - /// Gets the actual method used to create this object. - /// - public IMember Method { - get { return method; } - } - } -} diff --git a/src/AddIns/Analysis/UnitTesting/Src/TestClass.cs b/src/AddIns/Analysis/UnitTesting/Src/TestClass.cs index 6ad4fef1cc..34ff3647d8 100644 --- a/src/AddIns/Analysis/UnitTesting/Src/TestClass.cs +++ b/src/AddIns/Analysis/UnitTesting/Src/TestClass.cs @@ -289,7 +289,7 @@ namespace ICSharpCode.UnitTesting IClass declaringType = c; while (c.BaseClass != null) { foreach (var method in testFrameworks.GetTestMembersFor(c.BaseClass)) { - BaseTestMethod baseTestMethod = new BaseTestMethod(declaringType, method); + BaseTestMember baseTestMethod = new BaseTestMember(declaringType, method); TestMember testMethod = new TestMember(c.BaseClass.Name, baseTestMethod); if (method.IsVirtual) { if (!testMembers.Contains(method.Name)) { diff --git a/src/AddIns/Analysis/UnitTesting/Src/UnitTestCommands.cs b/src/AddIns/Analysis/UnitTesting/Src/UnitTestCommands.cs index aad568dfe1..a022a4228f 100644 --- a/src/AddIns/Analysis/UnitTesting/Src/UnitTestCommands.cs +++ b/src/AddIns/Analysis/UnitTesting/Src/UnitTestCommands.cs @@ -71,9 +71,9 @@ namespace ICSharpCode.UnitTesting { IMember member = treeView.SelectedMember; if (member != null) { - BaseTestMethod baseTestMethod = member as BaseTestMethod; + BaseTestMember baseTestMethod = member as BaseTestMember; if (baseTestMethod != null) { - return baseTestMethod.Method; + return baseTestMethod.Member; } } return member; diff --git a/src/AddIns/Analysis/UnitTesting/Test/Project/BaseTestMethodTestFixture.cs b/src/AddIns/Analysis/UnitTesting/Test/Project/BaseTestMethodTestFixture.cs index 86cfefff9e..16b4d5b99a 100644 --- a/src/AddIns/Analysis/UnitTesting/Test/Project/BaseTestMethodTestFixture.cs +++ b/src/AddIns/Analysis/UnitTesting/Test/Project/BaseTestMethodTestFixture.cs @@ -18,7 +18,7 @@ namespace UnitTesting.Tests.Project { MockClass mockClass; MockMethod mockMethod; - BaseTestMethod baseTestMethod; + BaseTestMember baseTestMethod; DomRegion mockMethodRegion; DomRegion mockMethodBodyRegion; DefaultReturnType returnType; @@ -39,7 +39,7 @@ namespace UnitTesting.Tests.Project returnType = new DefaultReturnType(returnTypeClass); mockMethod.ReturnType = returnType; - baseTestMethod = new BaseTestMethod(mockClass, mockMethod); + baseTestMethod = new BaseTestMember(mockClass, mockMethod); } [Test] @@ -57,7 +57,7 @@ namespace UnitTesting.Tests.Project [Test] public void ActualMethod() { - Assert.AreEqual(mockMethod, baseTestMethod.Method); + Assert.AreEqual(mockMethod, baseTestMethod.Member); } [Test] @@ -81,7 +81,7 @@ namespace UnitTesting.Tests.Project [Test] public void ReturnType() { - Assert.IsTrue(Object.ReferenceEquals(returnType, baseTestMethod.ReturnType)); + Assert.AreSame(returnType, baseTestMethod.ReturnType); } } } diff --git a/src/AddIns/Analysis/UnitTesting/Test/Project/TestClassIsTestMethodUsesTestFrameworksTestFixture.cs b/src/AddIns/Analysis/UnitTesting/Test/Project/TestClassIsTestMethodUsesTestFrameworksTestFixture.cs index 5759cc912d..1e8c40afda 100644 --- a/src/AddIns/Analysis/UnitTesting/Test/Project/TestClassIsTestMethodUsesTestFrameworksTestFixture.cs +++ b/src/AddIns/Analysis/UnitTesting/Test/Project/TestClassIsTestMethodUsesTestFrameworksTestFixture.cs @@ -50,8 +50,8 @@ namespace UnitTesting.Tests.Project [Test] public void TestClassHasBaseClassTestMethod() { - BaseTestMethod baseTestMethod = testClass.TestMembers[1].Member as BaseTestMethod; - Assert.AreEqual(baseClassTestMethod, baseTestMethod.Method); + BaseTestMember baseTestMethod = testClass.TestMembers[1].Member as BaseTestMember; + Assert.AreEqual(baseClassTestMethod, baseTestMethod.Member); } } } diff --git a/src/AddIns/Analysis/UnitTesting/Test/Tree/GoToSelectedBaseClassMethodTestFixture.cs b/src/AddIns/Analysis/UnitTesting/Test/Tree/GoToSelectedBaseClassMethodTestFixture.cs index 0cded22a0b..10e07a891d 100644 --- a/src/AddIns/Analysis/UnitTesting/Test/Tree/GoToSelectedBaseClassMethodTestFixture.cs +++ b/src/AddIns/Analysis/UnitTesting/Test/Tree/GoToSelectedBaseClassMethodTestFixture.cs @@ -30,7 +30,7 @@ namespace UnitTesting.Tests.Tree int methodBeginColumn = 6; // 1 based. baseClassMethod.Region = new DomRegion(methodBeginLine, methodBeginColumn); - BaseTestMethod baseTestMethod = new BaseTestMethod(derivedClass, baseClassMethod); + BaseTestMember baseTestMethod = new BaseTestMember(derivedClass, baseClassMethod); treeView = new MockTestTreeView(); treeView.SelectedMember = baseTestMethod; diff --git a/src/AddIns/Analysis/UnitTesting/Test/Utils/MockProjectContent.cs b/src/AddIns/Analysis/UnitTesting/Test/Utils/MockProjectContent.cs index 59eb24df0f..641f67ff1f 100644 --- a/src/AddIns/Analysis/UnitTesting/Test/Utils/MockProjectContent.cs +++ b/src/AddIns/Analysis/UnitTesting/Test/Utils/MockProjectContent.cs @@ -70,7 +70,7 @@ namespace UnitTesting.Tests.Utils public string GetXmlDocumentation(string memberTag) { - throw new NotImplementedException(); + return string.Empty; } public void AddClassToNamespaceList(IClass addClass) diff --git a/src/AddIns/Analysis/UnitTesting/UnitTesting.csproj b/src/AddIns/Analysis/UnitTesting/UnitTesting.csproj index 929ac0b50c..bdf1445c65 100644 --- a/src/AddIns/Analysis/UnitTesting/UnitTesting.csproj +++ b/src/AddIns/Analysis/UnitTesting/UnitTesting.csproj @@ -81,7 +81,7 @@ Never - +