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 static DynamoController MakeSandbox(string commandFilePath = null) { DynamoController controller; var logger = new DynamoLogger(); var updateManager = new UpdateManager.UpdateManager(logger); // If a command file path is not specified or if it is invalid, then fallback. if (string.IsNullOrEmpty(commandFilePath) || (File.Exists(commandFilePath) == false)) { controller = new DynamoController("None", updateManager, logger, new DefaultWatchHandler(), Dynamo.PreferenceSettings.Load()); controller.DynamoViewModel = new DynamoViewModel(controller, null); } else { controller = new DynamoController("None", updateManager, logger, new DefaultWatchHandler(), Dynamo.PreferenceSettings.Load()); controller.DynamoViewModel = new DynamoViewModel(controller, commandFilePath); } controller.VisualizationManager = new VisualizationManager(); return(controller); }
/// <summary> ///if we are building a model for CLI mode, then we don't want to start an updateManager ///for now, building an updatemanager instance requires finding Dynamo install location ///which if we are running on mac os or *nix will use different logic then SandboxLookup /// </summary> private static IUpdateManager InitializeUpdateManager() { var cfg = UpdateManagerConfiguration.GetSettings(new SandboxLookUp()); var um = new Dynamo.UpdateManager.UpdateManager(cfg); Debug.Assert(cfg.DynamoLookUp != null); return(um); }
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); }
private readonly FieldInfo fieldInfo; //internal configuration field. /// <summary> /// Creates ConfigInjection instance. /// </summary> /// <param name="updateManager">UpdateManager instance to which configuration is to be injected.</param> /// <param name="configuration">The configuration for injection.</param> public ConfigInjection(DynUpdateManager updateManager, UpdateManagerConfiguration configuration) { this.updateManager = updateManager; fieldInfo = updateManager.GetType() .GetField("configuration", BindingFlags.NonPublic | BindingFlags.Instance); Assert.IsNotNull(fieldInfo); this.configuration = fieldInfo.GetValue(updateManager); fieldInfo.SetValue(updateManager, configuration); }
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); }
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); }
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 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); }
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"); }
public void NoUpdateIsAvailableWhenHigherVersionDynamoIsInstalled() { var lookup = new Mock <DynamoLookUp>(); lookup.Setup(l => l.GetDynamoInstallLocations()).Returns(new[] { "A" }); lookup.Setup(l => l.GetDynamoVersion(It.IsAny <string>())) .Returns <string>(s => Version.Parse("9.9.9.0")); var um = new DynUpdateManager(NewConfiguration(false, false, lookup.Object)); Assert.IsNotNull(um); DynUpdateManager.CheckForProductUpdate(um); um.DownloadedUpdateInfo = um.UpdateInfo; Assert.IsNull(um.UpdateInfo); Assert.IsFalse(um.IsUpdateAvailable); }
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); }
/// <summary> ///if we are building a model for CLI mode, then we don't want to start an updateManager ///for now, building an updatemanager instance requires finding Dynamo install location ///which if we are running on mac os or *nix will use different logic then SandboxLookup /// </summary> private static IUpdateManager InitializeUpdateManager() { var cfg = UpdateManagerConfiguration.GetSettings(new SandboxLookUp()); var um = new Dynamo.UpdateManager.UpdateManager(cfg); Debug.Assert(cfg.DynamoLookUp != null); return um; }
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 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 NoUpdateIsAvailableWhenHigherVersionDynamoIsInstalled() { var lookup = new Mock<DynamoLookUp>(); lookup.Setup(l => l.GetDynamoInstallLocations()).Returns(new[] { "A" }); lookup.Setup(l => l.GetDynamoVersion(It.IsAny<string>())) .Returns<string>(s => Version.Parse("9.9.9.0")); var um = new DynUpdateManager(NewConfiguration(false, false, lookup.Object)); Assert.IsNotNull(um); DynUpdateManager.CheckForProductUpdate(um); um.DownloadedUpdateInfo = um.UpdateInfo; Assert.IsNull(um.UpdateInfo); Assert.IsFalse(um.IsUpdateAvailable); }
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"); }
public static DynamoController MakeSandbox(string commandFilePath = null) { DynamoController controller; var logger = new DynamoLogger(); var updateManager = new UpdateManager.UpdateManager(logger); // If a command file path is not specified or if it is invalid, then fallback. if (string.IsNullOrEmpty(commandFilePath) || (File.Exists(commandFilePath) == false)) { controller = new DynamoController("None", updateManager, logger, new DefaultWatchHandler(), Dynamo.PreferenceSettings.Load()); controller.DynamoViewModel = new DynamoViewModel(controller, null); } else { controller = new DynamoController("None", updateManager, logger, new DefaultWatchHandler(), Dynamo.PreferenceSettings.Load()); controller.DynamoViewModel = new DynamoViewModel(controller, commandFilePath); } controller.VisualizationManager = new VisualizationManager(); return controller; }
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 NoUpdateAvailableWhenUpdateInfoIsNotYetDownloaded() { var updateManager = new DynUpdateManager(NewConfiguration()); Assert.IsFalse(updateManager.IsUpdateAvailable); }
public static DynamoController MakeSandbox(string commandFilePath = null) { var corePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); DynamoPathManager.Instance.InitializeCore(corePath); DynamoController controller; var logger = new DynamoLogger(DynamoPathManager.Instance.Logs); dynSettings.DynamoLogger = logger; var updateManager = new UpdateManager.UpdateManager(logger); // If a command file path is not specified or if it is invalid, then fallback. if (string.IsNullOrEmpty(commandFilePath) || (File.Exists(commandFilePath) == false)) { controller = new DynamoController("None", updateManager, new DefaultWatchHandler(), Dynamo.PreferenceSettings.Load(), corePath); controller.DynamoViewModel = new DynamoViewModel(controller, null); } else { controller = new DynamoController("None", updateManager, new DefaultWatchHandler(), Dynamo.PreferenceSettings.Load(), corePath); controller.DynamoViewModel = new DynamoViewModel(controller, commandFilePath); } controller.VisualizationManager = new VisualizationManager(); return controller; }
void updateManager_UpdateDownloaded(object sender, UpdateManager.UpdateDownloadedEventArgs e) { UpdateManager.QuitAndInstallUpdate(); }
public static UpdateManager CreateInstance(DynamoLogger logger) { if (self != null) return self; if (null == logger) throw new ArgumentNullException("logger", "Unspecified logger (61578808A807)"); self = new UpdateManager(logger); return self; }
void Instance_UpdateDownloaded(object sender, UpdateManager.UpdateDownloadedEventArgs e) { RaisePropertyChanged("Version"); RaisePropertyChanged("UpToDate"); }
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); }