2 using System.Threading;
5 using NaGet.SubCommands.SubTask;
7 namespace test_na_get_lib
10 public class NaGetSubTaskTest
15 ASubTaskForTest subtask = new ASubTaskForTest();
16 Assert.IsFalse(subtask.Running);
17 subtask.CallNotifyStarted();
18 Assert.IsTrue(subtask.Running);
19 subtask.CallNotifyCompleted();
20 Assert.IsFalse(subtask.Running);
22 subtask = new ASubTaskForTest();
23 Assert.IsFalse(subtask.Running);
24 subtask.CallNotifyStarted();
25 Assert.IsTrue(subtask.Running);
26 subtask.CallNotifyCancelled();
27 Assert.IsFalse(subtask.Running);
31 public void Cancelled()
33 ASubTaskForTest subtask = new ASubTaskForTest();
34 Assert.IsFalse(subtask.Cancelled);
35 subtask.CallNotifyStarted();
36 Assert.IsFalse(subtask.Cancelled);
37 subtask.CallNotifyCancelled();
38 Assert.IsTrue(subtask.Cancelled);
44 ASubTaskForTest subtask = new ASubTaskForTest();
45 subtask.CallNotifyStarted();
46 Assert.IsFalse(subtask.Done);
47 subtask.CallNotifyCompleted();
48 Assert.IsTrue(subtask.Done);
52 public void UseProgress()
54 ASubTaskForTest subtask = new ASubTaskForTest();
55 Assert.IsTrue(subtask.UseProgress);
61 ASubTaskForTest subtask = new ASubTaskForTest();
62 Assert.IsFalse(subtask.Running);
63 Assert.IsFalse(subtask.Done);
65 Assert.IsFalse(subtask.Running);
66 Assert.IsTrue(subtask.Done);
71 private class ASubTaskForTest : NaGetSubTask
73 public override void Run()
80 public void CallNotifyStarted()
85 public void CallNotifyCompleted()
90 public void CallNotifyCancelled()