public void Res5Phasetest()
        {
            SunQuan     p1 = new SunQuan(0);
            LiuBei      p2 = new LiuBei(1);
            List <Card> x  = new List <Card>();

            Player[] p = new SunQuan[1];
            p[0] = p1;
            Miss miss   = new Miss(CardSuit.Diamond, 2);
            Card attack = new Attack(CardSuit.Spade, 1);

            x.Add(miss);
            x.Add(attack);
            Game game = new Game(p, new CardSet(x));



            // ActionPhase produces attackPhase
            ActionPhase a   = new ActionPhase(p1);
            PhaseList   ret = a.advance(new UseCardAction(attack, p2), game);
            Phase       b   = ret.pop();
            AttackPhase b2  = b as AttackPhase;

            p1.handCards.Add(attack);
            p1.handCards.Add(miss);
            p1.health = 1;

            // AttackPhase produces responsePhase
            ret = b.advance(null, game);
            Phase         c  = ret.pop();
            ResponsePhase c_ = c as ResponsePhase;


            Assert.IsInstanceOfType(a.responseAbilityActionSun(new AbilityActionSun(attack), game), typeof(PhaseList));
        }
 public void SunQuanAbtestnomockBVA()
 {
     {
         Player p    = new SunQuan(0);
         Attack card = new Attack(CardSuit.Heart, (byte)1);
         p.handCards.Add(card);
         Assert.IsTrue(p.handCards.Count == 1);
         Assert.IsTrue(card == p.handCards[0]);
     }
 }
        public void SunAbtestnomocknull2()
        {
            {
                Player p = new SunQuan(0);

                Attack card = new Attack(CardSuit.Heart, (byte)1);
                p.handCards.Add(card);
                p.abilitySun(new AbilityActionSun(card), null);
            }
        }
        public void SunAbtestnomocknull()
        {
            {
                Player p = new SunQuan(0);

                Attack card = new Attack(CardSuit.Heart, (byte)1);
                p.handCards.Add(card);
                p.abilitySun(null, mocks.Stub <IGame>());
            }
        }
 public void SunAbtestnomock()
 {
     {
         Player p        = new SunQuan(0);
         IGame  fakeGame = mocks.DynamicMock <IGame>();
         Attack card     = new Attack(CardSuit.Heart, (byte)1);
         p.handCards.Add(card);
         List <Card> l = new List <Card>();
         l.Add(card);
         p.abilitySun(new AbilityActionSun(card), new Game(new Player[0], new CardSet(l)));
     }
 }
Esempio n. 6
0
        /// <summary>
        /// initialize players
        /// </summary>
        /// <param name="n"></param>
        /// <returns></returns>
        public static Player[] initializePlayers(int n)
        {
            Player[] players = new Player[n];

            players[0] = new LuMeng(0, PlayerType.King);
            players[1] = new SunQuan(1, PlayerType.Loyal);
            players[2] = new LiuBei(2, PlayerType.Rebel);
            players[3] = new ZhangFei(3, PlayerType.Rebel);
            players[4] = new CaoCao(4, PlayerType.Spy);

            return(players);
        }