コード例 #1
0
 public void ShouldChooseBattleDetails()
 {
     var t = new Tournament();
     t.Populate();
     t.Start();
     var battleDetails = t.GetNextBattleDetails();
     Assert.IsNotNull(battleDetails);
 }
コード例 #2
0
 public void ShouldReturnNullBattleForUnmatchedGuid()
 {
     var t = new Tournament();
     t.Populate();
     t.Start();
     var guid = Guid.NewGuid();
     Assert.IsNull(t.GetBattleByGuid(guid));
 }
コード例 #3
0
 public void ShouldAssignHealthAndSkillTreeWhenStartingTournament()
 {
     var t = new Tournament();
     t.Populate();
     t.Start();
     Assert.IsTrue(t.Participants.TrueForAll(i => i.Character.Health > 0));
     Assert.IsTrue(t.Participants.Exists(i => i.Character.SkillTree.Get().ToList().Exists(s => s is PathOfTheFighter && s.IsActive)));
     Assert.IsTrue(t.Participants.Exists(i => i.Character.SkillTree.Get().ToList().Exists(s => s is PathOfTheWizard && s.IsActive)));
 }
コード例 #4
0
 public void ShouldReturnBattleByGuid()
 {
     var t = new Tournament();
     t.Populate();
     t.Start();
     var guid = t.BattlesByRound[t.Round].First().BattleGuid;
     var battle = t.GetBattleByGuid(guid);
     Assert.IsNotNull(battle);
     Assert.IsTrue(battle.BattleGuid == guid);
 }
コード例 #5
0
 public void ShouldMakeSureParticipantNamesUnique()
 {
     var t = new Tournament();
     var c = new Dumbass();
     c.SetName("Idiot");
     t.AddCharacterToTournament(c);
     var d = new Dumbass();
     d.SetName("Idiot");
     t.AddCharacterToTournament(d);
     Assert.IsTrue(t.Participants.Count == 2 && t.Participants.Count(i => i.Character.Name == "Idiot") == 1);
 }
コード例 #6
0
 public void ShouldThrowExceptionIfTournamentStartedWithoutEnoughValidParticipants()
 {
     var t = new Tournament();
     var c1 = new Dumbass();
     c1.SetName("1");
     t.Participants.Add(new Participant
     {
         Battles = 5,
         Character = c1,
         Status = ParticipantStatus.Active
     });
     var c2 = new Dumbass();
     c2.SetName("2");
     t.Participants.Add(new Participant
     {
         Battles = 1,
         Character = c2,
         Status = ParticipantStatus.KnockedOut
     });
     t.Start();
 }
コード例 #7
0
 public void ShouldPopulateTournamentWithBots()
 {
     var t = new Tournament();
     t.Populate();
     Assert.IsTrue(t.Participants.Count == 128);
 }