當前位置: 首頁>>代碼示例>>C#>>正文


C# TestContext.SetPlayerHand方法代碼示例

本文整理匯總了C#中NUnit.Framework.TestContext.SetPlayerHand方法的典型用法代碼示例。如果您正苦於以下問題:C# TestContext.SetPlayerHand方法的具體用法?C# TestContext.SetPlayerHand怎麽用?C# TestContext.SetPlayerHand使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在NUnit.Framework.TestContext的用法示例。


在下文中一共展示了TestContext.SetPlayerHand方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: When_laird_is_defeated_then_all_kobolds_in_hall_are_defeated

        public void When_laird_is_defeated_then_all_kobolds_in_hall_are_defeated()
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            var laird = context.CreateCard<KoboldHumanoid>("Drakeclan Laird");
            var ambusher = context.CreateCard<KoboldHumanoid>("Drakeclan Ambusher");
            var cutter = context.CreateCard<KoboldHumanoid>("Drakeclan Cutter");
            var shaman = context.CreateCard<KoboldHumanoid>("Drakeclan Shaman");
            var kobolds = new[] {laird, ambusher, cutter, shaman};
            context.SetTopOfDungeonDeck(kobolds);
            context.AdvanceMonsterToFirstRank(laird);
            var hand = Enumerable.Range(0, 6).Select(x => context.CreateCard<Criochan>("Criochan Captain")).ToArray();
            context.SetPlayerHand(hand);
            var startingXp = player.Xp;
            var startingVp = player.Vp;

            // Act
            context.WhenBattling(laird);
            player.DetermineBattleResult();

            // Assert
            kobolds.Each(x => Assert.That(player.Discard.Contains(x), "Discard does not contain {0}".Template(x.Name)));
            context.Game.Dungeon.Ranks.Each(r=> Assert.That(r.Card, Is.Not.Null, "Rank {0} is empty".Template(r.Number)));
            kobolds.Each(x => Assert.That(context.Game.Dungeon.Ranks.All(rank => rank.Card != x)));
            Assert.That(player.Xp, Is.EqualTo(startingXp + laird.Xp));
            Assert.That(player.Vp, Is.EqualTo(startingVp + kobolds.Sum(x => x.Vp)));
        }
開發者ID:Slugburn,項目名稱:Thunderstone,代碼行數:28,代碼來源:KoboldHumanoidTest.cs

示例2: The_flail_has_no_potential_attack_if_no_heroes_in_hand

        public void The_flail_has_no_potential_attack_if_no_heroes_in_hand()
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            var flail = context.CreateCard<SnakeheadFlail>();
            context.SetPlayerHand(flail);

            // Act
            var potential = flail.PotentialPhysicalAttack;

            // Assert
            Assert.That(potential, Is.Null);
        }
開發者ID:Slugburn,項目名稱:Thunderstone,代碼行數:14,代碼來源:SnakeheadFlailTest.cs

示例3: Must_be_at_least_2_other_cards_to_use_ability

        public void Must_be_at_least_2_other_cards_to_use_ability()
        {
            // Arrange
            var context = new TestContext();
            var curse = context.CreateCard<CurseOfDiscord>();
            var regular = context.CreateBasicCard<Regular>();
            context.SetPlayerHand(curse, regular);

            // Act
            var usable = curse.GetAbilities().First().Condition(context.Player);

            // Assert
            Assert.That(usable, Is.False);
        }
開發者ID:Slugburn,項目名稱:Thunderstone,代碼行數:14,代碼來源:CurseOfDiscordTest.cs

示例4: Using_ability_destroys_curse

        public void Using_ability_destroys_curse()
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            var curse = context.CreateCard<CurseOfSloth>();
            context.SetPlayerHand(curse);
            context.SetPlayerState(Phase.Dungeon);

            // Act
            context.UseAbilityOf(curse);

            // Assert
            Assert.That(player.Hand, Has.No.Member(curse));
        }
開發者ID:Slugburn,項目名稱:Thunderstone,代碼行數:15,代碼來源:CurseOfSlothTest.cs

示例5: Ossuous_can_be_attacked_if_hero_of_at_least_level_1_is_present

        public void Ossuous_can_be_attacked_if_hero_of_at_least_level_1_is_present()
        {
            // Arrange
            var context = new TestContext();
            var hero = context.DrawHeroFromTopOfDeck(x => x.Level == 1);
            context.SetPlayerHand(hero);
            var ossuous = context.SetMonsterInFirstRank<UndeadSkeleton>("Ossuous");

            // Act
            Assert.That(context.Game.Dungeon.Ranks[0].Card, Is.SameAs(ossuous));
            context.Player.SelectMonster();

            // Assert
            Assert.That(context.SelectCardsIds, Has.Member(ossuous.Id), "Valid targets should contain Ossuous");
        }
開發者ID:Slugburn,項目名稱:Thunderstone,代碼行數:15,代碼來源:UndeadSkeletonTest.cs

示例6: When_curse_is_in_hand_then_cant_prepare_or_rest

        public void When_curse_is_in_hand_then_cant_prepare_or_rest()
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            var curse = context.CreateCard<CurseOfWar>();
            context.SetPlayerHand(curse);

            // Act
            player.StartTurn();

            // Assert
            var message = context.Get<StartTurnMessage>();
            Assert.That(message.AvailableActions, Is.EquivalentTo(new[]{"Village", "Dungeon"}));
        }
開發者ID:Slugburn,項目名稱:Thunderstone,代碼行數:15,代碼來源:CurseOfWarTest.cs

示例7: Using_ability_reduces_number_of_cards_drawn

        public void Using_ability_reduces_number_of_cards_drawn()
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            var curse = context.CreateCard<CurseOfShame>();
            context.SetPlayerHand(curse);
            context.SetPlayerState(Phase.Village);

            // Act
            context.UseAbilityOf(curse);
            context.Player.EndTurn();

            // Assert
            Assert.That(player.Hand.Count, Is.EqualTo(4));
        }
開發者ID:Slugburn,項目名稱:Thunderstone,代碼行數:16,代碼來源:CurseOfShameTest.cs

示例8: Using_ability_reduces_player_light_to_zero

        public void Using_ability_reduces_player_light_to_zero()
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            var curse = context.CreateCard<CurseOfHorror>();
            var torch = context.CreateBasicCard<Torch>();
            context.SetPlayerHand(curse, torch);
            context.SetPlayerState(Phase.Dungeon);

            // Act
            context.UseAbilityOf(curse);

            // Assert
            Assert.That(player.TotalLight, Is.EqualTo(0));
        }
開發者ID:Slugburn,項目名稱:Thunderstone,代碼行數:16,代碼來源:CurseOfHorrorTest.cs

示例9: A_hero_not_armed_with_a_pike_is_not_immune_to_battle_effects

        public void A_hero_not_armed_with_a_pike_is_not_immune_to_battle_effects()
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            var hero = context.CreateCard<Criochan>();
            var pike = context.CreateCard<Pike>();
            context.SetPlayerHand(hero, pike);
            var ettin = context.SetMonsterInFirstRank<OgreHumanoid>("Ettin");

            // Act
            context.WhenBattling(ettin);

            // Assert
            Assert.That(player.Hand, Has.No.Member(hero), "Ettin eats hero.");
        }
開發者ID:Slugburn,項目名稱:Thunderstone,代碼行數:16,代碼來源:PikeTest.cs

示例10: Beserker_destroys_other_hero_during_aftermath

        public void Beserker_destroys_other_hero_during_aftermath()
        {
            // Arrange
            var context = new TestContext();
            var berserker = context.CreateCard<Disowned>("Disowned Berserker");
            var otherHero = context.CreateBasicCard<Regular>();
            var weapon = context.CreateCard<Pike>();
            context.SetPlayerHand(berserker, otherHero, weapon);
            context.SetPlayerState(Phase.Aftermath);

            // Act
            context.UseAbilityOf(berserker);

            // Assert
            Assert.That(context.Player.Hand, Is.EquivalentTo(new[]{berserker, weapon}));
        }
