diff --git a/src/NvGet.Tests/NvGet.Tests.csproj b/src/NvGet.Tests/NvGet.Tests.csproj
index 6874216..4908443 100644
--- a/src/NvGet.Tests/NvGet.Tests.csproj
+++ b/src/NvGet.Tests/NvGet.Tests.csproj
@@ -5,6 +5,16 @@
false
+
+
+
+
+
+
+ Always
+
+
+
diff --git a/src/NvGet.Tests/Scenarios/Given_VersionPropertyUpdate/Directory.Packages.props b/src/NvGet.Tests/Scenarios/Given_VersionPropertyUpdate/Directory.Packages.props
new file mode 100644
index 0000000..80bef20
--- /dev/null
+++ b/src/NvGet.Tests/Scenarios/Given_VersionPropertyUpdate/Directory.Packages.props
@@ -0,0 +1,5 @@
+
+
+ 0.9
+
+
diff --git a/src/NvGet.Tests/Tools/Updater/NuGetUpdaterTests.cs b/src/NvGet.Tests/Tools/Updater/NuGetUpdaterTests.cs
index 91609ed..2b256e1 100644
--- a/src/NvGet.Tests/Tools/Updater/NuGetUpdaterTests.cs
+++ b/src/NvGet.Tests/Tools/Updater/NuGetUpdaterTests.cs
@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
+using System.IO;
+using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
@@ -15,7 +17,7 @@ namespace NvGet.Tests.Tools
[TestClass]
public class NuGetUpdaterTests
{
- private static readonly Dictionary TestPackages = new Dictionary
+ private static readonly Dictionary TestPackages = new Dictionary(StringComparer.OrdinalIgnoreCase)
{
{"Uno.UI", new[] { "1.0", "1.1-dev.1" } },
{"Uno.Core", new[] { "1.0", "1.0-beta.1" } },
@@ -43,5 +45,45 @@ public async Task GivenUnspecifiedTarget_NoUpdateIsMade()
Assert.IsTrue(logger.GetUpdates().None());
}
+
+ [TestMethod]
+ [DataRow("stable", "uno.ui", "1.0")]
+ [DataRow("dev", "uno.ui", "1.1-dev.1")]
+ public async Task Given_VersionPropertyUpdate(string targetVersion, string package, string version)
+ {
+ var testTempPath = CreateTempWorkspace(".\\Scenarios\\Given_VersionPropertyUpdate");
+
+ var parameters = new UpdaterParameters
+ {
+ SolutionRoot = testTempPath,
+ UpdateTarget = FileType.All,
+ TargetVersions = { targetVersion },
+ Feeds = { TestFeed },
+ };
+
+ var logger = new UpdaterLogger(Console.Out);
+
+ var updater = new NuGetUpdater(parameters, logger);
+
+ await updater.UpdatePackages(CancellationToken.None);
+
+ var updates = logger.GetUpdates();
+ Assert.AreEqual(1, updates.Count());
+ Assert.AreEqual(package, updates.First().PackageId.ToLowerInvariant());
+ Assert.AreEqual(version, updates.First().UpdatedVersion.OriginalVersion);
+ }
+
+ private static string CreateTempWorkspace(string sourceFolder)
+ {
+ var tempFolder = Path.GetTempPath();
+ var testTempPath = Path.Combine(tempFolder, Guid.NewGuid().ToString());
+ Directory.CreateDirectory(testTempPath);
+ foreach(var files in Directory.GetFiles(sourceFolder, "*", SearchOption.AllDirectories))
+ {
+ File.Copy(files, Path.Combine(testTempPath, Path.GetFileName(files)));
+ }
+
+ return testTempPath;
+ }
}
}
diff --git a/src/NvGet/Tools/Updater/Extensions/XmlDocumentExtensions.cs b/src/NvGet/Tools/Updater/Extensions/XmlDocumentExtensions.cs
index 1cb2837..85ca0a9 100644
--- a/src/NvGet/Tools/Updater/Extensions/XmlDocumentExtensions.cs
+++ b/src/NvGet/Tools/Updater/Extensions/XmlDocumentExtensions.cs
@@ -8,6 +8,8 @@
using NvGet.Extensions;
using NvGet.Tools.Updater.Log;
using Uno.Extensions;
+using Uno.Extensions.Specialized;
+
#if WINDOWS_UWP
using XmlDocument = Windows.Data.Xml.Dom.XmlDocument;
@@ -98,7 +100,10 @@ UpdateOperation operation
var propertyGroupVersionReferences = document
.SelectElements("PropertyGroup")
- .SelectMany(pg => pg.SelectNodes(packageId.Replace(".", "") + "Version").OfType());
+ .SelectMany(pg => pg
+ .SelectNodes("*")
+ .OfType()
+ .Where(n => string.Equals(n.Name, packageId.Replace(".", string.Empty) + "Version", StringComparison.OrdinalIgnoreCase)));
foreach(var versionProperty in propertyGroupVersionReferences)
{
@@ -110,6 +115,8 @@ UpdateOperation operation
{
versionProperty.InnerText = currentOperation.UpdatedVersion.ToString();
}
+
+ operations.Add(currentOperation);
}
}