Advertisement
Guest User

Untitled

a guest
Oct 19th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. static async void RebuildTests ()
  2. {
  3. throttling.Cancel ();
  4. throttling = new CancellationTokenSource ();
  5. try {
  6. await Task.Delay (ThrottlingTimeout, throttling.Token);
  7. if (throttling.Token.IsCancellationRequested)
  8. return;
  9.  
  10. if (rootTests != null) {
  11. foreach (IDisposable t in rootTests)
  12. t.Dispose ();
  13. }
  14. List<UnitTest> list = new List<UnitTest> ();
  15. rebuildTestsCts.Cancel ();
  16. rebuildTestsCts = new CancellationTokenSource ();
  17. var token = rebuildTestsCts.Token;
  18. var items = IdeApp.Workspace.Items.ToArray ();
  19. await Task.Run (() => {
  20. foreach (WorkspaceItem it in items) {
  21. if (token.IsCancellationRequested)
  22. return;
  23. UnitTest t = BuildTest (it);
  24. if (t != null)
  25. list.Add (t);
  26. }
  27. }, token);
  28. if (token.IsCancellationRequested)
  29. return;
  30. rootTests = list.ToArray ();
  31. NotifyTestSuiteChanged ();
  32. } catch (OperationCanceledException) {
  33. } catch (Exception ex) {
  34. LoggingService.LogError ("Exception gathering unit tests.", ex);
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement