diff --git a/src/AddIns/Misc/PackageManagement/Project/Src/EnvDTE/CodeElement.cs b/src/AddIns/Misc/PackageManagement/Project/Src/EnvDTE/CodeElement.cs index f258ea49d3..d5388e32c6 100644 --- a/src/AddIns/Misc/PackageManagement/Project/Src/EnvDTE/CodeElement.cs +++ b/src/AddIns/Misc/PackageManagement/Project/Src/EnvDTE/CodeElement.cs @@ -49,10 +49,9 @@ namespace ICSharpCode.PackageManagement.EnvDTE return new CodeVariable(context, (IField)member); case SymbolKind.Property: case SymbolKind.Indexer: -// return new CodeProperty2(m); - throw new NotImplementedException(); + return new CodeProperty2(context, (IProperty)member); case SymbolKind.Event: - return null; // events are not supported in EnvDTE? + return null; case SymbolKind.Method: case SymbolKind.Operator: case SymbolKind.Constructor: diff --git a/src/AddIns/Misc/PackageManagement/Project/Src/EnvDTE/CodeFunction.cs b/src/AddIns/Misc/PackageManagement/Project/Src/EnvDTE/CodeFunction.cs index 428ec1f564..dbb10db097 100644 --- a/src/AddIns/Misc/PackageManagement/Project/Src/EnvDTE/CodeFunction.cs +++ b/src/AddIns/Misc/PackageManagement/Project/Src/EnvDTE/CodeFunction.cs @@ -13,6 +13,7 @@ namespace ICSharpCode.PackageManagement.EnvDTE public CodeFunction(CodeModelContext context, IMethod method) : base(context, method) { + this.method = method; } public CodeFunction() diff --git a/src/AddIns/Misc/PackageManagement/Project/Src/EnvDTE/CodeProperty.cs b/src/AddIns/Misc/PackageManagement/Project/Src/EnvDTE/CodeProperty.cs index d54a08b8d0..05701f1de1 100644 --- a/src/AddIns/Misc/PackageManagement/Project/Src/EnvDTE/CodeProperty.cs +++ b/src/AddIns/Misc/PackageManagement/Project/Src/EnvDTE/CodeProperty.cs @@ -1,68 +1,68 @@ -//// 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.PackageManagement.EnvDTE -//{ -// public class CodeProperty : CodeElement, global::EnvDTE.CodeProperty -// { -// public CodeProperty() -// { -// } -// -// public CodeProperty(IProperty property) -// : base(property) -// { -// this.Property = property; -// } -// -// protected IProperty Property { get; private set; } -// -// public override global::EnvDTE.vsCMElement Kind { -// get { return global::EnvDTE.vsCMElement.vsCMElementProperty; } -// } -// -// public virtual global::EnvDTE.vsCMAccess Access { -// get { return GetAccess(); } -// set { } -// } -// -// public virtual global::EnvDTE.CodeClass Parent { -// get { return new CodeClass(Property.ProjectContent, Property.DeclaringType); } -// } -// -// public virtual global::EnvDTE.CodeElements Attributes { -// get { return new CodeAttributes(Property); } -// } -// -// public virtual global::EnvDTE.CodeTypeRef Type { -// get { return new CodeTypeRef2(Property.ProjectContent, this, Property.ReturnType); } -// } -// -// public virtual global::EnvDTE.CodeFunction Getter { -// get { return GetGetter(); } -// } -// -// CodeFunction GetGetter() -// { -// if (Property.CanGet) { -// return new CodeGetterFunction(Property); -// } -// return null; -// } -// -// public virtual global::EnvDTE.CodeFunction Setter { -// get { return GetSetter(); } -// } -// -// CodeFunction GetSetter() -// { -// if (Property.CanSet) { -// return new CodeSetterFunction(Property); -// } -// return null; -// } -// } -//} +// 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.NRefactory.TypeSystem; + +namespace ICSharpCode.PackageManagement.EnvDTE +{ + public class CodeProperty : CodeElement, global::EnvDTE.CodeProperty + { + protected readonly IProperty property; + + public CodeProperty() + { + } + + public CodeProperty(CodeModelContext context, IProperty property) + : base(context, property) + { + this.property = property; + } + + public override global::EnvDTE.vsCMElement Kind { + get { return global::EnvDTE.vsCMElement.vsCMElementProperty; } + } + + public virtual global::EnvDTE.vsCMAccess Access { + get { return property.Accessibility.ToAccess(); } + set { } + } + + public virtual global::EnvDTE.CodeClass Parent { + get { return new CodeClass(context, property.DeclaringTypeDefinition); } + } + + public virtual global::EnvDTE.CodeElements Attributes { + get { return GetAttributes(property); } + } + + public virtual global::EnvDTE.CodeTypeRef Type { + get { return new CodeTypeRef2(context, this, property.ReturnType); } + } + + public virtual global::EnvDTE.CodeFunction Getter { + get { return GetGetter(); } + } + + CodeFunction GetGetter() + { + if (property.CanGet) { + return new CodeFunction2(context, property.Getter); + } + return null; + } + + public virtual global::EnvDTE.CodeFunction Setter { + get { return GetSetter(); } + } + + CodeFunction GetSetter() + { + if (property.CanSet) { + return new CodeFunction2(context, property.Setter); + } + return null; + } + } +} diff --git a/src/AddIns/Misc/PackageManagement/Project/Src/EnvDTE/CodeProperty2.cs b/src/AddIns/Misc/PackageManagement/Project/Src/EnvDTE/CodeProperty2.cs index a3abdd781f..6fa1c06185 100644 --- a/src/AddIns/Misc/PackageManagement/Project/Src/EnvDTE/CodeProperty2.cs +++ b/src/AddIns/Misc/PackageManagement/Project/Src/EnvDTE/CodeProperty2.cs @@ -1,38 +1,44 @@ -//// 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.PackageManagement.EnvDTE -//{ -// public class CodeProperty2 : CodeProperty, global::EnvDTE.CodeProperty2 -// { -// public CodeProperty2() -// { -// } -// -// public CodeProperty2(IProperty property) -// : base(property) -// { -// } -// -// public global::EnvDTE.vsCMPropertyKind ReadWrite { -// get { return GetPropertyKind(); } -// } -// -// global::EnvDTE.vsCMPropertyKind GetPropertyKind() -// { -// if (Property.CanSet && Property.CanGet) { -// return global::EnvDTE.vsCMPropertyKind.vsCMPropertyKindReadWrite; -// } else if (Property.CanSet) { -// return global::EnvDTE.vsCMPropertyKind.vsCMPropertyKindWriteOnly; -// } -// return global::EnvDTE.vsCMPropertyKind.vsCMPropertyKindReadOnly; -// } -// -// public global::EnvDTE.CodeElements Parameters { -// get { return new CodeParameters(null, Property.Parameters); } -// } -// } -//} +// 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.Linq; +using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.SharpDevelop; + +namespace ICSharpCode.PackageManagement.EnvDTE +{ + public class CodeProperty2 : CodeProperty, global::EnvDTE.CodeProperty2 + { + public CodeProperty2() + { + } + + public CodeProperty2(CodeModelContext context, IProperty property) + : base(context, property) + { + } + + public global::EnvDTE.vsCMPropertyKind ReadWrite { + get { return GetPropertyKind(); } + } + + global::EnvDTE.vsCMPropertyKind GetPropertyKind() + { + if (property.CanSet && property.CanGet) { + return global::EnvDTE.vsCMPropertyKind.vsCMPropertyKindReadWrite; + } else if (property.CanSet) { + return global::EnvDTE.vsCMPropertyKind.vsCMPropertyKindWriteOnly; + } + return global::EnvDTE.vsCMPropertyKind.vsCMPropertyKindReadOnly; + } + + public global::EnvDTE.CodeElements Parameters { + get { + var parameters = new CodeElementsList(); + parameters.AddRange(property.Parameters.Select(parameter => new CodeParameter2(context, parameter))); + return parameters; + } + } + } +} diff --git a/src/AddIns/Misc/PackageManagement/Test/PackageManagement.Tests.csproj b/src/AddIns/Misc/PackageManagement/Test/PackageManagement.Tests.csproj index de5318c7a7..74101f5948 100644 --- a/src/AddIns/Misc/PackageManagement/Test/PackageManagement.Tests.csproj +++ b/src/AddIns/Misc/PackageManagement/Test/PackageManagement.Tests.csproj @@ -114,8 +114,6 @@ - - @@ -132,7 +130,6 @@ - diff --git a/src/AddIns/Misc/PackageManagement/Test/Src/EnvDTE/CodeClass2Tests.cs b/src/AddIns/Misc/PackageManagement/Test/Src/EnvDTE/CodeClass2Tests.cs index 0235659d29..06244b0aa0 100644 --- a/src/AddIns/Misc/PackageManagement/Test/Src/EnvDTE/CodeClass2Tests.cs +++ b/src/AddIns/Misc/PackageManagement/Test/Src/EnvDTE/CodeClass2Tests.cs @@ -147,20 +147,20 @@ namespace PackageManagement.Tests.EnvDTE Assert.AreEqual("MyMethod", codeFunction.Name); } -// [Test] -// public void Members_ClassHasOneProperty_ReturnsOneProperty() -// { -// CreateClass( -// "public class MyClass {\r\n" + -// " public int MyProperty { get; set; }\r\n" + -// "}"); -// -// global::EnvDTE.CodeElements codeElements = codeClass.Members; -// -// CodeProperty2 codeFunction = codeElements.FirstCodeProperty2OrDefault(); -// Assert.AreEqual(1, codeElements.Count); -// Assert.AreEqual("MyProperty", codeFunction.Name); -// } + [Test] + public void Members_ClassHasOneProperty_ReturnsOneProperty() + { + CreateClass( + "public class MyClass {\r\n" + + " public int MyProperty { get; set; }\r\n" + + "}"); + + global::EnvDTE.CodeElements codeElements = codeClass.Members; + + CodeProperty2 codeProperty = codeElements.FirstCodeProperty2OrDefault(); + Assert.AreEqual(1, codeElements.Count); + Assert.AreEqual("MyProperty", codeProperty.Name); + } [Test] public void Members_ClassHasOneField_ReturnsOneField() @@ -224,22 +224,23 @@ namespace PackageManagement.Tests.EnvDTE Assert.AreEqual(1, partialClasses.Count); Assert.AreEqual(codeClass, firstClass); } -// -// [Test] -// public void Members_GetFirstPropertyTwice_PropertiesAreConsideredEqualWhenAddedToList() -// { -// CreateProjectContent(); -// CreatePublicClass("MyClass"); -// helper.AddPropertyToClass("MyClass.MyProperty"); -// CodeProperty2 property = codeClass.Members.FirstCodeProperty2OrDefault(); -// var properties = new List(); -// properties.Add(property); -// -// CodeProperty2 property2 = codeClass.Members.FirstCodeProperty2OrDefault(); -// -// bool contains = properties.Contains(property2); -// Assert.IsTrue(contains); -// } + + [Test] + public void Members_GetFirstPropertyTwice_PropertiesAreConsideredEqualWhenAddedToList() + { + CreateClass( + "public class MyClass {\r\n" + + " public int MyProperty { get; set; }\r\n" + + "}"); + CodeProperty2 property = codeClass.Members.FirstCodeProperty2OrDefault(); + var properties = new List(); + properties.Add(property); + + CodeProperty2 property2 = codeClass.Members.FirstCodeProperty2OrDefault(); + + bool contains = properties.Contains(property2); + Assert.IsTrue(contains); + } [Test] public void IsAbstract_ClassIsAbstract_ReturnsTrue() diff --git a/src/AddIns/Misc/PackageManagement/Test/Src/EnvDTE/CodeProperty2Tests.cs b/src/AddIns/Misc/PackageManagement/Test/Src/EnvDTE/CodeProperty2Tests.cs index f65b5325ec..5b8c3114c1 100644 --- a/src/AddIns/Misc/PackageManagement/Test/Src/EnvDTE/CodeProperty2Tests.cs +++ b/src/AddIns/Misc/PackageManagement/Test/Src/EnvDTE/CodeProperty2Tests.cs @@ -1,316 +1,339 @@ -//// 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.PackageManagement.EnvDTE; -//using NUnit.Framework; -//using PackageManagement.Tests.Helpers; -// -//namespace PackageManagement.Tests.EnvDTE -//{ -// [TestFixture] -// public class CodeProperty2Tests -// { -// CodeProperty2 property; -// PropertyHelper helper; -// -// [SetUp] -// public void Init() -// { -// helper = new PropertyHelper(); -// } -// -// void CreateCodeProperty2() -// { -// property = new CodeProperty2(helper.Property); -// } -// -// [Test] -// public void Attributes_PropertyHasOneAttribute_ReturnsOneAttribute() -// { -// helper.CreateProperty("MyProperty"); -// helper.AddAttribute("Tests.TestAttribute", "TestAttribute"); -// CreateCodeProperty2(); -// -// global::EnvDTE.CodeElements attributes = property.Attributes; -// -// CodeAttribute2 attribute = attributes.Item(1) as CodeAttribute2; -// -// Assert.AreEqual(1, attributes.Count); -// Assert.AreEqual("Tests.TestAttribute", attribute.FullName); -// } -// -// [Test] -// public void Name_PropertyCalledMyProperty_ReturnsMyProperty() -// { -// helper.CreateProperty("MyProperty"); -// CreateCodeProperty2(); -// -// string name = property.Name; -// -// Assert.AreEqual("MyProperty", name); -// } -// -// [Test] -// public void Parent_Class1ContainsProperty_ReturnsClass1() -// { -// helper.CreateProperty("MyProperty"); -// helper.AddParentClass("Tests.Class1"); -// CreateCodeProperty2(); -// -// global::EnvDTE.CodeClass parentClass = property.Parent; -// -// Assert.AreEqual("Tests.Class1", parentClass.FullName); -// } -// -// [Test] -// public void Access_PublicProperty_AccessIsPublic() -// { -// helper.CreatePublicProperty("MyProperty"); -// CreateCodeProperty2(); -// -// global::EnvDTE.vsCMAccess access = property.Access; -// -// Assert.AreEqual(global::EnvDTE.vsCMAccess.vsCMAccessPublic, access); -// } -// -// [Test] -// public void Access_PrivateProperty_AccessIsPrivate() -// { -// helper.CreatePrivateProperty("MyProperty"); -// CreateCodeProperty2(); -// -// global::EnvDTE.vsCMAccess access = property.Access; -// -// Assert.AreEqual(global::EnvDTE.vsCMAccess.vsCMAccessPrivate, access); -// } -// -// [Test] -// public void ReadWrite_PropertyHasGetterAndSetter_ReturnsReadWriteProperty() -// { -// helper.CreatePublicProperty("MyProperty"); -// helper.HasGetterAndSetter(); -// CreateCodeProperty2(); -// -// global::EnvDTE.vsCMPropertyKind kind = property.ReadWrite; -// -// Assert.AreEqual(global::EnvDTE.vsCMPropertyKind.vsCMPropertyKindReadWrite, kind); -// } -// -// [Test] -// public void ReadWrite_PropertyHasGetterOnly_ReturnsReadOnlyProperty() -// { -// helper.CreatePublicProperty("MyProperty"); -// helper.HasGetterOnly(); -// CreateCodeProperty2(); -// -// global::EnvDTE.vsCMPropertyKind kind = property.ReadWrite; -// -// Assert.AreEqual(global::EnvDTE.vsCMPropertyKind.vsCMPropertyKindReadOnly, kind); -// } -// -// [Test] -// public void ReadWrite_PropertyHasSetterOnly_ReturnsWriteOnlyProperty() -// { -// helper.CreatePublicProperty("MyProperty"); -// helper.HasSetterOnly(); -// CreateCodeProperty2(); -// -// global::EnvDTE.vsCMPropertyKind kind = property.ReadWrite; -// -// Assert.AreEqual(global::EnvDTE.vsCMPropertyKind.vsCMPropertyKindWriteOnly, kind); -// } -// -// [Test] -// public void Parameters_PropertyIsIndexerWithOneParameter_ReturnsOneParameter() -// { -// helper.CreatePublicProperty("MyProperty"); -// helper.AddParameter("item"); -// CreateCodeProperty2(); -// -// global::EnvDTE.CodeElements parameters = property.Parameters; -// CodeParameter parameter = parameters.FirstCodeParameterOrDefault(); -// -// Assert.AreEqual(1, parameters.Count); -// Assert.AreEqual("item", parameter.Name); -// } -// -// [Test] -// public void Getter_PublicGetter_ReturnsPublicGetterCodeFunction() -// { -// helper.CreatePublicProperty("MyProperty"); -// helper.HasGetterOnly(); -// helper.GetterModifierIsNone(); -// CreateCodeProperty2(); -// -// global::EnvDTE.CodeFunction getter = property.Getter; -// global::EnvDTE.vsCMAccess access = getter.Access; -// -// Assert.AreEqual(global::EnvDTE.vsCMAccess.vsCMAccessPublic, access); -// } -// -// [Test] -// public void Getter_PrivateGetter_ReturnsPrivateGetterCodeFunction() -// { -// helper.CreatePrivateProperty("MyProperty"); -// helper.HasGetterOnly(); -// helper.GetterModifierIsNone(); -// CreateCodeProperty2(); -// -// global::EnvDTE.CodeFunction getter = property.Getter; -// global::EnvDTE.vsCMAccess access = getter.Access; -// -// Assert.AreEqual(global::EnvDTE.vsCMAccess.vsCMAccessPrivate, access); -// } -// -// [Test] -// public void Getter_NoGetter_ReturnsNull() -// { -// helper.CreatePublicProperty("MyProperty"); -// CreateCodeProperty2(); -// -// global::EnvDTE.CodeFunction getter = property.Getter; -// -// Assert.IsNull(getter); -// } -// -// [Test] -// public void Getter_PublicPropertyButPrivateGetter_ReturnsPrivateGetterCodeFunction() -// { -// helper.CreatePublicProperty("MyProperty"); -// helper.HasGetterAndSetter(); -// helper.GetterModifierIsPrivate(); -// CreateCodeProperty2(); -// -// global::EnvDTE.CodeFunction getter = property.Getter; -// global::EnvDTE.vsCMAccess access = getter.Access; -// -// Assert.AreEqual(global::EnvDTE.vsCMAccess.vsCMAccessPrivate, access); -// } -// -// [Test] -// public void Setter_PublicSetter_ReturnsPublicSetterCodeFunction() -// { -// helper.CreatePublicProperty("MyProperty"); -// helper.HasSetterOnly(); -// helper.SetterModifierIsNone(); -// CreateCodeProperty2(); -// -// global::EnvDTE.CodeFunction setter = property.Setter; -// global::EnvDTE.vsCMAccess access = setter.Access; -// -// Assert.AreEqual(global::EnvDTE.vsCMAccess.vsCMAccessPublic, access); -// } -// -// [Test] -// public void Setter_PrivateSetter_ReturnsPrivateSetterCodeFunction() -// { -// helper.CreatePrivateProperty("MyProperty"); -// helper.HasSetterOnly(); -// helper.SetterModifierIsNone(); -// CreateCodeProperty2(); -// -// global::EnvDTE.CodeFunction setter = property.Setter; -// global::EnvDTE.vsCMAccess access = setter.Access; -// -// Assert.AreEqual(global::EnvDTE.vsCMAccess.vsCMAccessPrivate, access); -// } -// -// [Test] -// public void Setter_NoSetter_ReturnsNull() -// { -// helper.CreatePublicProperty("MyProperty"); -// CreateCodeProperty2(); -// -// global::EnvDTE.CodeFunction setter = property.Setter; -// -// Assert.IsNull(setter); -// } -// -// [Test] -// public void Setter_PublicPropertyButPrivateSetter_ReturnsPrivateSetterCodeFunction() -// { -// helper.CreatePublicProperty("MyProperty"); -// helper.HasGetterAndSetter(); -// helper.SetterModifierIsPrivate(); -// CreateCodeProperty2(); -// -// global::EnvDTE.CodeFunction setter = property.Setter; -// global::EnvDTE.vsCMAccess access = setter.Access; -// -// Assert.AreEqual(global::EnvDTE.vsCMAccess.vsCMAccessPrivate, access); -// } -// -// [Test] -// public void Type_PropertyTypeIsSystemString_ReturnsSystemString() -// { -// helper.CreatePublicProperty("MyProperty"); -// helper.SetPropertyReturnType("System.String"); -// CreateCodeProperty2(); -// -// global::EnvDTE.CodeTypeRef typeRef = property.Type; -// string fullName = typeRef.AsFullName; -// -// Assert.AreEqual("System.String", fullName); -// } -// -// [Test] -// public void Type_PropertyTypeIsSystemString_TypesParentIsProperty() -// { -// helper.CreatePublicProperty("MyProperty"); -// helper.SetPropertyReturnType("System.String"); -// CreateCodeProperty2(); -// -// global::EnvDTE.CodeTypeRef typeRef = property.Type; -// global::EnvDTE.CodeElement parent = typeRef.Parent; -// -// Assert.AreEqual(property, parent); -// } -// -// [Test] -// public void Type_PropertyTypeIsSystemString_TypeRefTypeInfoLocationIsExternal() -// { -// helper.CreatePublicProperty("MyProperty"); -// helper.SetPropertyReturnType("System.String"); -// helper.CreateProjectForProjectContent(); -// var classHelper = new ClassHelper(); -// classHelper.CreateClass("System.String"); -// classHelper.SetProjectForProjectContent(null); -// helper.ReturnTypeHelper.AddUnderlyingClass(classHelper.Class); -// CreateCodeProperty2(); -// -// global::EnvDTE.CodeTypeRef typeRef = property.Type; -// global::EnvDTE.vsCMInfoLocation location = typeRef.CodeType.InfoLocation; -// -// Assert.AreEqual(global::EnvDTE.vsCMInfoLocation.vsCMInfoLocationExternal, location); -// } -// -// [Test] -// public void Type_PropertyTypeExistsInProject_TypeRefTypeInfoLocationIsProject() -// { -// helper.CreatePublicProperty("MyProperty"); -// helper.SetPropertyReturnType("MyType"); -// helper.CreateProjectForProjectContent(); -// var classHelper = new ClassHelper(); -// classHelper.CreateClass("MyType"); -// classHelper.SetProjectForProjectContent(helper.Project); -// helper.ReturnTypeHelper.AddUnderlyingClass(classHelper.Class); -// CreateCodeProperty2(); -// -// global::EnvDTE.CodeTypeRef typeRef = property.Type; -// global::EnvDTE.vsCMInfoLocation location = typeRef.CodeType.InfoLocation; -// -// Assert.AreEqual(global::EnvDTE.vsCMInfoLocation.vsCMInfoLocationProject, location); -// } -// -// [Test] -// public void Kind_PublicProperty_ReturnsProperty() -// { -// helper.CreatePublicProperty("MyProperty"); -// -// global::EnvDTE.vsCMElement kind = property.Kind; -// -// Assert.AreEqual(global::EnvDTE.vsCMElement.vsCMElementProperty, kind); -// } -// } -//} +// 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.Linq; +using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.PackageManagement.EnvDTE; +using NUnit.Framework; +using PackageManagement.Tests.Helpers; + +namespace PackageManagement.Tests.EnvDTE +{ + [TestFixture] + public class CodeProperty2Tests : CodeModelTestBase + { + CodeProperty2 property; + + void CreateCodeProperty2(string code) + { + AddCodeFile("class.cs", code); + IProperty member = assemblyModel + .TopLevelTypeDefinitions + .First() + .Members + .First() + .Resolve() as IProperty; + + property = new CodeProperty2(codeModelContext, member); + } + + [Test] + public void Attributes_PropertyHasOneAttribute_ReturnsOneAttribute() + { + CreateCodeProperty2( + "class MyClass {\r\n" + + " [System.Obsolete]\r\n" + + " public int MyProperty { get; set; }\r\n" + + "}"); + + global::EnvDTE.CodeElements attributes = property.Attributes; + + CodeAttribute2 attribute = attributes.Item(1) as CodeAttribute2; + Assert.AreEqual(1, attributes.Count); + Assert.AreEqual("System.ObsoleteAttribute", attribute.FullName); + } + + [Test] + public void Name_PropertyCalledMyProperty_ReturnsMyProperty() + { + CreateCodeProperty2( + "class MyClass {\r\n" + + " public int MyProperty { get; set; }\r\n" + + "}"); + + string name = property.Name; + + Assert.AreEqual("MyProperty", name); + } + + [Test] + public void Parent_Class1ContainsProperty_ReturnsClass1() + { + CreateCodeProperty2( + "namespace Tests {\r\n" + + " class Class1 {\r\n" + + " public int MyProperty { get; set; }\r\n" + + " }\r\n" + + "}"); + + global::EnvDTE.CodeClass parentClass = property.Parent; + + Assert.AreEqual("Tests.Class1", parentClass.FullName); + } + + [Test] + public void Access_PublicProperty_AccessIsPublic() + { + CreateCodeProperty2( + "class MyClass {\r\n" + + " public int MyProperty { get; set; }\r\n" + + "}"); + + global::EnvDTE.vsCMAccess access = property.Access; + + Assert.AreEqual(global::EnvDTE.vsCMAccess.vsCMAccessPublic, access); + } + + [Test] + public void Access_PrivateProperty_AccessIsPrivate() + { + CreateCodeProperty2( + "class MyClass {\r\n" + + " private int MyProperty { get; set; }\r\n" + + "}"); + + global::EnvDTE.vsCMAccess access = property.Access; + + Assert.AreEqual(global::EnvDTE.vsCMAccess.vsCMAccessPrivate, access); + } + + [Test] + public void ReadWrite_PropertyHasGetterAndSetter_ReturnsReadWriteProperty() + { + CreateCodeProperty2( + "class MyClass {\r\n" + + " public int MyProperty { get; set; }\r\n" + + "}"); + + global::EnvDTE.vsCMPropertyKind kind = property.ReadWrite; + + Assert.AreEqual(global::EnvDTE.vsCMPropertyKind.vsCMPropertyKindReadWrite, kind); + } + + [Test] + public void ReadWrite_PropertyHasGetterOnly_ReturnsReadOnlyProperty() + { + CreateCodeProperty2( + "class MyClass {\r\n" + + " public int MyProperty { get { return 0; } }\r\n" + + "}"); + + global::EnvDTE.vsCMPropertyKind kind = property.ReadWrite; + + Assert.AreEqual(global::EnvDTE.vsCMPropertyKind.vsCMPropertyKindReadOnly, kind); + } + + [Test] + public void ReadWrite_PropertyHasSetterOnly_ReturnsWriteOnlyProperty() + { + CreateCodeProperty2( + "class MyClass {\r\n" + + " public int MyProperty { set { } }\r\n" + + "}"); + + global::EnvDTE.vsCMPropertyKind kind = property.ReadWrite; + + Assert.AreEqual(global::EnvDTE.vsCMPropertyKind.vsCMPropertyKindWriteOnly, kind); + } + + [Test] + public void Parameters_PropertyIsIndexerWithOneParameter_ReturnsOneParameter() + { + CreateCodeProperty2( + "class MyClass {\r\n" + + " public int this[int item] { get { return 0; } }\r\n" + + "}"); + + global::EnvDTE.CodeElements parameters = property.Parameters; + + CodeParameter parameter = parameters.FirstCodeParameterOrDefault(); + Assert.AreEqual(1, parameters.Count); + Assert.AreEqual("item", parameter.Name); + } + + [Test] + public void Getter_PublicGetter_ReturnsPublicGetterCodeFunction() + { + CreateCodeProperty2( + "class MyClass {\r\n" + + " public int MyProperty { get { return 0; } }\r\n" + + "}"); + + global::EnvDTE.CodeFunction getter = property.Getter; + global::EnvDTE.vsCMAccess access = getter.Access; + + Assert.AreEqual(global::EnvDTE.vsCMAccess.vsCMAccessPublic, access); + } + + [Test] + public void Getter_PrivateGetter_ReturnsPrivateGetterCodeFunction() + { + CreateCodeProperty2( + "class MyClass {\r\n" + + " private int MyProperty { get { return 0; } }\r\n" + + "}"); + + global::EnvDTE.CodeFunction getter = property.Getter; + global::EnvDTE.vsCMAccess access = getter.Access; + + Assert.AreEqual(global::EnvDTE.vsCMAccess.vsCMAccessPrivate, access); + } + + [Test] + public void Getter_NoGetter_ReturnsNull() + { + CreateCodeProperty2( + "class MyClass {\r\n" + + " public int MyProperty { set { } }\r\n" + + "}"); + + global::EnvDTE.CodeFunction getter = property.Getter; + + Assert.IsNull(getter); + } + + [Test] + public void Getter_PublicPropertyButPrivateGetter_ReturnsPrivateGetterCodeFunction() + { + CreateCodeProperty2( + "class MyClass {\r\n" + + " public int MyProperty { private get; public set; }\r\n" + + "}"); + + global::EnvDTE.CodeFunction getter = property.Getter; + global::EnvDTE.vsCMAccess access = getter.Access; + + Assert.AreEqual(global::EnvDTE.vsCMAccess.vsCMAccessPrivate, access); + } + + [Test] + public void Setter_PublicSetter_ReturnsPublicSetterCodeFunction() + { + CreateCodeProperty2( + "class MyClass {\r\n" + + " public int MyProperty { set { } }\r\n" + + "}"); + + global::EnvDTE.CodeFunction setter = property.Setter; + global::EnvDTE.vsCMAccess access = setter.Access; + + Assert.AreEqual(global::EnvDTE.vsCMAccess.vsCMAccessPublic, access); + } + + [Test] + public void Setter_PrivateSetter_ReturnsPrivateSetterCodeFunction() + { + CreateCodeProperty2( + "class MyClass {\r\n" + + " private int MyProperty { set { } }\r\n" + + "}"); + + global::EnvDTE.CodeFunction setter = property.Setter; + global::EnvDTE.vsCMAccess access = setter.Access; + + Assert.AreEqual(global::EnvDTE.vsCMAccess.vsCMAccessPrivate, access); + } + + [Test] + public void Setter_NoSetter_ReturnsNull() + { + CreateCodeProperty2( + "class MyClass {\r\n" + + " public int MyProperty { get { return 0; } }\r\n" + + "}"); + + global::EnvDTE.CodeFunction setter = property.Setter; + + Assert.IsNull(setter); + } + + [Test] + public void Setter_PublicPropertyButPrivateSetter_ReturnsPrivateSetterCodeFunction() + { + CreateCodeProperty2( + "class MyClass {\r\n" + + " public int MyProperty { get; private set; }\r\n" + + "}"); + + global::EnvDTE.CodeFunction setter = property.Setter; + global::EnvDTE.vsCMAccess access = setter.Access; + + Assert.AreEqual(global::EnvDTE.vsCMAccess.vsCMAccessPrivate, access); + } + + [Test] + public void Type_PropertyTypeIsSystemString_ReturnsSystemString() + { + CreateCodeProperty2( + "using System;\r\n" + + "class MyClass {\r\n" + + " public string MyProperty { get; set; }\r\n" + + "}"); + + global::EnvDTE.CodeTypeRef typeRef = property.Type; + string fullName = typeRef.AsFullName; + + Assert.AreEqual("System.String", fullName); + } + + [Test] + public void Type_PropertyTypeIsSystemString_TypesParentIsProperty() + { + CreateCodeProperty2( + "using System;\r\n" + + "class MyClass {\r\n" + + " public string MyProperty { get; set; }\r\n" + + "}"); + + global::EnvDTE.CodeTypeRef typeRef = property.Type; + global::EnvDTE.CodeElement parent = typeRef.Parent; + + Assert.AreEqual(property, parent); + } + + [Test] + public void Type_PropertyTypeIsSystemString_TypeRefTypeInfoLocationIsExternal() + { + CreateCodeProperty2( + "using System;\r\n" + + "class MyClass {\r\n" + + " public string MyProperty { get; set; }\r\n" + + "}"); + + global::EnvDTE.CodeTypeRef typeRef = property.Type; + global::EnvDTE.vsCMInfoLocation location = typeRef.CodeType.InfoLocation; + + Assert.AreEqual(global::EnvDTE.vsCMInfoLocation.vsCMInfoLocationExternal, location); + } + + [Test] + public void Type_PropertyTypeExistsInProject_TypeRefTypeInfoLocationIsProject() + { + CreateCodeProperty2( + "using System;\r\n" + + "public class MyClass {\r\n" + + " public MyType MyProperty { get; set; }\r\n" + + "}\r\n" + + "public class MyType {}"); + + global::EnvDTE.CodeTypeRef typeRef = property.Type; + global::EnvDTE.vsCMInfoLocation location = typeRef.CodeType.InfoLocation; + + Assert.AreEqual(global::EnvDTE.vsCMInfoLocation.vsCMInfoLocationProject, location); + } + + [Test] + public void Kind_PublicProperty_ReturnsProperty() + { + CreateCodeProperty2( + "class MyClass {\r\n" + + " public int MyProperty { get; set; }\r\n" + + "}"); + + global::EnvDTE.vsCMElement kind = property.Kind; + + Assert.AreEqual(global::EnvDTE.vsCMElement.vsCMElementProperty, kind); + } + } +} diff --git a/src/AddIns/Misc/PackageManagement/Test/Src/Helpers/AttributeHelper.cs b/src/AddIns/Misc/PackageManagement/Test/Src/Helpers/AttributeHelper.cs deleted file mode 100644 index 54be3c1a17..0000000000 --- a/src/AddIns/Misc/PackageManagement/Test/Src/Helpers/AttributeHelper.cs +++ /dev/null @@ -1,67 +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 System.Collections.Generic; -//using ICSharpCode.SharpDevelop.Dom; -//using Rhino.Mocks; -// -//namespace PackageManagement.Tests.Helpers -//{ -// public class AttributeHelper -// { -// public IAttribute Attribute; -// public IReturnType AttributeType; -// public List PositionalArguments = new List(); -// public Dictionary NamedArguments = new Dictionary(); -// -// public void CreateAttribute(string fullName) -// { -// CreateAttribute(fullName, fullName); -// } -// -// public void CreateAttribute(string fullName, string shortName) -// { -// var returnTypeHelper = new ReturnTypeHelper(); -// returnTypeHelper.CreateReturnType(fullName); -// returnTypeHelper.AddShortName(shortName); -// AttributeType = returnTypeHelper.ReturnType; -// -// Attribute = MockRepository.GenerateStub(); -// Attribute.Stub(a => a.AttributeType).Return(AttributeType); -// Attribute.Stub(a => a.PositionalArguments).Return(PositionalArguments); -// Attribute.Stub(a => a.NamedArguments).Return(NamedArguments); -// } -// -// public void AddPositionalArguments(params object[] args) -// { -// PositionalArguments.AddRange(args); -// } -// -// public void AddNamedArgument(string name, object value) -// { -// NamedArguments.Add(name, value); -// } -// -// public void AddAttributeToClass(IClass c) -// { -// var attributes = new List(); -// attributes.Add(Attribute); -// c.Stub(item => item.Attributes).Return(attributes); -// } -// -// public void AddAttributeToMethod(IMethod method) -// { -// var attributes = new List(); -// attributes.Add(Attribute); -// method.Stub(m => m.Attributes).Return(attributes); -// } -// -// public void AddAttributeToParameter(IParameter parameter) -// { -// var attributes = new List(); -// attributes.Add(Attribute); -// parameter.Stub(p => p.Attributes).Return(attributes); -// } -// } -//} diff --git a/src/AddIns/Misc/PackageManagement/Test/Src/Helpers/ClassHelper.cs b/src/AddIns/Misc/PackageManagement/Test/Src/Helpers/ClassHelper.cs deleted file mode 100644 index 6957f4913f..0000000000 --- a/src/AddIns/Misc/PackageManagement/Test/Src/Helpers/ClassHelper.cs +++ /dev/null @@ -1,228 +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 System.Collections.Generic; -//using System.Linq; -//using ICSharpCode.SharpDevelop.Dom; -//using Rhino.Mocks; -// -//namespace PackageManagement.Tests.Helpers -//{ -// public class ClassHelper -// { -// public IClass Class; -// public ProjectContentHelper ProjectContentHelper = new ProjectContentHelper(); -// public CompilationUnitHelper CompilationUnitHelper = new CompilationUnitHelper(); -// -// List methods = new List(); -// List properties = new List(); -// List fields = new List(); -// -// public void CreateClass(string name) -// { -// Class = ProjectContentHelper.AddClassToProjectContent(name); -// InitializeClassCommon(); -// } -// -// void InitializeClassCommon() -// { -// Class.Stub(c => c.Methods).Return(methods); -// Class.Stub(c => c.Properties).Return(properties); -// Class.Stub(c => c.Fields).Return(fields); -// Class.Stub(c => c.CompilationUnit).Return(CompilationUnitHelper.CompilationUnit); -// } -// -// public void AddAttributeToClass(string attributeTypeName) -// { -// var attributeHelper = new AttributeHelper(); -// attributeHelper.CreateAttribute(attributeTypeName); -// attributeHelper.AddAttributeToClass(Class); -// } -// -// public void CreatePublicClass(string name) -// { -// Class = ProjectContentHelper.AddPublicClassToProjectContent(name); -// InitializeClassCommon(); -// } -// -// public void CreatePrivateClass(string name) -// { -// Class = ProjectContentHelper.AddPrivateClassToProjectContent(name); -// InitializeClassCommon(); -// } -// -// public void AddInterfaceToClassBaseTypes(string interfaceFullName, string dotNetName) -// { -// IClass interfaceClass = ProjectContentHelper.AddInterfaceToProjectContent(interfaceFullName); -// AddClassToClassBaseTypes(interfaceClass, interfaceFullName, dotNetName); -// } -// -// public void AddClassToClassBaseTypes(IClass baseTypeClass, string baseTypeFullName, string baseTypeDotNetName) -// { -// IReturnType baseType = CreateBaseType(baseTypeClass, baseTypeFullName, baseTypeDotNetName); -// var baseTypes = new List(); -// baseTypes.Add(baseType); -// -// Class.Stub(c => c.BaseTypes).Return(baseTypes); -// } -// -// ReturnTypeHelper CreateBaseTypeHelper(IClass baseTypeClass, string baseTypeFullName, string baseTypeDotNetName) -// { -// var returnTypeHelper = new ReturnTypeHelper(); -// returnTypeHelper.CreateReturnType(baseTypeFullName); -// returnTypeHelper.AddUnderlyingClass(baseTypeClass); -// returnTypeHelper.AddDotNetName(baseTypeDotNetName); -// return returnTypeHelper; -// } -// -// IReturnType CreateBaseType(IClass baseTypeClass, string baseTypeFullName, string baseTypeDotNetName) -// { -// return CreateBaseTypeHelper(baseTypeClass, baseTypeFullName, baseTypeDotNetName).ReturnType; -// } -// -// public void AddClassToClassBaseTypes(string fullName) -// { -// IClass baseTypeClass = ProjectContentHelper.AddClassToProjectContent(fullName); -// AddClassToClassBaseTypes(baseTypeClass, fullName, fullName); -// } -// -// public void AddBaseTypeToClass(string fullName) -// { -// IClass baseTypeClass = ProjectContentHelper.AddClassToProjectContent(fullName); -// IReturnType baseType = CreateBaseType(baseTypeClass, fullName, fullName); -// -// Class.Stub(c => c.BaseType).Return(baseType); -// } -// -// /// -// /// Name should include the class prefix (e.g. "Class1.MyMethod"); -// /// -// public void AddMethodToClass(string fullyQualifiedName) -// { -// AddMethodToClass(fullyQualifiedName, DomRegion.Empty, DomRegion.Empty); -// } -// -// public void AddMethodToClass(string fullyQualifiedName, DomRegion region, DomRegion bodyRegion) -// { -// var helper = new MethodHelper(); -// helper.ProjectContentHelper = ProjectContentHelper; -// helper.CreateMethod(fullyQualifiedName); -// helper.SetRegion(region); -// helper.SetBodyRegion(bodyRegion); -// helper.SetDeclaringType(Class); -// methods.Add(helper.Method); -// } -// -// /// -// /// Name should include the class prefix (e.g. "Class1.MyProperty"); -// /// -// public void AddPropertyToClass(string fullyQualifiedName) -// { -// var helper = new PropertyHelper(); -// helper.ProjectContentHelper = ProjectContentHelper; -// helper.CreateProperty(fullyQualifiedName); -// -// properties.Add(helper.Property); -// } -// -// /// -// /// Name should include the class prefix (e.g. "Class1.MyField"); -// /// -// public void AddFieldToClass(string fullyQualifiedName) -// { -// AddFieldToClass(fullyQualifiedName, DomRegion.Empty); -// } -// -// public void AddFieldToClass(string fullyQualifiedName, DomRegion region) -// { -// var helper = new FieldHelper(); -// helper.ProjectContentHelper = ProjectContentHelper; -// helper.CreateField(fullyQualifiedName); -// helper.SetRegion(region); -// -// fields.Add(helper.Field); -// } -// -// public void AddClassNamespace(string name) -// { -// Class.Stub(c => c.Namespace).Return(name); -// } -// -// public void SetClassRegion(DomRegion classRegion) -// { -// Class.Stub(c => c.Region).Return(classRegion); -// } -// -// public void SetClassFileName(string fileName) -// { -// CompilationUnitHelper.SetFileName(fileName); -// } -// -// public void SetClassType(ClassType type) -// { -// Class.Stub(c => c.ClassType).Return(type); -// } -// -// public void SetProjectForProjectContent(object project) -// { -// ProjectContentHelper.SetProjectForProjectContent(project); -// } -// -// public void MakeClassAbstract() -// { -// Class.Stub(c => c.IsAbstract).Return(true); -// } -// -// public void MakeClassPartial() -// { -// Class.Stub(c => c.IsPartial).Return(true); -// } -// -// public void AddNamespaceUsingScopeToClass(string namespaceName) -// { -// var usingScopeHelper = new UsingScopeHelper(); -// usingScopeHelper.SetNamespaceName(namespaceName); -// -// Class.Stub(c => c.UsingScope).Return(usingScopeHelper.UsingScope); -// } -// -// public void SetDotNetName(string className) -// { -// Class.Stub(c => c.DotNetName).Return(className); -// } -// -// /// -// /// Classes at the end of the array are at the top of the inheritance tree. -// /// -// public void AddClassInheritanceTreeClassesOnly(params string[] classNames) -// { -// List classes = CreateClassInheritanceTree(classNames); -// Class.Stub(c => c.ClassInheritanceTreeClassesOnly).Return(classes); -// } -// -// List CreateClassInheritanceTree(string[] classNames) -// { -// return classNames -// .Select(name => CreateClassHelperWithPublicClass(name).Class) -// .ToList(); -// } -// -// ClassHelper CreateClassHelperWithPublicClass(string name) -// { -// var classHelper = new ClassHelper(); -// classHelper.CreatePublicClass(name); -// return classHelper; -// } -// -// public void SetRegionBeginLine(int line) -// { -// SetRegion(new DomRegion(line, 1)); -// } -// -// public void SetRegion(DomRegion region) -// { -// Class.Stub(c => c.Region).Return(region); -// } -// } -//} diff --git a/src/AddIns/Misc/PackageManagement/Test/Src/Helpers/CodeElementsExtensions.cs b/src/AddIns/Misc/PackageManagement/Test/Src/Helpers/CodeElementsExtensions.cs index b6cf15b379..df895130f1 100644 --- a/src/AddIns/Misc/PackageManagement/Test/Src/Helpers/CodeElementsExtensions.cs +++ b/src/AddIns/Misc/PackageManagement/Test/Src/Helpers/CodeElementsExtensions.cs @@ -74,10 +74,10 @@ namespace PackageManagement.Tests.Helpers return codeElements.FirstOrDefault() as CodeAttribute2; } -// public static CodeProperty2 FirstCodeProperty2OrDefault(this global::EnvDTE.CodeElements codeElements) -// { -// return codeElements.FirstOrDefault() as CodeProperty2; -// } + public static CodeProperty2 FirstCodeProperty2OrDefault(this global::EnvDTE.CodeElements codeElements) + { + return codeElements.FirstOrDefault() as CodeProperty2; + } public static CodeVariable FirstCodeVariableOrDefault(this global::EnvDTE.CodeElements codeElements) { diff --git a/src/AddIns/Misc/PackageManagement/Test/Src/Helpers/PropertyHelper.cs b/src/AddIns/Misc/PackageManagement/Test/Src/Helpers/PropertyHelper.cs deleted file mode 100644 index d3585fe3ad..0000000000 --- a/src/AddIns/Misc/PackageManagement/Test/Src/Helpers/PropertyHelper.cs +++ /dev/null @@ -1,128 +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 System.Collections.Generic; -//using ICSharpCode.NRefactory.TypeSystem; -//using ICSharpCode.SharpDevelop.Dom; -//using Rhino.Mocks; -// -//namespace PackageManagement.Tests.Helpers -//{ -// public class PropertyHelper : MethodOrPropertyHelper -// { -// public IProperty Property; -// public ProjectContentHelper ProjectContentHelper = new ProjectContentHelper(); -// public ReturnTypeHelper ReturnTypeHelper = new ReturnTypeHelper(); -// -// List attributes = new List(); -// -// /// -// /// Property name should include class prefix (e.g. "Class1.MyProperty") -// /// -// public void CreateProperty(string fullyQualifiedName) -// { -// Property = MockRepository.GenerateMock(); -// Property.Stub(p => p.FullyQualifiedName).Return(fullyQualifiedName); -// Property.Stub(p => p.Attributes).Return(attributes); -// Property.Stub(p => p.Parameters).Return(parameters); -// Property.Stub(p => p.ProjectContent).Return(ProjectContentHelper.ProjectContent); -// } -// -// public void AddAttribute(string fullName, string shortName) -// { -// var attributeHelper = new AttributeHelper(); -// attributeHelper.CreateAttribute(fullName, shortName); -// attributes.Add(attributeHelper.Attribute); -// } -// -// public void AddParentClass(string className) -// { -// IClass c = ProjectContentHelper.AddClassToProjectContent(className); -// Property.Stub(p => p.DeclaringType).Return(c); -// } -// -// public void CreatePublicProperty(string name) -// { -// CreateProperty(name); -// Property.Stub(p => p.IsPublic).Return(true); -// } -// -// public void CreatePrivateProperty(string name) -// { -// CreateProperty(name); -// Property.Stub(p => p.IsPublic).Return(false); -// Property.Stub(p => p.IsPrivate).Return(true); -// } -// -// public void HasGetterAndSetter() -// { -// HasGetter = true; -// HasSetter = true; -// } -// -// public bool HasSetter { -// set { Property.Stub(p => p.CanSet).Return(value); } -// } -// -// public bool HasGetter { -// set { Property.Stub(p => p.CanGet).Return(value); } -// } -// -// public void HasGetterOnly() -// { -// HasGetter = true; -// HasSetter = false; -// } -// -// public void HasSetterOnly() -// { -// HasGetter = false; -// HasSetter = true; -// } -// -// public void GetterModifierIsPrivate() -// { -// GetterModifier = ModifierEnum.Private; -// } -// -// ModifierEnum GetterModifier { -// set { Property.Stub(p => p.GetterModifiers).Return(value); } -// } -// -// public void GetterModifierIsNone() -// { -// GetterModifier = ModifierEnum.None; -// } -// -// public void SetterModifierIsPrivate() -// { -// SetterModifier = ModifierEnum.Private; -// } -// -// ModifierEnum SetterModifier { -// set { Property.Stub(p => p.SetterModifiers).Return(value); } -// } -// -// public void SetterModifierIsNone() -// { -// GetterModifier = ModifierEnum.None; -// } -// -// public void SetPropertyReturnType(string fullName) -// { -// ReturnTypeHelper.CreateReturnType(fullName); -// ReturnTypeHelper.AddDotNetName(fullName); -// Property.Stub(p => p.ReturnType).Return(ReturnTypeHelper.ReturnType); -// } -// -// public object Project { -// get { return ProjectContentHelper.ProjectContent.Project; } -// } -// -// public void CreateProjectForProjectContent() -// { -// ProjectContentHelper.SetProjectForProjectContent(ProjectHelper.CreateTestProject()); -// } -// } -//}