public void Given_RealGameTest()
        {
            uint eventFiredCount = 0;

            var challengeResultSender = new ChallengeResultSender();

            challengeResultSender.ChallengeResultEvent += result =>
            {
                eventFiredCount++;
            };

            challengeResultSender.CheckProjectCarsStateData(new TestStateData(lastLapTime: -1f, lapInvalidated: false));
            challengeResultSender.CheckProjectCarsStateData(new TestStateData(lastLapTime: 42f, lapInvalidated: false));  //should fire an event

            challengeResultSender.CheckProjectCarsStateData(new TestStateData(lastLapTime: 40f, lapInvalidated: false));  //should fire an event
            challengeResultSender.CheckProjectCarsStateData(new TestStateData(lastLapTime: 40f, lapInvalidated: true));

            challengeResultSender.CheckProjectCarsStateData(new TestStateData(lastLapTime: 47f, lapInvalidated: false));
            challengeResultSender.CheckProjectCarsStateData(new TestStateData(lastLapTime: 47f, lapInvalidated: true));

            challengeResultSender.CheckProjectCarsStateData(new TestStateData(lastLapTime: 39f, lapInvalidated: false));
            challengeResultSender.CheckProjectCarsStateData(new TestStateData(lastLapTime: 39f, lapInvalidated: true));

            challengeResultSender.CheckProjectCarsStateData(new TestStateData(lastLapTime: 45f, lapInvalidated: true));

            challengeResultSender.CheckProjectCarsStateData(new TestStateData(lastLapTime: 43f, lapInvalidated: false));

            Assert.That(eventFiredCount, Is.EqualTo(2));
        }
        public void Given_WarmupLap_Then_InvalidLap_IsEventMissing()
        {
            uint eventFiredCount = 0;

            var challengeResultSender = new ChallengeResultSender();

            challengeResultSender.ChallengeResultEvent += result =>
            {
                eventFiredCount++;
            };

            challengeResultSender.CheckProjectCarsStateData(new TestStateData(lastLapTime: -1f, lapInvalidated: false)); //warmup lap
            challengeResultSender.CheckProjectCarsStateData(new TestStateData(lastLapTime: 42f, lapInvalidated: true));  //should not fire an event

            Assert.That(eventFiredCount, Is.EqualTo(0));
        }
Exemple #3
0
 public void SetUp()
 {
     _challengeResultSender = new ChallengeResultSender();
 }