Exemple #1
0
        public void Should_be_able_to_get_the_description_from_the_update()
        {
            var reader = new NAppUpdate.Framework.FeedReaders.AppcastReader();

            using (Stream s = StreamGenerator.GenerateStreamFromString(ZuneUpdateFeed))
            {
                var updates = reader.Read(s);
                Assert.AreEqual(1, updates.Count());
                Assert.AreEqual(".WMA Support and other minor bug fixes", updates.First().Description);
            }
        }
        public void NauReaderCanReadFeed1()
        {
            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"">
      <Description>update details</Description>
      <Conditions>
        <FileExistsCondition localPath=""otherFile.dll"" />
      </Conditions>
    </FileUpdateTask>
  </Tasks>
</Feed>";

            var reader = new NAppUpdate.Framework.FeedReaders.NauXmlFeedReader();

            using (Stream s = StreamGenerator.GenerateStreamFromString(NauUpdateFeed))
            {
                IList <IUpdateTask> updates = reader.Read(s);

                Assert.IsTrue(updates.Count == 1);

                var task = updates[0] as FileUpdateTask;
                Assert.IsNotNull(task);
                Assert.IsFalse(task.CanHotSwap);
                Assert.AreEqual("test.dll", task.LocalPath);
                Assert.AreEqual("remoteFile.dll", task.UpdateTo);
                Assert.IsNull(task.Sha256Checksum);
                Assert.IsNotNull(task.Description);

                Assert.AreEqual(1, task.UpdateConditions.ChildConditionsCount);

                var cnd = task.UpdateConditions.Degrade() as FileExistsCondition;
                Assert.IsNotNull(cnd);
                Assert.AreEqual("otherFile.dll", cnd.LocalPath);
            }
        }