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);
39 Assert.IsTrue(subtask.Done);
45 ASubTaskForTest subtask = new ASubTaskForTest();
46 subtask.CallNotifyStarted();
47 Assert.IsFalse(subtask.Done);
48 subtask.CallNotifyCompleted();
49 Assert.IsTrue(subtask.Done);
53 public void UseProgress()
55 ASubTaskForTest subtask = new ASubTaskForTest();
56 Assert.IsTrue(subtask.UseProgress);
62 ASubTaskForTest subtask = new ASubTaskForTest();
63 Assert.IsFalse(subtask.Running);
64 Assert.IsFalse(subtask.Done);
66 Assert.IsFalse(subtask.Running);
67 Assert.IsTrue(subtask.Done);
72 private class ASubTaskForTest : NaGetSubTask
74 public override void Run()
81 public void CallNotifyStarted()
86 public void CallNotifyCompleted()
91 public void CallNotifyCancelled()