public void _2_point_field_goal_blocked_with_defensive_rebound_gives_proper_plays() { var bundle = new List <PlayDTO> { P0Misses2pFG, P2Blocked, P2Rebounds_DiffTeam }; var P0_2pFGMissed = new FieldGoal(Guid.NewGuid(), DateTime.Now, false, playerIds[0], gameId, 2, false, true, false); var P2Block = new Block(Guid.NewGuid(), DateTime.Now, true, playerIds[2], gameId, P0_2pFGMissed); var P2Rebound = new Rebound(Guid.NewGuid(), DateTime.Now, true, playerIds[2], gameId, false, P0_2pFGMissed); result = playParser.ReadPlaysBundle(bundle, gameId).ToList(); try { Assert.Multiple(() => { Assert.True(Plays.AreEqual((FieldGoal)result.First(), P0_2pFGMissed)); Assert.True(Plays.AreEqual((Block)result[1], P2Block)); Assert.True(((Block)result[1]).FieldGoalBlockedId == result[0].Id); Assert.True(Plays.AreEqual((Rebound)result.Last(), P2Rebound)); Assert.True(((Rebound)result[2]).FieldGoalReboundedId == result[0].Id); }); } catch (Exception) { } }
public async Task <bool> AddPlays(AddPlaysToGameViewModel playsVM) { var _game = await GetGame(playsVM.GameId); if (_game.End != null) { return(await Task.FromResult(false)); } //todo: make async var _plays = _playReader.ReadPlaysBundle(playsVM.playDTOs, playsVM.GameId); if (_plays == null) { return(await Task.FromResult(false)); } if (await _playsService.AddPlays(_plays) == false) { return(await Task.FromResult(false)); } return(await Task.FromResult(true)); }