public void CanPullWithSub() { var mock = A.Fake<IRsyncLauncher>(); A.CallTo(() => mock.Run(@"testremote\sub", "testsrc", 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.Pull("sub"); A.CallTo(() => mock.Run(@"testremote\sub", "testsrc", new RsyncOptions { Key = @"C:\key" })).MustHaveHappened(Repeated.Exactly.Once); }
public void PullError() { 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("b", "a", null, mock); Assert.Throws<RsyncException>(() => _controller.Pull()); A.CallTo(() => mock.Run("a", "b", null)) .MustHaveHappened(Repeated.Exactly.Once); }
public override int Run(params string[] remainingArguments) { var src = remainingArguments[0]; var dst = remainingArguments[1]; System.Console.WriteLine("Pulling..."); var rm = new RsyncController(dst, src, Key, _rsyncLauncher); var status = new TransferStatus(src); using ( new TimerWithoutOverlap(200, () => System.Console.Write("\r" + status.Progress + "% " + Tools.FileUtil.GetFileSize(status.Speed) + "/s "))) rm.Pull(status); System.Console.Write("\n100% " + Tools.FileUtil.GetFileSize(status.Speed) + "/s "); System.Console.WriteLine("\nCompleted"); return 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; }
public void Setup() { _controller = new RsyncController("testsrc", "testremote", @"C:\key", A.Fake<IRsyncLauncher>()); }