Exemplo n.º 1
0
        public void OtherResponseShouldReturnTrue()
        {
            var parser = new ZsyncOutputParser();

            var output = parser.VerifyZsyncCompatible("some other response");

            output.Should().BeTrue("because the magic string is not found");
        }
Exemplo n.º 2
0
        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");
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        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();
                }
            }
        }