public void ShouldReturnListOfResultsForParticularHunt()
        {
            List<huntparticipant> huntParticipants = new List<huntparticipant>();

            user newUser = new user();
            newUser.UserId = 1;
            newUser.Name = "Fake User";

            huntparticipant participant = new huntparticipant();
            participant.HuntId = 1;
            participant.UserId = 1;
            participant.HuntParticipantId = 1;
            participant.ElapsedTime = 1;
            participant.Tally = 1;

            huntParticipants.Add(participant);

            serviceClient.Setup(s => s.GetHuntParticipants(myFakeHunt)).Returns(huntParticipants.ToArray());
            serviceClient.Setup(s => s.GetParticipantName(newUser.UserId)).Returns(newUser);

            viewModel.RefreshLeaderboard();

            serviceClient.Verify(s => s.GetHuntParticipants(myFakeHunt), Times.Exactly(1));
            serviceClient.Verify(s => s.GetParticipantName(newUser.UserId), Times.Exactly(1));

            Participant newParticipant = new Participant(newUser.Name, participant.Tally, participant.ElapsedTime);
            ObservableCollection<Participant> participantsList = new ObservableCollection<Participant>();
            participantsList.Add(newParticipant);

            //Values differ apparently but look the same to me. Needs checked again.
            Assert.AreEqual(participantsList, LeaderboardResults);
        #endregion
        }
        /// <summary>
        /// Method that will refresh the results of the leader board with the latest information from the database.
        /// </summary>
        public async void RefreshLeaderboard()
        {
            PopupDisplayed = true;
            
            if (connectionChecker.IsInternetConnected())
            {
                if (this.currentTreasureHunt != null)
                {
                    var results = new ObservableCollection<Participant>();

                    //Grab a list of all of the participants in this treasure hunt.
                    IEnumerable<huntparticipant> huntParticipants = this.serviceClient.GetHuntParticipantsAsync(CurrentTreasureHunt).Result.ToList();

                    if (huntParticipants != null)
                    {
                        //For each participant represented by an id in this list
                        using (var participants = huntParticipants.GetEnumerator())
                        {
                            while (participants.MoveNext())
                            {
                                //Get that participants details and add them to the list to be displayed
                                user currentUser = await this.serviceClient.GetParticipantAsync(participants.Current.UserId);
                                Participant newParticipant = new Participant(currentUser.Name, participants.Current.Tally, participants.Current.ElapsedTime);
                                results.Add(newParticipant);
                            }
                            results.OrderBy(i => i.ElapsedTime);
                            LeaderboardResults = results;
                        }
                    }
                }
            }
            else
            {
                MessageBoxResult messageBox = MessageBox.Show(connectionChecker.ShowConnectionErrorMessage());
            }
           
            PopupDisplayed = false;          
        }
        public void RefreshLeaderboard()
        {
            if (this.currentTreasureHunt != null)
            {
                var results = new ObservableCollection<Participant>();

                List<huntparticipant> huntParticipants = this.serviceClient.GetHuntParticipants(CurrentTreasureHunt).ToList();

                using (var participants = huntParticipants.GetEnumerator())
                {
                    while (participants.MoveNext())
                    {
                        user currentUser = this.serviceClient.GetParticipantName(participants.Current.UserId);
                        Participant newParticipant = new Participant(currentUser.Name, participants.Current.Tally, participants.Current.ElapsedTime );
                        results.Add(newParticipant);
                    }
                    //Learnt this from previous similar scenario in agile module
                    LeaderboardResults = results;
                }
            }
        }