Exemple #1
0
        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);
        }
Exemple #2
0
        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();
        }
Exemple #3
0
        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);
        }