Example #1
0
        public void FileMoverCancelSetsCancelOnEventArgs()
        {
            this.IsCancelled = true;
            var fileMover = new FileMoverInternal(new Mock <IProgressFileMover>().Object, "source", "dest", ProgressUpdater);

            var fileMoverEventArgs = new FileMoveProgressArgs(1, 1);

            fileMover.ProgressCallback(fileMoverEventArgs);
            this.IsCancelled = false;
            Assert.IsTrue(fileMoverEventArgs.Cancelled);
        }
Example #2
0
        public void FileMoverUpdatesProgressUpdater()
        {
            var totalBytes       = 0L;
            var transferredBytes = 0L;

            Action <FileMoveProgressArgs> _progressUpdated = (FileMoveProgressArgs progressArgs) =>
            {
                totalBytes             = progressArgs.TotalBytes;
                transferredBytes       = progressArgs.TransferredBytes;
                progressArgs.Cancelled = false;
            };

            var fileMover = new FileMoverInternal(new Mock <IProgressFileMover>().Object, "source", "dest", _progressUpdated);

            var fileMoverEventArgs = new FileMoveProgressArgs(100, 50);

            fileMover.ProgressCallback(fileMoverEventArgs);

            Assert.AreEqual(100, totalBytes);
            Assert.AreEqual(50, transferredBytes);
        }