当前位置: 首页>>代码示例>>C#>>正文


C# TestContext.CreateCard方法代码示例

本文整理汇总了C#中NUnit.Framework.TestContext.CreateCard方法的典型用法代码示例。如果您正苦于以下问题:C# TestContext.CreateCard方法的具体用法?C# TestContext.CreateCard怎么用?C# TestContext.CreateCard使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NUnit.Framework.TestContext的用法示例。


在下文中一共展示了TestContext.CreateCard方法的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: Laird_gains_health_equal_to_other_kobolds_in_hall

        public void Laird_gains_health_equal_to_other_kobolds_in_hall()
        {
            // Arrange
            var context = new TestContext();
            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");
            context.SetTopOfDungeonDeck(laird, ambusher, cutter, shaman);

            // Act
            context.AdvanceMonsterToFirstRank(laird);

            // Assert
            Assert.That(laird.Health, Is.EqualTo(laird.GetBaseValue(Attr.Health) + ambusher.Health + cutter.Health + shaman.Health));
        }
开发者ID:Slugburn,项目名称:Thunderstone,代码行数:16,代码来源:KoboldHumanoidTest.cs

示例3: 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

示例4: 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

示例5: Using_ability_reduces_total_attack_value_by_3

        public void Using_ability_reduces_total_attack_value_by_3()
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            var curse = context.CreateCard<CurseOfSloth>();
            var sergeant = context.CreateCard<Criochan>();
            var summoner = context.CreateCard<Thundermage>();
            context.SetPlayerHand(curse, sergeant, summoner);
            context.SetPlayerState(Phase.Dungeon);

            // Act
            context.UseAbilityOf(curse);

            // Assert
            Assert.That(player.TotalAttack, Is.EqualTo(sergeant.TotalAttack + summoner.TotalAttack - 3));
        }
开发者ID:Slugburn,项目名称:Thunderstone,代码行数:17,代码来源:CurseOfSlothTest.cs

示例6: Bloodrager_destroys_all_other_heroes_during_aftermath

        public void Bloodrager_destroys_all_other_heroes_during_aftermath()
        {
            // Arrange
            var context = new TestContext();
            var bloodrager = context.CreateCard<Disowned>("Disowned Bloodrager");
            var hero1 = context.CreateBasicCard<Regular>();
            var hero2 = context.CreateBasicCard<Regular>();
            var weapon = context.CreateCard<Pike>();
            context.SetPlayerHand(bloodrager, hero1, hero2, weapon);
            context.SetPlayerState(Phase.Aftermath);

            // Act
            context.UseAbilityOf(bloodrager);

            // Assert
            Assert.That(context.Player.Hand, Is.EquivalentTo(new[] {weapon}));
        }
开发者ID:Slugburn,项目名称:Thunderstone,代码行数:17,代码来源:DisownedTest.cs

示例7: Bloodrager_returns_to_top_of_deck_during_aftermath

        public void Bloodrager_returns_to_top_of_deck_during_aftermath()
        {
            // Arrange
            var context = new TestContext();
            var bloodrager = context.CreateCard<Disowned>("Disowned Bloodrager");
            var weapon = context.CreateCard<Pike>();
            context.SetPlayerHand(bloodrager, weapon);
            context.HeroEquipsWeapon(bloodrager,weapon);
            context.SetPlayerState(Phase.Aftermath);

            // Act
            context.UseAbilityOf(bloodrager);

            // Assert
            Assert.That(context.Player.Hand, Is.EquivalentTo(new[] {weapon}));
            Assert.That(context.Player.Deck.TopCard, Is.SameAs(bloodrager));
            Assert.That(bloodrager.TotalAttack, Is.EqualTo(bloodrager.GetBaseValue(Attr.PhysicalAttack)));
        }
开发者ID:Slugburn,项目名称:Thunderstone,代码行数:18,代码来源:DisownedTest.cs

