コード例 #1
0
ファイル: PlayerTests.cs プロジェクト: pvh/dominate
        public void TestCannotAdaptOver6()
        {
            GameController gc = new GameController();
            Player p = gc.Players.Find(delegate(Player pl) { return pl.Animal == Animal.Arachnid; });

            // Fill the list
            for(int i = 0; i < 4; i++)
                gc.AddElementToPlayer(p, Chit.ElementType.Grub);

            try
            {
                gc.AddElementToPlayer(p, Chit.ElementType.Grub);
                Assert.Fail("Was able to Adapt to more than 6 elements");
            }
            catch (Exception) {}
        }
コード例 #2
0
ファイル: PlayerTests.cs プロジェクト: pvh/dominate
        public void TestAmphibianGetsLessAdaptation()
        {
            GameController gc = new GameController();
            Player p = gc.Players.Find(delegate(Player pl) { return pl.Animal == Animal.Amphibian; });

            // Fill the list
            for(int i = 0; i < 3; i++)
                gc.AddElementToPlayer(p, Chit.ElementType.Grub);

            try
            {
                gc.AddElementToPlayer(p, Chit.ElementType.Grub);
                Assert.Fail("Was able to Adapt to more than 6 elements");
            }
            catch (Exception) {}
        }
コード例 #3
0
ファイル: PlayerTests.cs プロジェクト: pvh/dominate
        public void TestCanAdapt()
        {
            GameController gc = new GameController();
            Player p = gc.Players[0];

            int beginCount = 0;
            foreach(Chit.ElementType element in Enum.GetValues(typeof(Chit.ElementType)))
                beginCount += p.AdaptationTo(element);

            gc.AddElementToPlayer(p, Chit.ElementType.Grass);

            int endCount = 0;
            foreach(Chit.ElementType element in Enum.GetValues(typeof(Chit.ElementType)))
                endCount += p.AdaptationTo(element);

            Assert.AreEqual(beginCount + 1, endCount);
        }