Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/NAppUpdate.Framework/Tasks/FileUpdateTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
35 changes: 35 additions & 0 deletions src/NAppUpdate.Tests/FeedReaders/NauXmlFeedReaderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,40 @@ public void NauReaderCanReadFeed3()

Assert.AreEqual(64, cnd.OsBits);
}

[TestMethod]
public void NauReaderCanReadFeed4()
{
const string NauUpdateFeed =
@"<?xml version=""1.0"" encoding=""utf-8""?>
<Feed>
<Title>My application</Title>
<Link>http://myapp.com/</Link>
<Tasks>
<FileUpdateTask localPath=""test.dll"" updateTo=""remoteFile.dll"" hotswap=""true"" version=""1.0.0.0"">
<Description>update details</Description>
<Conditions>
<OSCondition bit=""64"" />
</Conditions>
</FileUpdateTask>
</Tasks>
</Feed>";

var reader = new NAppUpdate.Framework.FeedReaders.NauXmlFeedReader();
IList<IUpdateTask> 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);
}
}
}