Esempio n. 1
0
 public void ToggleOwnAutoStart_AddsOwnAutoStart_If_NotSet()
 {
     Service.ToggleOwnAutoStart();
     A.CallTo(() => ConnectorService.AddAutoStart(A <AutoStartEntry> .Ignored)).WhenArgumentsMatch(
         (AutoStartEntry autoStart) =>
         autoStart.Category == Category.CurrentUserRun64 &&
         autoStart.Path == "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\Auto Start Confirm" &&
         autoStart.Value == CurrentExePath
         ).MustHaveHappened();
 }
 public Task ToggleOwnAutoStart()
 {
     return(Task.Run(() => {
         try {
             AppStatus.IncrementRunningActionCount();
             AutoStartService.ToggleOwnAutoStart();
         } catch (Exception e) {
             var message = "Failed to change own auto start";
             var err = new Exception(message, e);
             Logger.Error(err);
             MessageService.ShowError(message, e);
         } finally {
             AppStatus.DecrementRunningActionCount();
         }
     }));
 }