예제 #1
0
        public void ShouldGetCorrectNonEmptyFolderSize()
        {
            folder.Setup(x => x.Count).Returns(1);
            var transfer = new FolderTransfer(commands.Object, null, folder.Object, "");

            Assert.That(transfer.Size, Is.EqualTo(1));
        }
예제 #2
0
        // TODO: Break down into smaller test cases
        public void ShouldDownloadEmptyFolder()
        {
            var cwd = Environment.CurrentDirectory;

            // Create FolderTransfer with destination
            var transfer = new FolderTransfer(commands.Object, null, folder.Object, Path.Combine(cwd, folderName));

            //Set up expectations that ensure that the TransferDone event is fired
            Mock <IEventHandler> gui = mocks.Create <IEventHandler>();

            gui.Setup(x => x.OnTransferDone()).AtMostOnce();
            transfer.TransferDone += gui.Object.OnTransferDone;
            //Since this test empty folders we don't need childrens
            folder.Setup(x => x.Children).Returns(new NodeChildren(null));

            Assert.That(transfer.Progress, Is.EqualTo(0.0));
            Assert.That(transfer.Status, Is.EqualTo(Status.Idle));

            transfer.Start();

            Assert.That(transfer.Progress, Is.EqualTo(0.0));
            Assert.That(transfer.Status, Is.EqualTo(Status.Pending));

            folder.Raise(x => x.Updated -= null, folder.Object);

            Assert.That(transfer.Progress, Is.EqualTo(1.0));
            Assert.That(transfer.Status, Is.EqualTo(Status.Done));

            Assert.That(Directory.Exists(Path.Combine(cwd, folderName)));
        }
예제 #3
0
        public void ShouldGetCorrectEmptyFolderSize()
        {
            var transfer = new FolderTransfer(commands.Object, null, folder.Object, "");

            Assert.That(transfer.Size, Is.EqualTo(0));
        }