private FootnoteDisplayModel GetTestObject() { return(FootnoteDisplayModelHelpers.GetFootnoteDisplayModel()); }
private TrainSegmentModel GetTestObject(int?timings, bool?continuesEarlier, bool?continuesLater, HalfOfDay?definitelyMorning, List <ILocationEntry> additionalTimings = null) { int pageFootnoteCount = _rnd.Next(10) + 1; TrainSegmentModel tsm = new TrainSegmentModel(null) { Footnotes = _rnd.NextString(_rnd.Next(5)), Headcode = _rnd.NextString(4), IncludeSeparatorAbove = _rnd.NextBoolean(), IncludeSeparatorBelow = _rnd.NextBoolean(), InlineNote = _rnd.NextString(_rnd.Next(50)), LocoDiagram = _rnd.NextString(_rnd.Next(4)), TrainClass = _rnd.NextString(1), TrainId = _rnd.NextHexString(8), ContinuationFromEarlier = continuesEarlier ?? _rnd.NextBoolean(), ContinuesLater = continuesLater ?? _rnd.NextBoolean(), ToWorkCell = new GenericTimeModel { ActualTime = _rnd.NextTimeOfDay(), DisplayedText = _rnd.NextString(_rnd.Next(5)) }, }; for (int i = 0; i < pageFootnoteCount; ++i) { tsm.PageFootnotes.Add(FootnoteDisplayModelHelpers.GetFootnoteDisplayModel()); } int timingsCount; if (timings.HasValue) { timingsCount = timings.Value; } else { timingsCount = _rnd.Next(20) + 3; } TimeOfDay baseTime; if (definitelyMorning.HasValue) { if (definitelyMorning.Value == HalfOfDay.AM) { baseTime = _rnd.NextTimeOfDayBefore(43200); } else if (definitelyMorning.Value == HalfOfDay.PM) { baseTime = _rnd.NextTimeOfDayBetween(43200, 86400 - (timingsCount + 2)); } else { baseTime = new TimeOfDay(43200); } } else { baseTime = _rnd.NextTimeOfDayBefore(86400 - (timingsCount + 2)); } for (int i = 0; i < timingsCount; ++i) { tsm.Timings.Add(new TrainLocationTimeModel { LocationKey = i.ToString(CultureInfo.CurrentCulture), ActualTime = baseTime }); baseTime = _rnd.NextTimeOfDayBetween(baseTime, 86400 - (timingsCount - i)); } if (additionalTimings != null) { foreach (ILocationEntry timing in additionalTimings) { tsm.Timings.Add(timing); } } return(tsm); }