示例#1
0
        public void Lone_sub_in_gives_proper_play()
        {
            var bundle = new List <PlayDTO> {
                P1SubbedIn
            };
            var P1SubIn = new Substitution(Guid.NewGuid(), DateTime.Now, false, playerIds[1], gameId, false);

            result = playParser.ReadPlaysBundle(bundle, gameId).ToList();
            try
            {
                Assert.True(Plays.AreEqual((Substitution)result.Last(), P1SubIn));
            }
            catch (Exception) { }
        }
示例#2
0
        public void Lone_turnover_gives_proper_play()
        {
            var bundle = new List <PlayDTO> {
                P0LostTheBall
            };
            var P0Turnover = new Steal(Guid.NewGuid(), DateTime.Now, false, playerIds[0], gameId);

            result = playParser.ReadPlaysBundle(bundle, gameId).ToList();
            try
            {
                Assert.True(Plays.AreEqual((Turnover)result.Last(), P0Turnover));
            }
            catch (Exception) { }
        }
示例#3
0
        public void Lone_steal_gives_proper_play()
        {
            var bundle = new List <PlayDTO> {
                P2StoleTheBall
            };
            var P2Steal = new Steal(Guid.NewGuid(), DateTime.Now, true, playerIds[2], gameId);

            result = playParser.ReadPlaysBundle(bundle, gameId).ToList();
            try
            {
                Assert.True(Plays.AreEqual((Steal)result.Last(), P2Steal));
            }
            catch (Exception) { }
        }
示例#4
0
        public void Turnover_and_steal_give_proper_plays()
        {
            var bundle = new List <PlayDTO> {
                P0LostTheBall, P2StoleTheBall
            };
            var P2Steal    = new Steal(Guid.NewGuid(), DateTime.Now, true, playerIds[2], gameId);
            var P0Turnover = new Turnover(Guid.NewGuid(), DateTime.Now, false, playerIds[0], gameId);

            try
            {
                Assert.Multiple(() =>
                {
                    Assert.True(Plays.AreEqual((Steal)result.First(), P2Steal));
                    Assert.True(Plays.AreEqual((Turnover)result.Last(), P0Turnover));
                });
            }
            catch (Exception) { }
        }
示例#5
0
        public void Two_substitutions_give_proper_plays()
        {
            var bundle = new List <PlayDTO> {
                P1SubbedIn, P0SubbedOut
            };
            var P0SubOut = new Substitution(Guid.NewGuid(), DateTime.Now, false, playerIds[0], gameId, true);
            var P1SubIn  = new Substitution(Guid.NewGuid(), DateTime.Now, false, playerIds[1], gameId, false);

            result = playParser.ReadPlaysBundle(bundle, gameId).ToList();
            try
            {
                Assert.Multiple(() =>
                {
                    Assert.True(Plays.AreEqual((Substitution)result.First(), P1SubIn));
                    Assert.True(Plays.AreEqual((Substitution)result.Last(), P0SubOut));
                });
            }
            catch (Exception) { }
        }
示例#6
0
        public void _2_point_field_goal_missed_with_defensive_rebound_gives_proper_plays()
        {
            var bundle = new List <PlayDTO> {
                P0Misses2pFG, P2Rebounds_DiffTeam
            };
            var P0_2pFGMissed = new FieldGoal(Guid.NewGuid(), DateTime.Now, false, playerIds[0], gameId, 2, false, false, false);
            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((Rebound)result.Last(), P2Rebound));
                    Assert.True(((Rebound)result.Last()).FieldGoalReboundedId == result.First().Id);
                });
            }
            catch (Exception) { }
        }
示例#7
0
        public void _2_point_field_goal_with_assist_gives_proper_plays()
        {
            var bundle = new List <PlayDTO> {
                P0Makes2pFG, P1Assists
            };
            var P0_2pMade = new FieldGoal(Guid.NewGuid(), DateTime.Now, false, playerIds[0], gameId, 2, true, false, true);
            var P1Assist  = new Assist(Guid.NewGuid(), DateTime.Now, false, playerIds[1], gameId, P0_2pMade);

            result = playParser.ReadPlaysBundle(bundle, gameId).ToList();
            try
            {
                Assert.Multiple(() =>
                {
                    Assert.IsTrue(Plays.AreEqual((FieldGoal)result.First(), P0_2pMade));
                    Assert.IsTrue(Plays.AreEqual((Assist)result.Last(), P1Assist));
                    Assert.True(((Assist)result.Last()).FieldGoalId == result.First().Id);
                });
            }
            catch (Exception) { }
        }