Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static async void RebuildTests ()
- {
- throttling.Cancel ();
- throttling = new CancellationTokenSource ();
- try {
- await Task.Delay (ThrottlingTimeout, throttling.Token);
- if (throttling.Token.IsCancellationRequested)
- return;
- if (rootTests != null) {
- foreach (IDisposable t in rootTests)
- t.Dispose ();
- }
- List<UnitTest> list = new List<UnitTest> ();
- rebuildTestsCts.Cancel ();
- rebuildTestsCts = new CancellationTokenSource ();
- var token = rebuildTestsCts.Token;
- var items = IdeApp.Workspace.Items.ToArray ();
- await Task.Run (() => {
- foreach (WorkspaceItem it in items) {
- if (token.IsCancellationRequested)
- return;
- UnitTest t = BuildTest (it);
- if (t != null)
- list.Add (t);
- }
- }, token);
- if (token.IsCancellationRequested)
- return;
- rootTests = list.ToArray ();
- NotifyTestSuiteChanged ();
- } catch (OperationCanceledException) {
- } catch (Exception ex) {
- LoggingService.LogError ("Exception gathering unit tests.", ex);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement