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
        }
Example #2
0
        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.GetHuntParticipantsAsync(myFakeHunt)).Returns(Task.FromResult(huntParticipants.ToArray()));
            serviceClient.Setup(s => s.GetParticipantAsync(newUser.UserId)).Returns(Task.FromResult(newUser));

            viewModel.RefreshLeaderboard();

            serviceClient.Verify(s => s.GetHuntParticipantsAsync(myFakeHunt), Times.Exactly(1));
            serviceClient.Verify(s => s.GetParticipantAsync(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
        }