Example #1
0
        public void StartedUpdate_ToString()
        {
            StartedUpdate sUpdate = new StartedUpdate
            {
                BibNumber         = 84,
                Timestamp         = new DateTime(2017, 8, 15, 14, 34, 0),
                OfficialStartTime = new DateTime(2017, 8, 15, 14, 33, 45)
            };

            Assert.AreEqual("Started,84,8/15/2017 2:34:00 PM,8/15/2017 2:33:45 PM", sUpdate.ToString());
        }
Example #2
0
        public void StartedUpdate_GetterAndSetters()
        {
            StartedUpdate sUpdate = new StartedUpdate
            {
                BibNumber         = 84,
                Timestamp         = new DateTime(2017, 8, 15, 14, 34, 0),
                OfficialStartTime = new DateTime(2017, 8, 15, 14, 33, 45)
            };

            Assert.AreEqual(AthleteRaceStatus.Started, sUpdate.UpdateType);
            Assert.AreEqual(84, sUpdate.BibNumber);
            Assert.AreEqual(new DateTime(2017, 8, 15, 14, 34, 0), sUpdate.Timestamp);
            Assert.AreEqual(new DateTime(2017, 8, 15, 14, 33, 45), sUpdate.OfficialStartTime);
        }
Example #3
0
        /// <summary>
        /// Update the values provided in updateMessage
        /// </summary>
        /// <param name="updateMessage">Contains updated values</param>
        public void updateStats(AthleteUpdate updateMessage)
        {
            status    = updateMessage.UpdateType;
            timestamp = updateMessage.Timestamp;
            switch (updateMessage.UpdateType)
            {
            case AthleteRaceStatus.Registered:
                // Do nothing
                break;

            case AthleteRaceStatus.DidNotStart:
                // Do nothing
                break;

            case AthleteRaceStatus.Started:
                StartedUpdate startUpdate = (StartedUpdate)updateMessage;
                officialStartTime = startUpdate.OfficialStartTime;
                break;

            case AthleteRaceStatus.OnCourse:
                LocationUpdate locUpdate = (LocationUpdate)updateMessage;
                locationOnCourse = locUpdate.LocationOnCourse;
                break;

            case AthleteRaceStatus.DidNotFinish:
                // Do nothing
                break;

            case AthleteRaceStatus.Finished:
                FinishedUpdate finishUpdate = (FinishedUpdate)updateMessage;
                officialEndTime = finishUpdate.OfficialEndTime;
                break;

            default:
                throw new ApplicationException("Invalid AthleteUpdate type");
            }
            notifyObservers();
        }