コード例 #1
0
ファイル: TaskTest.cs プロジェクト: vincoss/uploader-toolkit
        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);
        }
コード例 #2
0
ファイル: TaskTest.cs プロジェクト: vincoss/uploader-toolkit
        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();
        }
コード例 #3
0
ファイル: TaskTest.cs プロジェクト: vincoss/uploader-toolkit
        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);
        }