示例#1
0
        private void SetPassedTestAction(ITestRunner testRunner)
        {
            testRunner.OnTestPass = (context) =>
            {
                IBattleAttribute battle = attributeUtility.GetAttribute <BattleAttribute>(context.ClassUnderTest);
                ISenseiAttribute sensei = attributeUtility.GetAttribute <SenseiAttribute>(context.ClassUnderTest);

                if (!sensei.Name.EqualsIgnoreCase(context.WrittenBy.Name))
                {
                    int points = 1;
                    playerRepository.AddPointToHistoricalTotal(context.WrittenBy.Name, context.ClassUnderTest, points);
                    battleRepository.GrantPointsToPlayer(battle, context.WrittenBy, points);
                }
            };
        }
示例#2
0
        private void ProcessAwards(Type battleType, List <IBonusPointsAttribute> awards)
        {
            IWrittenByAttribute player = attributeUtility.GetAttribute <WrittenByAttribute>(battleType);
            IBattleAttribute    battle = attributeUtility.GetAttribute <BattleAttribute>(battleType);

            int bonusPoints = 0;

            foreach (IBonusPointsAttribute award in awards)
            {
                bonusPoints += award.Points;
                battleRepository.AssignAwardToPlayer(player, battle, award);
            }

            playerRepository.AddPointToHistoricalTotal(player.Name, battle.Type, bonusPoints);
            battleRepository.GrantPointsToPlayer(battle, player, bonusPoints);
        }