OSDN Git Service

na-get-lib,新構造タスクのキャンセル処理を修正。
authorttp <ttp@users.sourceforge.jp>
Sat, 7 May 2011 07:46:23 +0000 (16:46 +0900)
committerttp <ttp@users.sourceforge.jp>
Sat, 7 May 2011 07:46:23 +0000 (16:46 +0900)
na-get-lib/NaGet.SubCommands.SubTask/NaGetSubTask.cs
na-get-lib/NaGet.SubCommands/NaGetTaskSet2.cs
na-get-lib/NaGet.SubCommands/NaGetUpdate2.cs
test-na-get-lib/NaGetSubTaskTest.cs
test-na-get-lib/NaGetTaskSet2Test.cs

index e1de4d8..d580bbb 100644 (file)
@@ -63,6 +63,7 @@ namespace NaGet.SubCommands.SubTask
                {
                        isRunning = false;
                        isCancelled = true;
+                       isDone = true;
                }
                
                /// <summary>
index eb43c19..3a20d18 100644 (file)
@@ -104,6 +104,7 @@ namespace NaGet.SubCommands
                protected virtual void NotifyCancelled()
                {
                        isCancelled = true;
+                       isDone = true;
                }
                
                /// <summary>
index 59856e2..8de79ac 100644 (file)
@@ -83,7 +83,7 @@ namespace NaGet.SubCommands
                        
                        if (cancelCalled) {
                                NotifyCancelled();
-                               RaiseTaskSetEvent(TaskEventType.CANCELED, string.Empty);
+                               RaiseTaskSetEvent(TaskEventType.CANCELED, "キャンセルされました");
                        } else {
                                NotifyCompleted();
                                RaiseTaskSetEvent(TaskEventType.COMPLETED, string.Empty);
index 95973bb..5cc142b 100644 (file)
@@ -36,6 +36,7 @@ namespace test_na_get_lib
                        Assert.IsFalse(subtask.Cancelled);
                        subtask.CallNotifyCancelled();
                        Assert.IsTrue(subtask.Cancelled);
+                       Assert.IsTrue(subtask.Done);
                }
                
                [Test]
index e27ef07..f2350b0 100644 (file)
@@ -234,6 +234,7 @@ namespace test_na_get_lib
                        Assert.AreEqual(true, cancelRetVal);
                        Assert.IsTrue(task.Cancelled);
                        Assert.IsFalse(task.Cancelable);
+                       Assert.IsTrue(task.Done);
                        
                        // すでにキャンセルしているものにはキャンセルはできない
                        Assert.IsFalse(task.Cancel());
@@ -264,6 +265,7 @@ namespace test_na_get_lib
                        Assert.AreEqual(true, cancelRetVal);
                        Assert.IsTrue(task.Cancelled);
                        Assert.IsFalse(task.Cancelable);
+                       Assert.IsTrue(task.Done);
                        Assert.IsTrue(((ASubTaskForEventTest) subTasks[0]).Cancelled);
                        Assert.IsFalse(((ASubTaskForEventTest) subTasks[0]).Cancelable);
                        Assert.IsTrue(cancelBlockPassed);