示例8: Pike_only_protects_the_hero_that_has_it_equipped

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

            // Act
            context.HeroEquipsWeapon(equippedHero, pike);
            context.WhenBattling(ettin);

            // Assert
            Assert.That(player.Hand, Has.Member(equippedHero), "Pike should protect hero from Ettin.");
            Assert.That(player.Hand, Has.No.Member(unequippedHero), "Ettin eats unequipped hero.");
        }
开发者ID:Slugburn,项目名称:Thunderstone,代码行数:19,代码来源:PikeTest.cs

示例9: Bloodrager_can_equip_two_weapons

        public void Bloodrager_can_equip_two_weapons()
        {
            // Arrange
            var context = new TestContext();
            var bloodrager = context.CreateCard<Disowned>("Disowned Bloodrager");
            var weapon1 = context.CreateCard<Pike>();
            var weapon2 = context.CreateCard<SnakeheadFlail>();
            context.SetPlayerHand(bloodrager, weapon1, weapon2);
            context.SetPlayerState(Phase.Dungeon);

            // Act
            context.HeroEquipsWeapon(bloodrager, weapon1);
            context.HeroEquipsWeapon(bloodrager, weapon2);

            // Assert
            Assert.That(bloodrager.IsEquipped, Is.True);
            Assert.That(bloodrager.GetEquipped(), Is.EquivalentTo(new[] {weapon1, weapon2}));
            Assert.That(weapon1.IsEquipped, Is.True);
            Assert.That(weapon2.IsEquipped, Is.True);
            Assert.That(bloodrager.TotalAttack, Is.EqualTo(14));
        }
开发者ID:Slugburn,项目名称:Thunderstone,代码行数:21,代码来源:DisownedTest.cs

示例10: When_whetmage_levels_other_hero_then_curse_of_decay_ability_is_no_longer_available

        public void When_whetmage_levels_other_hero_then_curse_of_decay_ability_is_no_longer_available()
        {
            // Arrange
            var context = new TestContext();
            var player = context.Player;
            var curse = context.CreateCard<CurseOfDecay>();
            var whetmage = context.CreateCard<Whetmage>();
            var hero1 = context.DrawHeroFromTopOfDeck(x => x.Level == 1);
            var hero2 = context.DrawHeroFromTopOfDeck(x => x.Level == 1);
            context.SetPlayerHand(curse, whetmage, hero1, hero2);
            context.SetPlayerState(Phase.Dungeon);
            player.Xp = 2;

            var levelOtherHero = whetmage.GetAbilities().First();
            var curseAbility = curse.GetAbilities().First();

            // Act
            context.UseAbilityOf(whetmage);

            // Assert
            Assert.That(player.ActiveAbilities, Has.No.Member(curseAbility));
        }
开发者ID:Slugburn,项目名称:Thunderstone,代码行数:22,代码来源:CurseOfDecayTest.cs

示例11: If_terror_destroys_disease_then_can_use_ability_one_additional_time

        public void If_terror_destroys_disease_then_can_use_ability_one_additional_time()
        {
            var context = new TestContext();
            var terror = context.CreateCard<Skinshifter>("Terror");
            var disease1 = context.CreateCard<CurseOfDecay>();
            var disease2 = context.CreateCard<CurseOfDecay>();
            var disease3 = context.CreateCard<CurseOfDecay>();
            context.SetPlayerHand(terror, disease1, disease2, disease3);
            context.SetPlayerState(Phase.Dungeon);
            context.WhenSelectingOptionSelect("Destroy");
            context.WhenSelectingCardsSelectFirst();
            var ability = context.GetAbilityOf(terror);

            // Act
            context.UseAbility(ability);
            context.UseAbilityOf(terror);

            // Assert
            Assert.That(context.Player.Hand, Has.No.Member(disease1));
            Assert.That(context.Player.Hand, Has.No.Member(disease2));
            Assert.That(context.Player.ActiveAbilities, Has.No.Member(ability));
        }
开发者ID:Slugburn,项目名称:Thunderstone,代码行数:22,代码来源:SkinshifterTest.cs

示例12: 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

示例13: 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

示例14: 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

示例15: 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


注:本文中的NUnit.Framework.TestContext.CreateCard方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。