public void TestAutoUpdate() { updateService.CanCheckForUpdates().Returns(true); settingsProvider.Settings.Returns(new UpdaterSettings() { DisableAutoUpdates = false }); new UpdateViewModel(updateService, taskRunner, statusBar, settingsProvider, platformService, fileSystem, messageBoxService); taskRunner.Received().ScheduleTask(Arg.Any <string>(), Arg.Any <Func <Task> >()); }
public UpdateViewModel(IUpdateService updateService, ITaskRunner taskRunner, IStatusBar statusBar, IUpdaterSettingsProvider settingsProvider, IAutoUpdatePlatformService platformService, IFileSystem fileSystem, IStandaloneUpdater standaloneUpdater, IApplication application, IMessageBoxService messageBoxService) { this.updateService = updateService; this.taskRunner = taskRunner; this.statusBar = statusBar; this.settingsProvider = settingsProvider; this.platformService = platformService; this.fileSystem = fileSystem; this.messageBoxService = messageBoxService; CheckForUpdatesCommand = new DelegateCommand(() => { if (updateService.CanCheckForUpdates()) { taskRunner.ScheduleTask("Check for updates", UpdatesCheck); } }, updateService.CanCheckForUpdates); if (!settingsProvider.Settings.DisableAutoUpdates) { CheckForUpdatesCommand.Execute(null); } }