public static void LogErrorInvalidInputForNoOfWorkersPerShift(TaskSpecification specification) { var messageContent = messageContentProvider.GetMessageInvalidInputForNoOfWorkersPerShift( specification.Name, specification.NoWorkersPerShift); LoggedErrors.Add(new ErrorMessage(messageContent)); }
public void SimpleTaskFactoryParsingTest(TaskSpecification taskSpecs, Model.Task expectedTask) { var parser = new TaskFactory(); var actualTask = parser.MakeTask(taskSpecs); Assert.IsTrue(expectedTask.Equals(actualTask)); }
public override List<ShiftsSpecification> AsShiftsSpecification() { List<ShiftsSpecification> shiftsSpec = new List<ShiftsSpecification>(); TaskSpecification taskSpec = new TaskSpecification("Vand planter", "Messe Område", "Planterne skal vandes", "1", "n", "1.0", "OTT", "n", "y", "y"); shiftsSpec.Add(new ShiftsSpecification("05-09-2015", "%", taskSpec)); shiftsSpec.Add(new ShiftsSpecification("06-09-2015", "08:00 - 09:00,15:00 - 16:30;", taskSpec)); shiftsSpec.Add(new ShiftsSpecification("07-09-2015", "08:00 - 09:00,14:00 - 16:30;", taskSpec)); shiftsSpec.Add(new ShiftsSpecification("08-09-2015", "08:00 - 09:00,15:00 - 16:30;", taskSpec)); taskSpec.AddShiftsSpecifications(shiftsSpec); return shiftsSpec; }
public Task MakeTask(TaskSpecification specification) { int noOfGuardsPerShift; Task task = null; var noGuardsPerShiftParseSuccesful = Int32.TryParse(specification.NoWorkersPerShift, out noOfGuardsPerShift); if (!noGuardsPerShiftParseSuccesful || noOfGuardsPerShift <= 0) ErrorLogger.LogErrorInvalidInputForNoOfWorkersPerShift(specification); else { task = new Task( name: specification.Name, description: specification.Description, place: specification.Place, noOfGuardsPerShift: noOfGuardsPerShift, jointTask: true ); task.Shifts.AddRange(MakeShifts(task, specification.ShiftsSpecifications)); } return task; }