示例#1
0
 public void APICodePackWrapperSave()
 {
     try
     {
         UnitTestWinFormHelper.RunTaskTimeout(token => Task.Run(() =>
                                                                WindowsAPICodePackWrapper.Save(FileSystemUtils.ExecutableDirectoryName(), "Test", null, null), token));
     }
     catch (COMException)
     {
     }
     catch (TimeoutException)
     {
     }
     catch (OperationCanceledException)
     {
     }
     catch (Exception ex)
     {
         Assert.Fail(
             $"Wrong exception got {ex.GetType().Name} expected OperationCanceledException : {ex.ExceptionMessages()}");
     }
 }
示例#2
0
 public void WindowsAPICodePackWrapperSave()
 {
     try
     {
         // Used to cancel after .2 seconds
         UnitTestWinFormHelper.RunTaskTimeout(
             token => Task.Run(() =>
         {
             WindowsAPICodePackWrapper.Save(FileSystemUtils.ExecutableDirectoryName(), "Test", "*.pdf", ".pdf", false,
                                            "test.pdf");
         }, token));
     }
     catch (COMException)
     {
     }
     catch (TimeoutException)
     {
     }
     catch (Exception ex)
     {
         Assert.Fail(
             $"Wrong exception got {ex.GetType().Name} expected OperationCanceledException : {ex.ExceptionMessages()}");
     }
 }