5 changed files with 92 additions and 2 deletions
@ -0,0 +1,43 @@ |
|||||||
|
// 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(); |
||||||
|
|
||||||
|
CodeElements attributes = property.Attributes; |
||||||
|
|
||||||
|
CodeAttribute2 attribute = attributes.Item(1) as CodeAttribute2; |
||||||
|
|
||||||
|
Assert.AreEqual(1, attributes.Count); |
||||||
|
Assert.AreEqual("Tests.TestAttribute", attribute.FullName); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,29 @@ |
|||||||
|
// 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 PropertyHelper |
||||||
|
{ |
||||||
|
public IProperty Property; |
||||||
|
public List<IAttribute> Attributes = new List<IAttribute>(); |
||||||
|
|
||||||
|
public void CreateProperty(string name) |
||||||
|
{ |
||||||
|
Property = MockRepository.GenerateMock<IProperty, IEntity>(); |
||||||
|
Property.Stub(p => p.Attributes).Return(Attributes); |
||||||
|
} |
||||||
|
|
||||||
|
public void AddAttribute(string fullName, string shortName) |
||||||
|
{ |
||||||
|
var attributeHelper = new AttributeHelper(); |
||||||
|
attributeHelper.CreateAttribute(fullName, shortName); |
||||||
|
Attributes.Add(attributeHelper.Attribute); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
Loading…
Reference in new issue