LookupURLOfUpdate() 공개 메소드

Note! This will propogate network exceptions, so client can catch them and warn or not warn the user.
public LookupURLOfUpdate ( ) : UpdateTableLookupResult
리턴 UpdateTableLookupResult
 public void LookupURLOfUpdate_NoLineForDesiredVersion_ReportsError()
 {
     var t = new UpdateVersionTable();
     t.TextContentsOfTable = @"0.0.0,3.1.99999, http://first.com/first";
     t.RunningVersion = Version.Parse("3.2.0");
     var lookupResult = t.LookupURLOfUpdate();
     Assert.That(lookupResult.URL, Is.Null.Or.Empty);
     Assert.That(lookupResult.Error.Message, Is.EqualTo("http://bloomlibrary.org/channels/UpgradeTableTestChannel.txt contains no record for this version of Bloom"));
 }
 public void LookupURLOfUpdate_TooManyCommas_LogsErrorGivesNoURL()
 {
     var t = new UpdateVersionTable();
     t.TextContentsOfTable = @"0.0.0,3,1,99999, http://first.com/first"; // too many commas
     t.RunningVersion = Version.Parse("3.2.0");
     var lookupResult = t.LookupURLOfUpdate();
     Assert.That(lookupResult.URL, Is.Null.Or.Empty);
     Assert.IsTrue(lookupResult.Error.Message.StartsWith("Could not parse a line of the UpdateVersionTable"));
 }
 public void LookupURLOfUpdate_BadVersionNumber_LogsErrorGivesNoURL()
 {
     var t = new UpdateVersionTable();
     t.TextContentsOfTable = @"random,3.1.99999, http://first.com/first"; // bad version number
     t.RunningVersion = Version.Parse("3.2.0");
     var lookupResult = t.LookupURLOfUpdate();
     Assert.That(lookupResult.URL, Is.Null.Or.Empty);
     Assert.IsTrue(lookupResult.Error.Message.StartsWith("Could not parse a version number in the UpdateVersionTable"));
 }
 public void LookupURLOfUpdate_CanReadTableForAlphaFromServer()
 {
     var t = new UpdateVersionTable();
     t.URLOfTable = "http://bloomlibrary.org/channels/UpgradeTableAlpha.txt";
     t.RunningVersion = Version.Parse("2.0.2000");
     //the full result will be something like
     //"https://s3.amazonaws.com/bloomlibrary.org/deltasAlpha"
     //this just checks the part that is less likely to break (independent of channel)
     Assert.That(t.LookupURLOfUpdate().URL.StartsWith("https://s3.amazonaws.com/bloomlibrary.org/deltas"));
 }
 public void LookupURLOfUpdate_AllWell_ReportsNoErrorAndReturnsUrl()
 {
     var t = new UpdateVersionTable();
     t.TextContentsOfTable = @"0.0.0,3.2.99999, http://first.com/first";
     t.RunningVersion = Version.Parse("3.2.0");
     var lookupResult = t.LookupURLOfUpdate();
     Assert.IsFalse(lookupResult.IsConnectivityError);
     Assert.IsNull(lookupResult.Error);
     Assert.That(lookupResult.URL, Is.EqualTo("http://first.com/first"));
 }
 public void ThisVersionTooLarge_ReturnsEmptyString()
 {
     var t = new UpdateVersionTable();
     t.RunningVersion = Version.Parse("99.99.99");
     t.TextContentsOfTable = @"# the format is min,max,url
                                                 0.0.0,1.1.999, http://example.com/appcast.xml";
     Assert.IsEmpty(t.LookupURLOfUpdate().URL);
 }
 public void ServerAddressIsBogus_ErrorIsCorrect()
 {
     var t = new UpdateVersionTable {URLOfTable = "http://notthere7blah/foo.txt"};
     //the jenkins server gets a ProtocolError, while my desktop gets a NameResolutionFailure
     var e = t.LookupURLOfUpdate().Error.Status;
     Assert.IsTrue(e  == WebExceptionStatus.NameResolutionFailure || e == WebExceptionStatus.ProtocolError );
 }
 public void FileForThisChannelIsMissing_ErrorIsCorrect()
 {
     var t = new UpdateVersionTable { URLOfTable = "http://bloomlibrary.org/channels/UpgradeTableSomethingBogus.txt"};
     Assert.AreEqual(WebExceptionStatus.ProtocolError, t.LookupURLOfUpdate().Error.Status);
 }
        public void ValueOnUpperBound_ReturnsCorrectUrl()
        {
            var t = new UpdateVersionTable();
            t.TextContentsOfTable = @"# the format is min,max,url
                                                        0.0.0,1.1.999, http://first.com/first
                                                        2.1.1,2.9.999, http://second.com/second
                                                        3.2.2,3.9.999, http://third.com/third";

            t.RunningVersion = Version.Parse("1.1.999");
            Assert.AreEqual("http://first.com/first", t.LookupURLOfUpdate().URL);
            t.RunningVersion = Version.Parse("2.9.999");
            Assert.AreEqual("http://second.com/second", t.LookupURLOfUpdate().URL);
            t.RunningVersion = Version.Parse("3.9.999");
            Assert.AreEqual("http://third.com/third", t.LookupURLOfUpdate().URL);
        }