Exemple #1
0
        public void UpdateManagerConfigurationSaveTest()
        {
            var config   = new UpdateManagerConfiguration();
            var goodPath = Path.GetTempFileName();
            var badPath  = "W:\\PathThatDoesntExist";

            //Happy path
            Assert.DoesNotThrow(() => config.Save(goodPath, updateManager));

            //if statement in the catch block
            Assert.DoesNotThrow(() => config.Save(badPath, updateManager));

            //else statement in the catch block
            Assert.Throws <DirectoryNotFoundException>(() => config.Save(badPath, null));
        }
Exemple #2
0
        public void ConfigurationSerialization()
        {
            var config = new UpdateManagerConfiguration()
            {
                DownloadSourcePath  = DOWNLOAD_SOURCE_PATH_S,
                SignatureSourcePath = SIGNATURE_SOURCE_PATH_S
            };

            //save to a temp file.
            var tempFile = Path.GetTempFileName();

            Assert.DoesNotThrow(() => config.Save(tempFile, null));

            //read from a temp file.
            UpdateManagerConfiguration savedConfig = null;

            Assert.DoesNotThrow(() => savedConfig = UpdateManagerConfiguration.Load(tempFile, null));

            //Compare parameters.
            Assert.IsNotNull(savedConfig);
            Assert.AreEqual(config.CheckNewerDailyBuild, savedConfig.CheckNewerDailyBuild);
            Assert.AreEqual(config.SignatureSourcePath, savedConfig.SignatureSourcePath);
            Assert.AreEqual(config.DownloadSourcePath, savedConfig.DownloadSourcePath);
            Assert.AreEqual(config.ForceUpdate, savedConfig.ForceUpdate);
            Assert.AreEqual(config.DisableUpdates, savedConfig.DisableUpdates);
        }
Exemple #3
0
        public void UpdateManagerConfigurationSaveTest()
        {
            var config = new UpdateManagerConfiguration();

            Assert.DoesNotThrow(() => config.Save(Path.GetTempFileName(), updateManager));
        }