Ejemplo n.º 1
0
 public void CanPushWithSub() {
     var mock = A.Fake<IRsyncLauncher>();
     A.CallTo(() => mock.Run(@"testsrc\sub", "testremote", new RsyncOptions { Key = @"C:\key" }))
         .Returns(new ProcessExitResultWithOutput(0, 0, new ProcessStartInfo(), string.Empty, string.Empty));
     _controller = new RsyncController("testsrc", "testremote", @"C:\key", mock);
     _controller.Push("sub");
     A.CallTo(() => mock.Run(@"testsrc\sub", "testremote", new RsyncOptions { Key = @"C:\key" }))
         .MustHaveHappened(Repeated.Exactly.Once);
 }
Ejemplo n.º 2
0
        public override int Run(params string[] remainingArguments) {
            var src = remainingArguments[0];
            var dst = remainingArguments[1];
            if (MakeZsync) {
                System.Console.WriteLine("Creating zsync files...");
                _zsyncMake.CreateZsyncFiles(src.ToAbsoluteDirectoryPath(), GetOptions());
            }

            System.Console.WriteLine("Pushing...");

            var rm = new RsyncController(src, dst, Key, _rsyncLauncher);
            var status = new TransferStatus(src);
            using (
                new TimerWithoutOverlap(200,
                    () =>
                        System.Console.Write("\r" + status.Progress + "% " + Tools.FileUtil.GetFileSize(status.Speed) +
                                             "/s                    ")))
                rm.Push(status);

            System.Console.WriteLine("\nCompleted");

            return 0;
        }
Ejemplo n.º 3
0
        public void PushError() {
            var mock = A.Fake<IRsyncLauncher>();
            A.CallTo(() => mock.Run("a", "b", null))
                .Returns(new ProcessExitResultWithOutput(1, 0, new ProcessStartInfo(), String.Empty, String.Empty));

            _controller = new RsyncController("a", "b", null, mock);
            Assert.Throws<RsyncException>(() => _controller.Push());
            A.CallTo(() => mock.Run("a", "b", null))
                .MustHaveHappened(Repeated.Exactly.Once);
        }