public void Initialize_Test() { var file = new MemoryFileInfo("Hello from uploader..."); var uploadItem = new UploadItem(file); var handler = Substitute.For<UploadHandlerBase>(); var task = new Task(handler, uploadItem); Assert.AreEqual(task.Handler, handler); Assert.AreEqual(task.UploadItem, uploadItem); }
public void Dispose_Test() { var file = new MemoryFileInfo("Hello from uploader..."); var uploadItem = new UploadItem(file); var handler = Substitute.For<UploadHandlerBase>(); var task = new Task(handler, uploadItem); task.Dispose(); handler.Received(1).Dispose(); }
public void Run_Test() { var file = new MemoryFileInfo("Hello from uploader..."); var uploadItem = new UploadItem(file); var handler = new LocalUploadHandler(); var completed = false; var task = new Task(handler, uploadItem); task.Run(() => { completed = true; }); Assert.IsTrue(completed); }