public void CreateBattle(IBattleAttribute battle, ISenseiAttribute sensei) { if (!HasBattle(battle)) { IBattleOutcome battleOutcome = Factory.Get <IBattleOutcome>(); battleOutcome.Battle = battle; battleOutcome.Sensei = sensei; battles.Add(battleOutcome); } }
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); } }
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); }; }
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); } }; }
public void Add(IPlayerBattleResult result, ISenseiAttribute sensei) { Results.Add(result); Sensei = sensei; }