開發者ID:Slugburn,項目名稱:Thunderstone,代碼行數:16,代碼來源:DisownedTest.cs

示例11: Using_ability_destroys_curse

        public void Using_ability_destroys_curse()
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            var curse = context.CreateCard<CurseOfNeglect>();
            var longspear = context.CreateBasicCard<Longspear>();
            context.SetPlayerHand(curse, longspear);
            context.SetPlayerState(Phase.Village);

            // Act
            context.UseAbilityOf(curse);

            // Assert
            Assert.That(player.Hand, Has.No.Member(curse));
        }
開發者ID:Slugburn,項目名稱:Thunderstone,代碼行數:16,代碼來源:CurseOfNeglectTest.cs

示例12: Using_ability_disables_abilities

        public void Using_ability_disables_abilities(Phase phase, bool isActive)
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            var curse = context.CreateCard<CurseOfSloth>();
            context.SetPlayerHand(curse);
            var otherAbility = context.AddAbilityStub(phase);
            context.SetPlayerState(Phase.Dungeon);

            // Act
            context.UseAbilityOf(curse);

            // Assert
            Assert.That(player.ActiveAbilities.Contains(otherAbility), Is.EqualTo(isActive));
        }
開發者ID:Slugburn,項目名稱:Thunderstone,代碼行數:16,代碼來源:CurseOfSlothTest.cs

示例13: Using_ability_reduces_available_gold_by_2

        public void Using_ability_reduces_available_gold_by_2()
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            var curse = context.CreateCard<CurseOfNeglect>();
            var longspear = context.CreateBasicCard<Longspear>();
            context.SetPlayerHand(curse, longspear);
            context.SetPlayerState(Phase.Village);

            // Act
            context.UseAbilityOf(curse);

            // Assert
            Assert.That(player.AvailableGold, Is.EqualTo(0));
        }
開發者ID:Slugburn,項目名稱:Thunderstone,代碼行數:16,代碼來源:CurseOfNeglectTest.cs

示例14: Necrophidius_trophy_ability

        public void Necrophidius_trophy_ability()
        {
            // Arrange
            var context = new TestContext();
            var necrophidius = context.CreateCard<UndeadSkeleton>("Necrophidius");
            var hero0 = context.DrawHeroFromTopOfDeck(x => x.Level == 0);
            var hero1 = context.DrawHeroFromTopOfDeck(x => x.Level == 1);
            var hero2 = context.GetHeroFromVillage(x => x.Level == 2);
            context.SetPlayerHand(necrophidius, hero0, hero1, hero2);
            context.SetPlayerState(Phase.Trophy);

            // Act
            context.UseAbilityOf(necrophidius);

            // Assert
            Assert.That(context.SelectCardsIds, Is.EquivalentTo(new[] {hero0.Id, hero1.Id}));
        }
開發者ID:Slugburn,項目名稱:Thunderstone,代碼行數:17,代碼來源:UndeadSkeletonTest.cs

示例15: Curse_of_discord_cannot_discard_itself

        public void Curse_of_discord_cannot_discard_itself()
        {
            // Arrange
            var context = new TestContext();
            context.Player.State = PlayerState.Village;
            var curse = context.CreateCard<CurseOfDiscord>();
            var regular = context.CreateBasicCard<Regular>();
            var torch = context.CreateBasicCard<Torch>();
            var longspear = context.CreateBasicCard<Longspear>();
            context.SetPlayerHand(curse, regular, torch, longspear);

            // Act
            context.UseAbilityOf(curse);

            // Assert
            Assert.That(context.SelectCardsIds, Has.No.Member(curse.Id));
        }
開發者ID:Slugburn,項目名稱:Thunderstone,代碼行數:17,代碼來源:CurseOfDiscordTest.cs


注:本文中的NUnit.Framework.TestContext.SetPlayerHand方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。