/// <summary> /// Creates TimePoint instance /// </summary> /// <param name="name">Name of TimePoint</param> /// <param name="time">An absolute or relative time of day</param> /// <param name="kind">A type of TimePoint</param> /// <param name="loopNumber">The loop number</param> public TimePoint(string name, TimeSpan time, TimePointKinds kind, byte loopNumber = 0) { if (_timePointNum == MaxId) { throw new OverflowException("Reached the maximum number of TimePointCollection"); } Time = time; if (kind == TimePointKinds.Absolute) { BaseTime = TimeSpan.Zero; } Id = _timePointNum++; _kind = kind; LoopNumber = loopNumber == MaxId ? (byte)(MaxId - 1) : loopNumber; Name = name; }
public TimePoint(string name, string time, TimePointKinds kind, byte loopNumber = 0) : this(name, TimeSpan.Parse(time), kind, loopNumber) { }
public void AddTimePointCommand_PositiveOrZeroAbsoluteTimePoint_CanExecute(string time, TimePointKinds timePointType) { var pvm = GetPresetViewModel(); pvm.AddingTimePoint.Time = TimeSpan.Parse(time); pvm.AddingTimePoint.TimePoint.ChangeTimePointType(timePointType); Assert.IsTrue(pvm.AddTimePointCommand.CanExecute(null)); }
public TimePoint(TimeSpan time, TimePointKinds timePointKinds, byte loopNumber = 0) : this(null, time, timePointKinds, loopNumber) { }
public void AddTimePointCommand_NegativeOrZeroRelativeTimePoint_CanNotExecute(string time, TimePointKinds timePointType) { var pvm = GetPresetViewModel(); pvm.AddingTimePoint.TimePoint.ChangeTimePointType(timePointType); pvm.AddingTimePoint.Time = TimeSpan.Parse(time); Assert.IsFalse(pvm.AddTimePointCommand.CanExecute(null)); }