public override void SetUp() { base.SetUp(); expectedGamingGroup = new GamingGroup { Id = gamingGroupId, OwningUserId = CurrentUser.Id }; filter = new GamingGroupFilter { GamingGroupId = gamingGroupId }; AutoMocker.Get<IDataContext>().Expect(mock => mock.FindById<GamingGroup>(gamingGroupId)) .Return(expectedGamingGroup); gameDefinitionSummaries = new List<GameDefinitionSummary> { new GameDefinitionSummary() }; AutoMocker.Get<IGameDefinitionRetriever>().Expect(mock => mock.GetAllGameDefinitions(gamingGroupId, filter.DateRangeFilter)) .Return(gameDefinitionSummaries); List<ApplicationUser> applicationUsers = new List<ApplicationUser>(); applicationUsers.Add(CurrentUser); AutoMocker.Get<IDataContext>().Expect(mock => mock.GetQueryable<ApplicationUser>()) .Return(applicationUsers.AsQueryable()); AutoMocker.Get<IDataContext>().Expect(mock => mock.GetQueryable<ApplicationUser>()) .Return(applicationUsers.AsQueryable()); }
public GamingGroupSummary GetGamingGroupDetails(GamingGroupFilter filter) { var gamingGroup = dataContext.FindById<GamingGroup>(filter.GamingGroupId); var summary = new GamingGroupSummary { Id = gamingGroup.Id, DateCreated = gamingGroup.DateCreated, Name = gamingGroup.Name, OwningUserId = gamingGroup.OwningUserId, PublicDescription = gamingGroup.PublicDescription, PublicGamingGroupWebsite = gamingGroup.PublicGamingGroupWebsite }; summary.PlayedGames = playedGameRetriever.GetRecentGames(filter.NumberOfRecentGamesToShow, filter.GamingGroupId, filter.DateRangeFilter); summary.Players = playerRetriever.GetAllPlayersWithNemesisInfo(filter.GamingGroupId, filter.DateRangeFilter); summary.GameDefinitionSummaries = gameDefinitionRetriever.GetAllGameDefinitions(filter.GamingGroupId, filter.DateRangeFilter); summary.OwningUser = dataContext.GetQueryable<ApplicationUser>().First(user => user.Id == gamingGroup.OwningUserId); return summary; }
internal virtual GamingGroupSummary GetGamingGroupSummary(int gamingGroupId, IDateRangeFilter dateRangeFilter = null) { if (dateRangeFilter == null) { dateRangeFilter = new BasicDateRangeFilter(); } else { dateRangeFilter.FromDate = dateRangeFilter.FromDate; dateRangeFilter.ToDate = dateRangeFilter.ToDate; } var filter = new GamingGroupFilter(dateRangeFilter) { NumberOfRecentGamesToShow = MAX_NUMBER_OF_RECENT_GAMES, GamingGroupId = gamingGroupId }; return gamingGroupRetriever.GetGamingGroupDetails(filter); }