Inheritance: DriverMessageBase
コード例 #1
0
 public void Visit(SetDriverLapTimeMessage message)
 {
     Result = true;
 }
コード例 #2
0
 /// <inheritdoc/>
 public virtual void Visit(SetDriverLapTimeMessage message)
 {
 }
コード例 #3
0
 void IMessageVisitor.Visit(SetDriverLapTimeMessage message)
 {
     Dispatch(message);
 }
コード例 #4
0
 /// <inheritdoc/>
 public override void Visit(SetDriverLapTimeMessage message)
 {
     if(IsForMyDriver(message))
     {
         Model.LapTimes.Laps.Add(message.LapTime);
     }
 }
コード例 #5
0
        public void when_a_driver_is_on_the_track_white_lap_time_column_colours_are_translated_into_set_lap_time_messages(SessionType session)
        {
            In(session).OnLap(5).Assert(translator =>
            {
                var driver = translator.GetDriver(1);
                var expected = new SetDriverLapTimeMessage(1, PT(95.571, PostedTimeType.Normal, 5));

                driver.LapNumber = 5;
                driver.ChangeStatus(DriverStatus.OnTrack);
                driver.SetColumnHasValue(GridColumn.LapTime, true);
                driver.LastLapTime = PT(95.571, PostedTimeType.Normal, 5);
                Assert.MessagesAreEqual(expected,
                    translator.Translate(new SetGridColumnColourMessage(1, GridColumn.LapTime, GridColumnColour.White))
                );
                Assert.Equal(expected.LapTime, driver.LastLapTime);
            });
        }
コード例 #6
0
        public void when_a_driver_is_on_the_track_lap_time_column_values_are_translated_into_set_lap_time_messages(SessionType session)
        {
            In(session).OnLap(5).Assert(translator =>
            {
                SetDriverLapTimeMessage expected;
                LiveDriver driver = translator.GetDriver(1);

                driver.LapNumber = 5;
                driver.ChangeStatus(DriverStatus.OnTrack);
                // Normal lap time.
                expected = new SetDriverLapTimeMessage(1, PT(95.571, PostedTimeType.Normal, 5));
                Assert.MessagesAreEqual(expected,
                    translator.Translate(new SetGridColumnValueMessage(1, GridColumn.LapTime, GridColumnColour.White, "1:35.571"))
                );
                Assert.Equal(expected.LapTime, driver.LastLapTime);
                // Personal best lap time.
                expected = new SetDriverLapTimeMessage(1, PT(95.571, PostedTimeType.PersonalBest, 5));
                Assert.MessagesAreEqual(expected,
                    translator.Translate(new SetGridColumnValueMessage(1, GridColumn.LapTime, GridColumnColour.Green, "1:35.571"))
                );
                Assert.Equal(expected.LapTime, driver.LastLapTime);
                // Session best lap time.
                expected = new SetDriverLapTimeMessage(1, PT(95.571, PostedTimeType.SessionBest, 5));
                Assert.MessagesAreEqual(expected,
                    translator.Translate(new SetGridColumnValueMessage(1, GridColumn.LapTime, GridColumnColour.Magenta, "1:35.571"))
                );
                Assert.Equal(expected.LapTime, driver.LastLapTime);
            });
        }
コード例 #7
0
 /// <inheritdoc/>
 public override void Visit(SetDriverLapTimeMessage message)
 {
     GetDriver(message).LastLapTime = message.LapTime;
 }