コード例 #1
0
        public void BasesEmptySacraficeHitTest()
        {
            HalfInningActionsDto dto = new HalfInningActionsDto();

            var actions = Service.FillSacraficeHitActions(dto);

            Assert.IsFalse(actions.IsRunnerOnFirst);
            Assert.IsFalse(actions.IsRunnerOnSecond);
            Assert.IsFalse(actions.IsRunnerOnThird);
            Assert.IsTrue(actions.TotalRuns == 0);
            Assert.IsTrue(actions.TotalOuts == 1);
        }
コード例 #2
0
        public IHalfInningActions GetHalfInningActions(List <IGameInningTeamBatter> gameInningTeamBatters)
        {
            IHalfInningActions dto = new HalfInningActionsDto();

            foreach (var batter in gameInningTeamBatters.OrderBy(x => x.Sequence))
            {
                switch ((EventType)batter.EventType)
                {
                case EventType.Single:
                    dto = Single.FillSingleActions(dto);
                    break;

                case EventType.Double:
                    dto = Double.FillDoubleActions(dto);
                    break;

                case EventType.Triple:
                    dto = Triple.FillTripleActions(dto);
                    break;

                case EventType.HomeRun:
                    dto = HomeRun.FillHomeRunActions(dto);
                    break;

                case EventType.Out:
                    dto = Out.FillOutActions(dto);
                    break;

                case EventType.DoublePlay:
                    dto = DoublePlay.FillDoublePlayActions(dto);
                    break;

                case EventType.SacraficeHit:
                    dto = SacraficeHit.FillSacraficeHitActions(dto);
                    break;

                case EventType.TwoBaseSingle:
                    dto = TwoBaseSingle.FillTwoBaseSingleActions(dto);
                    break;
                }
            }

            return(dto);
        }