public void OtherResponseShouldReturnTrue() { var parser = new ZsyncOutputParser(); var output = parser.VerifyZsyncCompatible("some other response"); output.Should().BeTrue("because the magic string is not found"); }
public void PartialContentResponseShouldReturnFalse() { var parser = new ZsyncOutputParser(); var output = parser.VerifyZsyncCompatible( "zsync received a data response (code 200) but this is not a partial content response"); output.Should().BeFalse("because the magic string is found"); }
public void ParseOutput() { var parser = new ZsyncOutputParser(); var progress = A.Fake<ITransferProgress>(); var process = new Process(); parser.ParseOutput(process, "###################- 97.3% 141.5 kBps 0:00:01 ETA", progress); progress.Progress.Should().Be(97.3); progress.Speed.Should().Be((long) (141.5*1024)); progress.Eta.Should().Be(TimeSpan.FromSeconds(1)); }
public ZsyncLauncher(IProcessManager processManager, IPathConfiguration configuration, ZsyncOutputParser parser, IAuthProvider authProvider) { if (processManager == null) throw new ArgumentNullException(nameof(processManager)); if (configuration == null) throw new ArgumentNullException(nameof(configuration)); _authProvider = authProvider; _processManager = processManager; _parser = parser; _binPath = configuration.ToolCygwinBinPath.GetChildFileWithName("zsync.exe"); }
public ZsyncLauncher(IProcessManager processManager, IPathConfiguration configuration, ZsyncOutputParser parser, IAuthProvider authProvider) { if (processManager == null) { throw new ArgumentNullException(nameof(processManager)); } if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } _authProvider = authProvider; _processManager = processManager; _parser = parser; _binPath = configuration.ToolCygwinBinPath.GetChildFileWithName("zsync.exe"); }
public void ZsyncLoopCheck() { var parser = new ZsyncOutputParser(); var progress = A.Fake<ITransferProgress>(); using (var process = Process.Start("cmd.exe")) { var result = parser.CheckZsyncLoop(process, "downloading from ", progress); result = parser.CheckZsyncLoop(process, "downloading from ", progress); result = parser.CheckZsyncLoop(process, "downloading from ", progress); result.Should().BeTrue("because it is looping"); if (!process.HasExited) process.Kill(); } }