Ejemplo n.º 1
0
        public void FormatterShouldReturnAdditionalFieldsWhenApplicationVersionIsNotAlphaVersion()
        {
            var task = new Task { ApplicationVersion = "AstroPulse some version 6" };

                    const string expectedString = ",,,,,0,0,0,AstroPulse some version 6";

            var result = new Formatter().Format(task);
            Assert.That(result, Is.EqualTo(expectedString));
        }
Ejemplo n.º 2
0
        public void TaskValidatorSetsIsValidToFalseAndSetsErrorMessageWhenTaskNumberIsMissing()
        {
            var task = new Task {Number = null, Name = "blah_unit.a"};
            const string fileName = "333333.htm";

            var taskValidator = new TaskValidator();
            taskValidator.Validate(task, fileName);
            Assert.IsFalse(taskValidator.IsValid);
            Assert.That(taskValidator.Error, Is.EqualTo(String.Format(TaskValidator.MissingTaskNumber + Environment.NewLine, fileName)));
        }
Ejemplo n.º 3
0
        private static Task CreateTaskFromHtml(IEnumerable<string> split)
        {
            var task = new Task();
            foreach (var line in split) {
                if (line.Contains(Title())) { task.Number = FindTitleValue(line); }
                if (line.Contains(Field("Name"))) { task.Name = FindStringValue(line); }
                if (line.Contains(Field("Workunit"))) { task.Workunit = FindLinkvalue(line); }
                if (line.Contains(Field("Received"))) { task.Received = FindStringValue(line); }
                if (line.Contains(Field("Outcome"))) { task.Outcome = task.Received = FindStringValue(line); }
                if (line.Contains(Field("Run time"))) { task.RunTime = FindDoubleValue(line); }
                if (line.Contains(Field("CPU time"))) { task.CpuTime = FindDoubleValue(line); }
                if (line.Contains(Field("Credit"))) { task.Credit = FindDoubleValue(line); }
                if (line.Contains(Field("Application version"))) { task.ApplicationVersion = FindStringValue(line); }

                if (line.Contains("Spike count:")) { task.SpikeCount = FindIntValue(line); }
                if (line.Contains("Pulse count:")) { task.PulseCount = FindIntValue(line); }
                if (line.Contains("Triplet count:")) { task.TripletCount = FindIntValue(line); }
                if (line.Contains("Gaussian count:")) { task.GaussianCount = FindIntValue(line); }
            }
            return task;
        }
Ejemplo n.º 4
0
        public void FormatterShouldReturnTaskPropertiesSeparatedByComma()
        {
            var task = new Task {
                            Number = "975498348",
                            Workunit = "04309583",
                            Name = "blah_somename_01",
              Received = "29 May 2012 | 14:01:08 UTC",
              Outcome = "Success",
              RunTime = 1232.12,
              CpuTime = 2345.23,
              Credit = 3333.33,
              ApplicationVersion = "some version",
                            SpikeCount = 1,
                            PulseCount = 2,
                            TripletCount = 3,
                            GaussianCount = 4
            };

                        const string expectedString = "975498348,04309583,blah_somename_01,29 May 2012 | 14:01:08 UTC,"
                            + "Success,1232.12,2345.23,3333.33,some version,1,2,3,4";

                    var result = new Formatter().Format(task);
                        Assert.That(result, Is.EqualTo(expectedString));
        }
Ejemplo n.º 5
0
 public void Validate(Task task, string fileName)
 {
     IsValid = true;
     if (task.Number == null) { MarkTaskInvalid(MissingTaskNumber, fileName); }
     if (task.Name == null) { MarkTaskInvalid(MissingTaskName, fileName);}
 }