Exemplo n.º 1
0
        private void CreateOutputFile()
        {
            var list = new HtmlFileReader().ReadAllFilesInDirectory(settings.DownloadPath);
            var listOfTasks = new TaskPageParser().ParseMultiplePages(list);

            var csvWriter = new CsvWriter(new Formatter(), settings.OutputFilePath);
            csvWriter.WriteToFile(listOfTasks);
        }
Exemplo n.º 2
0
        public void TaskPageParserFillsInReceivedDate()
        {
            var html = "<table width=100% class=noborder cellpadding=10 cellspacing=0> \n";
            html += @"<tr><td width=""40%"" class=fieldname>Received</td><td class=fieldvalue>29 May 2012 | 14:01:08 UTC</td></tr>";

            var result = new TaskPageParser().ParsePage(html);
            Assert.That(result.Received, Is.EqualTo("29 May 2012 | 14:01:08 UTC"));
        }
Exemplo n.º 3
0
        public void TaskPageParserFillsInOutcome()
        {
            var html = "<table width=100% class=noborder cellpadding=10 cellspacing=0> \n";
            html += @"<tr><td width=""40%"" class=fieldname>Outcome</td><td class=fieldvalue>Success</td></tr>";

            var result = new TaskPageParser().ParsePage(html);
            Assert.That(result.Outcome, Is.EqualTo("Success"));
        }
Exemplo n.º 4
0
        public void TaskPageParserFillsInPulseCount()
        {
            var html = "Spike count:    3 \n";
            html += "Pulse count:    1 \n";

            var result = new TaskPageParser().ParsePage(html);
            Assert.That(result.PulseCount, Is.EqualTo(1));
        }
Exemplo n.º 5
0
        public void TaskPageParserFillsInCredit()
        {
            var html = "<tr><td width=40% class=fieldname>Run time</td><td class=fieldvalue>15,377.70</td></tr> \n";
            html += @"<tr><td width=""40%"" class=fieldname>Credit</td><td class=fieldvalue>106.62</td></tr>";

            var result = new TaskPageParser().ParsePage(html);
            Assert.That(result.Credit, Is.EqualTo(106.62));
        }
Exemplo n.º 6
0
        public void TaskPageParserFillsInGaussianCount()
        {
            var html = "Spike count:    3 \n";
            html += "Gaussian count:    5 \n";

            var result = new TaskPageParser().ParsePage(html);
            Assert.That(result.GaussianCount, Is.EqualTo(5));
        }
Exemplo n.º 7
0
        public void TaskPageParserFillsInApplicationVersion()
        {
            var html = "<table width=100% class=noborder cellpadding=10 cellspacing=0> \n";
            html += @"<tr><td width=""40%"" class=fieldname>Application version</td><td class=fieldvalue>SETI@home Enhanced v6.03 </td></tr>";

            var result = new TaskPageParser().ParsePage(html);
            Assert.That(result.ApplicationVersion, Is.EqualTo("SETI@home Enhanced v6.03"));
        }
Exemplo n.º 8
0
        public void TaskPageParserFillsInCpuTime()
        {
            var html = "<tr><td width=40% class=fieldname>Run time</td><td class=fieldvalue>15,377.70</td></tr> \n";
            html += @"<tr><td width=""40%"" class=fieldname>CPU time</td><td class=fieldvalue>15,193.00</td></tr> \n";

            var result = new TaskPageParser().ParsePage(html);
            Assert.That(result.CpuTime, Is.EqualTo(15193.00));
        }
Exemplo n.º 9
0
        public void TaskPageParserFillsInRunTime()
        {
            var html = "<table width=100% class=noborder cellpadding=10 cellspacing=0> \n";
            html += @"<tr><td width=""40%"" class=fieldname>Run time</td><td class=fieldvalue>15,377.70</td></tr>";

            var result = new TaskPageParser().ParsePage(html);
            Assert.That(result.RunTime, Is.EqualTo(15377.70));
        }
Exemplo n.º 10
0
        public void TaskPageParserProcessesMultiplePages()
        {
            const string taskPage1 = "<title>Task 2454236316</title> \n";
            const string taskPage2 = "<title>Task 3333333333</title> \n";

            var result = new TaskPageParser().ParseMultiplePages(new List<string> {taskPage1, taskPage2});
            Assert.That(result.Count, Is.EqualTo(2));
            Assert.That(result[0].Number, Is.EqualTo("2454236316"));
            Assert.That(result[1].Number, Is.EqualTo("3333333333"));
        }
Exemplo n.º 11
0
        public void TaskPageParserFillsInWorkunitNumber()
        {
            var html = "<table width=100% class=noborder cellpadding=10 cellspacing=0> \n";
            html += @"<tr><td width=""40%"" class=fieldname>Workunit</td><td class=fieldvalue><a href=""workunit.php?wuid=998887303"">998887303</a></td></tr>";

            var result = new TaskPageParser().ParsePage(html);
            Assert.That(result.Workunit, Is.EqualTo("998887303"));
        }
Exemplo n.º 12
0
        public void TaskPageParserFillsInTripletCount()
        {
            var html = "Spike count:    3 \n";
            html += "Triplet count:    4 \n";

            var result = new TaskPageParser().ParsePage(html);
            Assert.That(result.TripletCount, Is.EqualTo(4));
        }
Exemplo n.º 13
0
        public void TaskPageParserFillsInTaskNumber()
        {
            var html = "<table width=100% class=noborder cellpadding=10 cellspacing=0> \n";
            html += "<title>Task 2454236316</title> \n";
            html += "<tr> \n";

            var result = new TaskPageParser ().ParsePage (html);
            Assert.That(result.Number, Is.EqualTo("2454236316"));
        }
Exemplo n.º 14
0
        public void TaskPageParserFillsInTaskName()
        {
            var html = "<tr> \n";
            html += @"<table class=bordered width=""100%""><tr><td width=""40%"" class=fieldname>Name</td><td class=fieldvalue>01jl10ac.14402.294234.5.10.235_0</td></tr>";

            var result = new TaskPageParser ().ParsePage (html);
            Assert.That (result.Name, Is.EqualTo ("01jl10ac.14402.294234.5.10.235_0"));
        }