コード例 #1
0
        public void ForceCheck()
        {
            var info = new VersionCheckInfo
            {
                OnlineCheck  = DateTime.Today.AddDays(-2),
                LocalVersion = LocalVersion,
            };

            Context.Current.SaveLocalSettings("LastVersionCheck", info);

            Assert.IsTrue(new VersionCheck().BeginCheckForUpdate(true, null));
        }
コード例 #2
0
        public void LastCheckNotLongTimeAgo()
        {
            var info = new VersionCheckInfo
            {
                OnlineCheck  = DateTime.Today.AddDays(-2),
                LocalVersion = LocalVersion,
            };

            Context.Current.SaveLocalSettings("LastVersionCheck", info);

            Assert.IsFalse(new VersionCheck().BeginCheckForUpdate(false, null));
        }
コード例 #3
0
        public void LastCheckLongTimeAgo()
        {
            var info = new VersionCheckInfo
            {
                OnlineCheck  = DateTime.Today.AddDays(-8),
                LocalVersion = LocalVersion,
            };

            Context.Current.SaveLocalSettings("LastVersionCheck", info);

            Assert.IsTrue(new VersionCheck().BeginCheckForUpdate(false, null));

            // The second time, it should not check again
            Assert.IsFalse(new VersionCheck().BeginCheckForUpdate(false, null));
        }
コード例 #4
0
        public void UpdateAvailable()
        {
            var info = new VersionCheckInfo();

            Context.Current.SaveLocalSettings("LastVersionCheck", info);
            var request = new VersionCheckTestRequest("100.1.0.0");

            Assert.IsTrue(new VersionCheck().BeginCheckForUpdate(true, request));

            info = Context.Current.LoadLocalSettings <VersionCheckInfo>("LastVersionCheck");
            Assert.IsTrue(info.UpdateAvailable);
            Assert.AreEqual("100.1.0.0", info.UpdateVersion);

            // The second time, it should not check again
            Assert.IsFalse(new VersionCheck().BeginCheckForUpdate(false, request));
        }
コード例 #5
0
        public void NotTheSameVersion()
        {
            var info = new VersionCheckInfo
            {
                OnlineCheck  = DateTime.Today.AddDays(-2),
                LocalVersion = "1.0.0.5",
            };

            Context.Current.SaveLocalSettings("LastVersionCheck", info);

            Assert.IsTrue(new VersionCheck().BeginCheckForUpdate(true, null));

            info = Context.Current.LoadLocalSettings <VersionCheckInfo>("LastVersionCheck");
            Assert.AreEqual(LocalVersion, info.LocalVersion);

            // The second time, it should not check again
            Assert.IsFalse(new VersionCheck().BeginCheckForUpdate(false, null));
        }
コード例 #6
0
        public void UpdateAlreadyDismissed()
        {
            var info = new VersionCheckInfo()
            {
                OnlineCheck     = DateTime.Today.AddDays(-100),
                LocalVersion    = "1.0.0.4",
                UpdateVersion   = "100.1.0.0",
                UpdateAvailable = false
            };

            Context.Current.SaveLocalSettings("LastVersionCheck", info);

            var request = new VersionCheckTestRequest("100.1.0.0");

            Assert.IsTrue(new VersionCheck().BeginCheckForUpdate(true, request));

            info = Context.Current.LoadLocalSettings <VersionCheckInfo>("LastVersionCheck");
            Assert.IsFalse(info.UpdateAvailable);

            // The second time, it should not check again
            Assert.IsFalse(new VersionCheck().BeginCheckForUpdate(false, request));
        }