public void ItReturnsTheCurrentUsersPlayerQuickStatsViewModel() { var expectedPlayerQuickSummary = new PlayerQuickStats { PlayerId = 1, TotalGamesPlayed = 4, TotalGamesWon = 3, NemePointsSummary = new NemePointsSummary(1, 3, 5), LastGamingGroupGame = new PlayedGameQuickStats { BoardGameGeekUri = new Uri("http://a.com"), DatePlayed = new DateTime(), GameDefinitionId = 10, GameDefinitionName = "some game definition name", PlayedGameId = 12, ThumbnailImageUrl = "some url", WinnerType = WinnerTypes.PlayerWin, WinningPlayerId = 13, WinningPlayerName = "some winning player name" } }; autoMocker.Get<IPlayerRetriever>() .Expect(mock => mock.GetPlayerQuickStatsForUser(currentUser.Id, currentUser.CurrentGamingGroupId)) .Return(expectedPlayerQuickSummary); var result = autoMocker.ClassUnderTest.CurrentPlayerQuickStats(currentUser) as ViewResult; Assert.That(result, Is.Not.Null); var actualModel = result.Model as PlayerQuickStatsViewModel; Assert.That(actualModel, Is.Not.Null); Assert.That(actualModel.PlayerId, Is.EqualTo(expectedPlayerQuickSummary.PlayerId)); var expectedNemePointsSummary = new NemePointsSummaryViewModel( expectedPlayerQuickSummary.NemePointsSummary.BaseNemePoints, expectedPlayerQuickSummary.NemePointsSummary.GameDurationBonusNemePoints, expectedPlayerQuickSummary.NemePointsSummary.WeightBonusNemePoints); Assert.That(actualModel.NemePointsSummary, Is.EqualTo(expectedNemePointsSummary)); Assert.That(actualModel.TotalGamesWon, Is.EqualTo(expectedPlayerQuickSummary.TotalGamesWon)); Assert.That(actualModel.TotalGamesPlayed, Is.EqualTo(expectedPlayerQuickSummary.TotalGamesPlayed)); Assert.That(actualModel.LastGamingGroupGame, Is.Not.Null); var lastGamingGroupGameViewModel = actualModel.LastGamingGroupGame; var playedGameQuickStats = expectedPlayerQuickSummary.LastGamingGroupGame; Assert.That(lastGamingGroupGameViewModel.BoardGameGeekUri, Is.EqualTo(playedGameQuickStats.BoardGameGeekUri)); Assert.That(lastGamingGroupGameViewModel.DatePlayed, Is.EqualTo(playedGameQuickStats.DatePlayed)); Assert.That(lastGamingGroupGameViewModel.GameDefinitionName, Is.EqualTo(playedGameQuickStats.GameDefinitionName)); Assert.That(lastGamingGroupGameViewModel.PlayedGameId, Is.EqualTo(playedGameQuickStats.PlayedGameId)); Assert.That(lastGamingGroupGameViewModel.ThumbnailImageUrl, Is.EqualTo(playedGameQuickStats.ThumbnailImageUrl)); Assert.That(lastGamingGroupGameViewModel.WinnerType, Is.EqualTo(playedGameQuickStats.WinnerType)); Assert.That(lastGamingGroupGameViewModel.WinningPlayerId, Is.EqualTo(playedGameQuickStats.WinningPlayerId)); Assert.That(lastGamingGroupGameViewModel.WinningPlayerName, Is.EqualTo(playedGameQuickStats.WinningPlayerName)); }
protected bool Equals(NemePointsSummaryViewModel other) { return BaseNemePoints == other.BaseNemePoints && WeightBonusNemePoints == other.WeightBonusNemePoints && GameDurationBonusNemePoints == other.GameDurationBonusNemePoints; }
protected bool Equals(NemePointsSummaryViewModel other) { return(BaseNemePoints == other.BaseNemePoints && WeightBonusNemePoints == other.WeightBonusNemePoints && GameDurationBonusNemePoints == other.GameDurationBonusNemePoints); }
public void ItCopiesTheNemePointsSummary() { var expected = new NemePointsSummaryViewModel(playerDetails.PlayerStats.NemePointsSummary); Assert.AreEqual(expected, playerDetailsViewModel.NemePointsSummary); }
public void ItCopiesTheNemePointsSummary() { PlayerWithNemesisViewModel actualViewModel = builder.Build(playerWithNemesis, currentUser); var expected = new NemePointsSummaryViewModel(playerWithNemesis.NemePointsSummary); Assert.AreEqual(expected, actualViewModel.NemePointsSummary); }
public void ItCopiesTheTotalPoints() { var expected = new NemePointsSummaryViewModel(topPlayer.NemePointsSummary); Assert.AreEqual(expected, topPlayerViewModel.NemePointsSummary); }
public void ItReturnsTheCorrectSearchResults() { var filter = new PlayedGamesFilterViewModel { DatePlayedEnd = DateTime.Now.Date, DatePlayedStart = DateTime.Now.Date.AddDays(-1), GameDefinitionId = 1 }; var expectedSearchResults = new List<PlayedGameSearchResult> { new PlayedGameSearchResult { BoardGameGeekGameDefinitionId = 1, GameDefinitionId = 2, GameDefinitionName = "some game definition name", DatePlayed = new DateTime().Date, PlayedGameId = 3, PlayerGameResults = new List<PlayerResult> { new PlayerResult { GameRank = 1, NemeStatsPointsAwarded = 3, GameDurationBonusNemePoints = 1, GameWeightBonusNemePoints = 4, PlayerId = 4, PlayerName = "some player name", PointsScored = 5 } }, WinnerType = WinnerTypes.TeamWin } }; autoMocker.Get<IPlayedGameRetriever>().Expect(mock => mock.SearchPlayedGames( Arg<PlayedGameFilter>.Matches( x => x.GamingGroupId == currentUser.CurrentGamingGroupId && x.GameDefinitionId == filter.GameDefinitionId && x.StartDateGameLastUpdated == filter.DatePlayedStart.Value.ToString("yyyy-MM-dd") && x.EndDateGameLastUpdated == filter.DatePlayedEnd.Value.ToString("yyyy-MM-dd")))) .Return(expectedSearchResults); var actualResults = autoMocker.ClassUnderTest.Search(filter, currentUser) as ViewResult; var actualPlayedGameSearchResult = ((SearchViewModel)actualResults.Model).PlayedGames.PlayedGameDetailsViewModels[0]; var expectedPlayedGameSearchResult = expectedSearchResults[0]; Assert.That(actualPlayedGameSearchResult.DatePlayed, Is.EqualTo(expectedPlayedGameSearchResult.DatePlayed)); Assert.That(actualPlayedGameSearchResult.GameDefinitionId, Is.EqualTo(expectedPlayedGameSearchResult.GameDefinitionId)); Assert.That(actualPlayedGameSearchResult.GameDefinitionName, Is.EqualTo(expectedPlayedGameSearchResult.GameDefinitionName)); Assert.That(actualPlayedGameSearchResult.GamingGroupId, Is.EqualTo(expectedPlayedGameSearchResult.GamingGroupId)); Assert.That(actualPlayedGameSearchResult.GamingGroupName, Is.EqualTo(expectedPlayedGameSearchResult.GamingGroupName)); Assert.That(actualPlayedGameSearchResult.Notes, Is.EqualTo(expectedPlayedGameSearchResult.Notes)); Assert.That(actualPlayedGameSearchResult.WinnerType, Is.EqualTo(expectedPlayedGameSearchResult.WinnerType)); var actualPlayerResult = actualPlayedGameSearchResult.PlayerResults[0]; var expectedPlayerResult = expectedPlayedGameSearchResult.PlayerGameResults[0]; Assert.That(actualPlayerResult.DatePlayed, Is.EqualTo(expectedPlayedGameSearchResult.DatePlayed)); Assert.That(actualPlayerResult.GameDefinitionId, Is.EqualTo(expectedPlayedGameSearchResult.GameDefinitionId)); Assert.That(actualPlayerResult.GameDefinitionName, Is.EqualTo(expectedPlayedGameSearchResult.GameDefinitionName)); Assert.That(actualPlayerResult.GameRank, Is.EqualTo(expectedPlayerResult.GameRank)); var expectedNemePointsSummary = new NemePointsSummaryViewModel(expectedPlayerResult.NemeStatsPointsAwarded, expectedPlayerResult.GameDurationBonusNemePoints, expectedPlayerResult.GameWeightBonusNemePoints); Assert.That(actualPlayerResult.NemePointsSummary, Is.EqualTo(expectedNemePointsSummary)); Assert.That(actualPlayerResult.PlayedGameId, Is.EqualTo(expectedPlayedGameSearchResult.PlayedGameId)); Assert.That(actualPlayerResult.PlayerId, Is.EqualTo(expectedPlayerResult.PlayerId)); Assert.That(actualPlayerResult.PlayerName, Is.EqualTo(expectedPlayerResult.PlayerName)); Assert.That(actualPlayerResult.WinnerType, Is.EqualTo(expectedPlayedGameSearchResult.WinnerType)); }
public void ItCopiesTheNemeStatsPoints() { var expected = new NemePointsSummaryViewModel(playerGameResult.NemeStatsPointsAwarded, playerGameResult.GameDurationBonusPoints, playerGameResult.GameWeightBonusPoints); Assert.AreEqual(expected, playerGameResultDetails.NemePointsSummary); }