public void can_create_without_a_driver() { DriverModel driver = null; var time = TimeSpan.FromSeconds(31.1); var lapNumber = 10; var delta = TimeSpan.FromSeconds(1.1); var model = new FastestTimeModel(driver, time, lapNumber, delta); Assert.Same(driver, model.Driver); Assert.Equal(time, model.Time); Assert.Equal(lapNumber, model.LapNumber); Assert.Equal(delta, model.Delta); }
private void ComputePossible() { if(S1 == null || S2 == null || S3 == null) { Possible = null; } else { var newPossibleTime = S1.Time + S2.Time + S3.Time; // TODO this is a bit hackish. Possible = new FastestTimeModel(null, newPossibleTime, 0, Lap != null ? new TimeSpan?(Lap.Time - newPossibleTime) : null); } }
private static FastestTimeModel CreateFastestTime(DriverModel driver, TimeSpan time, int lapNumber, FastestTimeModel previous) { return new FastestTimeModel(driver, time, lapNumber, previous != null ? new TimeSpan?(time - previous.Time) : null); }