|
|
|
@ -2,7 +2,10 @@
@@ -2,7 +2,10 @@
|
|
|
|
|
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
|
|
|
|
|
|
|
|
|
using System; |
|
|
|
|
using System.Collections; |
|
|
|
|
using System.Collections.Generic; |
|
|
|
|
using System.Linq; |
|
|
|
|
|
|
|
|
|
using ICSharpCode.PackageManagement.EnvDTE; |
|
|
|
|
using NUnit.Framework; |
|
|
|
|
using PackageManagement.Tests.Helpers; |
|
|
|
@ -24,6 +27,17 @@ namespace PackageManagement.Tests.EnvDTE
@@ -24,6 +27,17 @@ namespace PackageManagement.Tests.EnvDTE
|
|
|
|
|
properties = new Properties(factory); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void AssertContainsProperty(string propertyName, IEnumerable items) |
|
|
|
|
{ |
|
|
|
|
var itemsList = new List<Property>(); |
|
|
|
|
foreach (Property property in items) { |
|
|
|
|
itemsList.Add(property); |
|
|
|
|
} |
|
|
|
|
var matchedProperty = itemsList.Find(p => p.Name == propertyName); |
|
|
|
|
|
|
|
|
|
Assert.AreEqual(propertyName, matchedProperty.Name); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[Test] |
|
|
|
|
public void Value_GetPostBuildEvent_ReturnsProjectsPostBuildEvent() |
|
|
|
|
{ |
|
|
|
@ -233,5 +247,42 @@ namespace PackageManagement.Tests.EnvDTE
@@ -233,5 +247,42 @@ namespace PackageManagement.Tests.EnvDTE
|
|
|
|
|
|
|
|
|
|
Assert.AreEqual("MyProjectRootNamespace", defaultNamespace); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[Test] |
|
|
|
|
public void Value_GetLocalPathProperty_ReturnsProjectDirectory() |
|
|
|
|
{ |
|
|
|
|
CreateProperties(); |
|
|
|
|
msbuildProject.FileName = @"d:\projects\MyProject\MyProject.csproj"; |
|
|
|
|
|
|
|
|
|
global::EnvDTE.Property localPathProperty = project.Properties.Item("LocalPath"); |
|
|
|
|
string localPath = localPathProperty.Value as string; |
|
|
|
|
|
|
|
|
|
string expectedLocalPath = @"d:\projects\MyProject"; |
|
|
|
|
Assert.AreEqual(expectedLocalPath, localPath); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[Test] |
|
|
|
|
public void GetEnumerator_LocalPathProperty_ExistsInEnumeratedProperties() |
|
|
|
|
{ |
|
|
|
|
CreateProperties(); |
|
|
|
|
msbuildProject.FileName = @"d:\projects\MyProject\MyProject.csproj"; |
|
|
|
|
|
|
|
|
|
var enumerable = project.Properties as IEnumerable; |
|
|
|
|
|
|
|
|
|
AssertContainsProperty("LocalPath", enumerable); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[Test] |
|
|
|
|
public void Value_GetLocalPathPropertyWithUpperCaseCharacters_ReturnsProjectDirectory() |
|
|
|
|
{ |
|
|
|
|
CreateProperties(); |
|
|
|
|
msbuildProject.FileName = @"d:\projects\MyProject\MyProject.csproj"; |
|
|
|
|
|
|
|
|
|
global::EnvDTE.Property fullPathProperty = project.Properties.Item("LOCALPATH"); |
|
|
|
|
string fullPath = fullPathProperty.Value as string; |
|
|
|
|
|
|
|
|
|
string expectedFullPath = @"d:\projects\MyProject"; |
|
|
|
|
Assert.AreEqual(expectedFullPath, fullPath); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|