public void It_Saves_The_Played_Game() { //--arrange var newlyCompletedPlayedGame = CreateValidNewlyCompletedGame(); //--act _autoMocker.ClassUnderTest.Execute(newlyCompletedPlayedGame, _currentUser, _dataContext); //--assert _dataContext.AssertWasCalled(mock => mock.Save(Arg <PlayedGame> .Is.Same(_expectedPlayedGame), Arg <ApplicationUser> .Is.Same(_currentUser))); }
public void It_Saves_A_Gaming_Group_Invitation() { _playerInviter.InvitePlayer(_playerInvitation, _currentUser); _dataContextMock.AssertWasCalled(mock => mock.Save <GamingGroupInvitation>(Arg <GamingGroupInvitation> .Matches( invite => invite.PlayerId == _playerInvitation.InvitedPlayerId && invite.DateSent.Date == DateTime.UtcNow.Date && invite.GamingGroupId == _currentUser.CurrentGamingGroupId && invite.InviteeEmail == _playerInvitation.InvitedPlayerEmail && invite.InvitingUserId == _currentUser.Id), Arg <ApplicationUser> .Is.Same(_currentUser))); }
public void ItUpdatesTheUsersGamingGroup() { contextSwitcher.SwitchGamingGroupContext(gamingGroupIdUserCanSee, currentUser); dataContextMock.AssertWasCalled(mock => mock.Save( Arg <ApplicationUser> .Matches(user => user.CurrentGamingGroupId == gamingGroupIdUserCanSee && user.Id == currentUser.Id), Arg <ApplicationUser> .Is.Same(currentUser))); }
public void It_Sets_The_Registered_User_Id_On_The_Gaming_Group_Invitation_If_The_User_Already_Has_An_Existing_Account() { _playerInviter.InvitePlayer(_playerInvitation, _currentUser); _dataContextMock.AssertWasCalled(mock => mock.Save <GamingGroupInvitation>(Arg <GamingGroupInvitation> .Matches( invite => invite.RegisteredUserId == _existingUserId), Arg <ApplicationUser> .Is.Anything)); }
public void ItClearsTheNemesisIfTheNewNemesisIsNullAndOneAlreadyExisted() { _playerRepositoryMock.Expect(mock => mock.GetNemesisData(_playerId)) .Return(new NullNemesisData()); _nemesisRecalculator.RecalculateNemesis(_playerId, _currentUser); _dataContextMock.AssertWasCalled(mock => mock.Save <Player>( Arg <Player> .Matches(player => player.NemesisId == null), Arg <ApplicationUser> .Is.Equal(_currentUser))); }
public void ItRemovesTheChampionIfTheNewChampionIsNullAndOneAlreadyExisted() { championRepositoryMock.Expect(mock => mock.GetChampionData(gameDefinitionId)) .Return(new NullChampionData()); championRecalculator.RecalculateChampion(gameDefinitionId, applicationUser); dataContextMock.AssertWasCalled(mock => mock.Save( Arg <GameDefinition> .Matches(gameDefinition => gameDefinition.ChampionId == null), Arg <ApplicationUser> .Is.Equal(applicationUser))); }
public void ItSavesANewGameDefinitionOnTheSpecifiedGamingGroup() { var createGameDefinitionRequest = new CreateGameDefinitionRequest { Name = "game definition name", GamingGroupId = _currentUser.CurrentGamingGroupId - 1 }; _dataContextMock.Expect(mock => mock.GetQueryable <GameDefinition>()).Return(new List <GameDefinition>().AsQueryable()); _autoMocker.Get <IBoardGameGeekGameDefinitionCreator>().Expect( mock => mock.CreateBoardGameGeekGameDefinition(Arg <int> .Is.Anything)) .Return(null); _autoMocker.ClassUnderTest.Execute(createGameDefinitionRequest, _currentUser, _dataContextMock); _dataContextMock.AssertWasCalled(mock => mock.Save( Arg <GameDefinition> .Matches(x => x.GamingGroupId == createGameDefinitionRequest.GamingGroupId), Arg <ApplicationUser> .Is.Anything)); }
public void ItDeletesTheSpecifiedPlayedGame() { _playedGameDeleter.DeletePlayedGame(_playedGameId, _currentUser); _dataContextMock.AssertWasCalled(mock => mock.DeleteById <PlayedGame>(_playedGameId, _currentUser)); }