From 02df13578c292575251afeceab32b72e948db508 Mon Sep 17 00:00:00 2001 From: Anton Firsin Date: Fri, 16 Feb 2018 11:58:02 +0500 Subject: [PATCH] FileUpdateTask serialize/deserialize mismatch: version field is absent --- .../Tasks/FileUpdateTask.cs | 3 ++ .../FeedReaders/NauXmlFeedReaderTests.cs | 35 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/src/NAppUpdate.Framework/Tasks/FileUpdateTask.cs b/src/NAppUpdate.Framework/Tasks/FileUpdateTask.cs index 3830f2bf..8e791c3f 100644 --- a/src/NAppUpdate.Framework/Tasks/FileUpdateTask.cs +++ b/src/NAppUpdate.Framework/Tasks/FileUpdateTask.cs @@ -21,6 +21,9 @@ public class FileUpdateTask : UpdateTaskBase [NauField("sha256-checksum", "SHA-256 checksum to validate the file after download (optional)", false)] public string Sha256Checksum { get; set; } + [NauField("version", "File version to validate the file after download (optional)", false)] + public string Version { get; set; } + [NauField("hotswap", "Default update action is a cold update; check here if a hot file swap should be attempted" , false)] diff --git a/src/NAppUpdate.Tests/FeedReaders/NauXmlFeedReaderTests.cs b/src/NAppUpdate.Tests/FeedReaders/NauXmlFeedReaderTests.cs index 8c766795..d78e4bf3 100644 --- a/src/NAppUpdate.Tests/FeedReaders/NauXmlFeedReaderTests.cs +++ b/src/NAppUpdate.Tests/FeedReaders/NauXmlFeedReaderTests.cs @@ -123,5 +123,40 @@ public void NauReaderCanReadFeed3() Assert.AreEqual(64, cnd.OsBits); } + + [TestMethod] + public void NauReaderCanReadFeed4() + { + const string NauUpdateFeed = + @" + + My application + http://myapp.com/ + + + update details + + + + + +"; + + var reader = new NAppUpdate.Framework.FeedReaders.NauXmlFeedReader(); + IList updates = reader.Read(NauUpdateFeed); + + Assert.IsTrue(updates.Count == 1); + + var task = updates[0] as FileUpdateTask; + Assert.IsNotNull(task); + Assert.IsTrue(task.CanHotSwap); + + Assert.AreEqual(1, task.UpdateConditions.ChildConditionsCount); + + var cnd = task.UpdateConditions.Degrade() as OSCondition; + Assert.IsNotNull(cnd); + + Assert.AreEqual(64, cnd.OsBits); + } } }