Example #1
0
        public void ConfigurationRedirection()
        {
            //Inject test config to UpdateManager instance, using reflection.
            var config = new UpdateManagerConfiguration()
            {
                DownloadSourcePath  = DOWNLOAD_SOURCE_PATH_S,
                SignatureSourcePath = SIGNATURE_SOURCE_PATH_S
            };

            var um = new DynUpdateManager(config);

            Assert.IsNotNull(um);

            var updateRequest = new Mock <IAsynchronousRequest>();

            updateRequest.Setup(ur => ur.Data)
            .Returns(UpdateManagerTestHelpers.updateAvailableData);
            um.UpdateDataAvailable(updateRequest.Object);

            // Spoof a download completion by setting the downloaded update info to the update info
            um.DownloadedUpdateInfo = um.UpdateInfo;
            Assert.NotNull(um.UpdateInfo);
            Assert.AreEqual("9.9.9.0", um.AvailableVersion.ToString());
            Assert.AreEqual(DOWNLOAD_SOURCE_PATH_S, um.UpdateInfo.VersionInfoURL);
            Assert.AreEqual(
                SIGNATURE_SOURCE_PATH_S + @"DynamoInstall9.9.9.sig",
                um.UpdateInfo.SignatureURL);
        }
        public void UpdateCheckReturnsInfoWhenNewerDailyBuildAvailable()
        {
            var updateRequest = new Mock<IAsynchronousRequest>();
            updateRequest.Setup(ur => ur.Data).Returns(UpdateManagerTestHelpers.dailyBuildAvailableData);

            var updateManager = new DynUpdateManager(NewConfiguration(checkNewerDailyBuild: true));
            updateManager.UpdateDataAvailable(updateRequest.Object);
            Assert.NotNull(updateManager.UpdateInfo);
        }
Example #3
0
        public void UpdateCheckReturnsInfoWhenNewerDailyBuildAvailable()
        {
            var updateRequest = new Mock <IAsynchronousRequest>();

            updateRequest.Setup(ur => ur.Data).Returns(UpdateManagerTestHelpers.dailyBuildAvailableData);

            var updateManager = new DynUpdateManager(NewConfiguration(checkNewerDailyBuild: true));

            updateManager.UpdateDataAvailable(updateRequest.Object);
            Assert.NotNull(updateManager.UpdateInfo);
        }
Example #4
0
        public void UpdateCheckReturnsNothingWhenNoVersionsAvailable()
        {
            var updateRequest = new Mock <IAsynchronousRequest>();

            updateRequest.Setup(ur => ur.Data).Returns(UpdateManagerTestHelpers.noData);
            var um = new DynUpdateManager(NewConfiguration());

            um.UpdateDataAvailable(updateRequest.Object);

            Assert.Null(um.UpdateInfo);
        }
        public void IsUpdateAvailableWhenForceUpdateIsTrue()
        {
            var updateRequest = new Mock<IAsynchronousRequest>();
            updateRequest.Setup(ur => ur.Data).Returns(UpdateManagerTestHelpers.noUpdateAvailableData);

            var updateManager = new DynUpdateManager(NewConfiguration(forceUpdate:true));
            updateManager.UpdateDataAvailable(updateRequest.Object);
            updateManager.DownloadedUpdateInfo = updateManager.UpdateInfo;

            Assert.IsTrue(updateManager.IsUpdateAvailable);
        }
Example #6
0
        public void UpdateCheckReturnsNothingWhenNotConnected()
        {
            var updateRequest = new Mock <IAsynchronousRequest>();

            updateRequest.Setup(ur => ur.Data).Returns(string.Empty);

            var um = new DynUpdateManager(NewConfiguration());

            um.UpdateDataAvailable(updateRequest.Object);

            Assert.Null(um.UpdateInfo);
        }
Example #7
0
        public void NoUpdateAvailableWhenUpToDate()
        {
            var updateRequest = new Mock <IAsynchronousRequest>();

            updateRequest.Setup(ur => ur.Data).Returns(UpdateManagerTestHelpers.noUpdateAvailableData);

            var updateManager = new DynUpdateManager(NewConfiguration());

            updateManager.UpdateDataAvailable(updateRequest.Object);
            updateManager.DownloadedUpdateInfo = updateManager.UpdateInfo;

            Assert.IsFalse(updateManager.IsUpdateAvailable);
        }
