11 changed files with 489 additions and 885 deletions
@ -1,68 +1,68 @@
@@ -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; |
||||
} |
||||
} |
||||
} |
||||
|
||||
@ -1,38 +1,44 @@
@@ -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<CodeElement>(); |
||||
parameters.AddRange(property.Parameters.Select(parameter => new CodeParameter2(context, parameter))); |
||||
return parameters; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
@ -1,316 +1,339 @@
@@ -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); |
||||
} |
||||
} |
||||
} |
||||
|
||||
@ -1,67 +0,0 @@
@@ -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<object> PositionalArguments = new List<object>();
|
||||
// public Dictionary<string, object> NamedArguments = new Dictionary<string, object>();
|
||||
//
|
||||
// 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<IAttribute>();
|
||||
// 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<IAttribute>();
|
||||
// attributes.Add(Attribute);
|
||||
// c.Stub(item => item.Attributes).Return(attributes);
|
||||
// }
|
||||
//
|
||||
// public void AddAttributeToMethod(IMethod method)
|
||||
// {
|
||||
// var attributes = new List<IAttribute>();
|
||||
// attributes.Add(Attribute);
|
||||
// method.Stub(m => m.Attributes).Return(attributes);
|
||||
// }
|
||||
//
|
||||
// public void AddAttributeToParameter(IParameter parameter)
|
||||
// {
|
||||
// var attributes = new List<IAttribute>();
|
||||
// attributes.Add(Attribute);
|
||||
// parameter.Stub(p => p.Attributes).Return(attributes);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@ -1,228 +0,0 @@
@@ -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<IMethod> methods = new List<IMethod>();
|
||||
// List<IProperty> properties = new List<IProperty>();
|
||||
// List<IField> fields = new List<IField>();
|
||||
//
|
||||
// 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<IReturnType>();
|
||||
// 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);
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Name should include the class prefix (e.g. "Class1.MyMethod");
|
||||
// /// </summary>
|
||||
// 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);
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Name should include the class prefix (e.g. "Class1.MyProperty");
|
||||
// /// </summary>
|
||||
// public void AddPropertyToClass(string fullyQualifiedName)
|
||||
// {
|
||||
// var helper = new PropertyHelper();
|
||||
// helper.ProjectContentHelper = ProjectContentHelper;
|
||||
// helper.CreateProperty(fullyQualifiedName);
|
||||
//
|
||||
// properties.Add(helper.Property);
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Name should include the class prefix (e.g. "Class1.MyField");
|
||||
// /// </summary>
|
||||
// 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);
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Classes at the end of the array are at the top of the inheritance tree.
|
||||
// /// </summary>
|
||||
// public void AddClassInheritanceTreeClassesOnly(params string[] classNames)
|
||||
// {
|
||||
// List<IClass> classes = CreateClassInheritanceTree(classNames);
|
||||
// Class.Stub(c => c.ClassInheritanceTreeClassesOnly).Return(classes);
|
||||
// }
|
||||
//
|
||||
// List<IClass> 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);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@ -1,128 +0,0 @@
@@ -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<IAttribute> attributes = new List<IAttribute>();
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Property name should include class prefix (e.g. "Class1.MyProperty")
|
||||
// /// </summary>
|
||||
// public void CreateProperty(string fullyQualifiedName)
|
||||
// {
|
||||
// Property = MockRepository.GenerateMock<IProperty, IEntity>();
|
||||
// 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());
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
Loading…
Reference in new issue