示例#1
0
 public void CreateBattle(IBattleAttribute battle, ISenseiAttribute sensei)
 {
     if (!HasBattle(battle))
     {
         IBattleOutcome battleOutcome = Factory.Get <IBattleOutcome>();
         battleOutcome.Battle = battle;
         battleOutcome.Sensei = sensei;
         battles.Add(battleOutcome);
     }
 }
示例#2
0
 private void AssignSenseisToBattles()
 {
     // Load up all of the battles, assign their sensei, and send to the repository
     Type[] types = reflectionUtility.LoadTypesWithAttribute <BattleAttribute>("SamuraiDojo");
     foreach (Type type in types)
     {
         IBattleAttribute battle = attributeUtility.GetAttribute <BattleAttribute>(type);
         ISenseiAttribute sensei = attributeUtility.GetAttribute <SenseiAttribute>(type);
         battleRepository.CreateBattle(battle, sensei);
     }
 }
示例#3
0
        private void SetPreTestAction(ITestRunner testRunner)
        {
            testRunner.PreTest = (context) =>
            {
                ISenseiAttribute sensei = attributeUtility.GetAttribute <SenseiAttribute>(context.ClassUnderTest);
                IBattleAttribute battle = attributeUtility.GetAttribute <BattleAttribute>(context.ClassUnderTest);
                battle.Sensei = sensei;
                playerRepository.CreatePlayer(sensei.Name);

                battleRepository.CreateBattle(battle, sensei);
            };
        }
示例#4
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);
                }
            };
        }
示例#5
0
 public void Add(IPlayerBattleResult result, ISenseiAttribute sensei)
 {
     Results.Add(result);
     Sensei = sensei;
 }