private DateTime FindActualStartTime(TimeScope timeScope) { if (timeScope.TimeStamp1 == null) return DateTime.MinValue; return timeScope.TimeStamp1.GetValueOrDefault(); }
private static void AreEqual(TimeScope timeScope, TIM tim) { Assert.AreEqual(timeScope.TimeStamp1, tim.A); Assert.AreEqual(timeScope.TimeStamp2, tim.B); // todo. check other attributes and PTN, dlvs,.... }
private TIM Map(TimeScope timeScope) { var endTime = FindActualEndTime(timeScope); return new TIM { A = FindActualStartTime(timeScope), B = endTime, BSpecified = endTime != DateTime.MinValue, D = TIMD.Item4 }; }
private TimeScope Map(TIM tim, Catalog catalog) { DateTime? stamp1 = null; if (tim.A.HasValue) stamp1 = tim.A.Value; DateTime? stamp2 = null; if (tim.B.HasValue) stamp2 = tim.B.Value; var timeScope = new TimeScope {TimeStamp1 = stamp1, TimeStamp2 = stamp2, DateContext = DateContextEnum.ActualStart}; if(catalog.TimeScopes == null) catalog.TimeScopes = new List<TimeScope>(); catalog.TimeScopes.Add(timeScope); return timeScope; }
public void Setup() { _timeScope = new TimeScope(); _timeScopes = new List<TimeScope>{ _timeScope }; _timeMapper = new TimeMapper(); }
public void GivenLoggedDataWithTimescopesWhenMapThenTimItemsAreMapped() { var timescope = new TimeScope(); _loggedData.TimeScopes = new List<TimeScope>{ timescope }; _catalog.TimeScopes = new List<TimeScope>{ timescope }; var tims = new List<TIM>{ new TIM(), new TIM()}; _timeMapperMock.Setup(x => x.Map(new List<TimeScope> {timescope})).Returns(tims); var result = MapSingle(); Assert.Contains(tims[0], result.Items); Assert.Contains(tims[1], result.Items); }