Example #8
0
        public void UpdateCheckReturnsCorrectVersionWhenAvailable()
        {
            var um = new DynUpdateManager(NewConfiguration());

            Assert.IsNotNull(um);

            var updateRequest = new Mock <IAsynchronousRequest>();

            updateRequest.Setup(ur => ur.Data).Returns(UpdateManagerTestHelpers.updateAvailableData);
            um.UpdateDataAvailable(updateRequest.Object);

            // Spoof a download completion by setting the downloaded update info to the update info
            um.DownloadedUpdateInfo = um.UpdateInfo;
            Assert.NotNull(um.UpdateInfo);
            Assert.AreEqual(um.AvailableVersion.ToString(), "9.9.9.0");
        }
Example #9
0
        public void UpdateCheckReturnsNothingWhenGivenBadData()
        {
            // Here we simulate some xml that is returned that is well-formed
            // but not what we are looking for. This is the case often when you
            // are logging into a network that requires an additional login, like
            // hotel wi-fi. In this case, the ListBucketResult element will not
            // be found in the xml and we'll get null UpdateInfo.

            var updateRequest = new Mock <IAsynchronousRequest>();

            updateRequest.Setup(ur => ur.Data).Returns(UpdateManagerTestHelpers.badData);

            var um = new DynUpdateManager(NewConfiguration());

            um.UpdateDataAvailable(updateRequest.Object);

            Assert.Null(um.UpdateInfo);
        }
        public void UpdateCheckReturnsNothingWhenGivenBadData()
        {
            // Here we simulate some xml that is returned that is well-formed
            // but not what we are looking for. This is the case often when you
            // are logging into a network that requires an additional login, like
            // hotel wi-fi. In this case, the ListBucketResult element will not 
            // be found in the xml and we'll get null UpdateInfo.

            var updateRequest = new Mock<IAsynchronousRequest>();
            updateRequest.Setup(ur => ur.Data).Returns(UpdateManagerTestHelpers.badData);

            var um = new DynUpdateManager(NewConfiguration());
            um.UpdateDataAvailable(updateRequest.Object);

            Assert.Null(um.UpdateInfo);
        }
        public void UpdateCheckReturnsNothingWhenNotConnected()
        {
            var updateRequest = new Mock<IAsynchronousRequest>();
            updateRequest.Setup(ur => ur.Data).Returns(string.Empty);

            var um = new DynUpdateManager(NewConfiguration());
            um.UpdateDataAvailable(updateRequest.Object);

            Assert.Null(um.UpdateInfo);
        }
        public void UpdateCheckReturnsNothingWhenNoVersionsAvailable()
        {
            var updateRequest = new Mock<IAsynchronousRequest>();
            updateRequest.Setup(ur => ur.Data).Returns(UpdateManagerTestHelpers.noData);
            var um = new DynUpdateManager(NewConfiguration());
            um.UpdateDataAvailable(updateRequest.Object);

            Assert.Null(um.UpdateInfo);
        }
        public void ConfigurationRedirection()
        {
            //Inject test config to UpdateManager instance, using reflection.
            var config = new UpdateManagerConfiguration()
            {
                DownloadSourcePath = DOWNLOAD_SOURCE_PATH_S,
                SignatureSourcePath = SIGNATURE_SOURCE_PATH_S
            };

            var um = new DynUpdateManager(config);
            Assert.IsNotNull(um);
        
            var updateRequest = new Mock<IAsynchronousRequest>();
            updateRequest.Setup(ur => ur.Data)
                .Returns(UpdateManagerTestHelpers.updateAvailableData);
            um.UpdateDataAvailable(updateRequest.Object);

            // Spoof a download completion by setting the downloaded update info to the update info
            um.DownloadedUpdateInfo = um.UpdateInfo;
            Assert.NotNull(um.UpdateInfo);
            Assert.AreEqual("9.9.9.0", um.AvailableVersion.ToString());
            Assert.AreEqual(DOWNLOAD_SOURCE_PATH_S, um.UpdateInfo.VersionInfoURL);
            Assert.AreEqual(
                SIGNATURE_SOURCE_PATH_S + @"DynamoInstall9.9.9.sig",
                um.UpdateInfo.SignatureURL);
        }
        public void UpdateCheckReturnsCorrectVersionWhenAvailable()
        {
            var um = new DynUpdateManager(NewConfiguration());
            Assert.IsNotNull(um);

            var updateRequest = new Mock<IAsynchronousRequest>();
            updateRequest.Setup(ur => ur.Data).Returns(UpdateManagerTestHelpers.updateAvailableData);
            um.UpdateDataAvailable(updateRequest.Object);

            // Spoof a download completion by setting the downloaded update info to the update info
            um.DownloadedUpdateInfo = um.UpdateInfo;
            Assert.NotNull(um.UpdateInfo);
            Assert.AreEqual(um.AvailableVersion.ToString(), "9.9.9.0");
        }