/// <summary> /// Initialises a new instance of the <see cref="FastestTimeModel"/> class. /// </summary> /// <param name="driver">The driver which posted the time. Can be <see langword="null"/>.</param> /// <param name="time">The time.</param> /// <param name="lapNumber">The lap number on which the time was set.</param> /// <param name="delta">The delta from the previous fastest time.</param> public FastestTimeModel(DriverModel driver, TimeSpan time, int lapNumber, TimeSpan? delta) { Time = time; Delta = delta; Driver = driver; LapNumber = lapNumber; }
/// <summary> /// Initialises a new instance of the <see cref="SpeedCaptureModel"/> class. /// </summary> /// <param name="driver">The driver which posted the speed.</param> /// <param name="location">The capture location.</param> /// <param name="speed">The captured speed.</param> /// <exception cref="System.ArgumentNullException"> /// Thrown when <paramref name="driver"/> is <see langword="null"/>. /// </exception> public SpeedCaptureModel(DriverModel driver, SpeedCaptureLocation location, int speed) { Guard.NotNull(driver, "driver"); Driver = driver; Location = location; Speed = speed; }
public void can_create() { var driver = new DriverModel(1); var location = SpeedCaptureLocation.S2; int speed = 307; var model = new SpeedCaptureModel(driver, location, speed); Assert.Same(driver, model.Driver); Assert.Equal(location, model.Location); Assert.Equal(speed, speed); }
public static void Empty(this Assertions assert, DriverModel model) { assert.Equal(0, model.CarNumber); assert.Null(model.Gap); assert.Null(model.Interval); assert.Equal(0, model.LapsCompleted); assert.Empty(model.LapTimes); assert.Null(model.Name); assert.Empty(model.PitTimes); assert.Equal(0, model.Position); assert.Empty(model.QuallyTimes); assert.Equal(DriverStatus.InPits, model.Status); }
public void can_create() { var driver = new DriverModel(1); 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); }
/// <inheritdoc/> public DriverModel GetDriver(int id) { Guard.InRange(id > 0, "id"); DriverModel driver; if(!DriversById.TryGetValue(id, out driver)) { driver = new DriverModel(id); DriversById.Add(id, driver); InnerDrivers.Add(driver); } return driver; }
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); }
/// <summary> /// Initialises a new instance of the <see cref="DriverModelBuilder"/> class and specifies /// the <paramref name="model"/> to build. /// </summary> /// <param name="model">The model to build.</param> /// <exception cref="System.ArgumentNullException"> /// Thrown when <paramref name="model"/> is <see langword="null"/>. /// </exception> public DriverModelBuilder(DriverModel model) { Guard.NotNull(model, "model"); Model = model; }