Exemple #1
0
        public void Remove()
        {
            new PrivateType(typeof(Elpf)).SetStaticField("ind", 0);
            new PrivateType(typeof(GameMap)).SetStaticField("instance", null);
            GameMap map  = GameMap.GetInstance();
            Elpf    per1 = new Elpf();

            Assert.IsTrue(map.Add(per1, 20));
            Assert.IsTrue(map.Remove(per1));
            Assert.IsFalse(map.Remove(per1));
        }
        public void Exp_LvLUp()
        {
            BasicAtributs hero = new Elpf();

            Assert.IsFalse(hero.LvLUp(0));
            PrivateObject pr = new PrivateObject(hero);

            pr.SetField("_exp", 1);
            Assert.IsTrue(hero.LvLUp(0));
            Assert.AreEqual(hero.FullHp, 120);
            Assert.AreEqual(hero.Exp, 0);
        }
        public void Spell()
        {
            Human hero   = new Human();
            Elpf  enemie = new Elpf();

            new PrivateType(typeof(GameMap)).SetStaticField("instance", null);
            GameMap map = GameMap.GetInstance();

            map.Add(hero, 1);
            map.Add(enemie, 2);
            Assert.IsTrue(hero.Spell(enemie));
            Assert.AreEqual(enemie.Hp, 40);
            Assert.IsTrue(hero.Spell(enemie));
            Assert.IsTrue(enemie.IsDead);
        }
Exemple #4
0
        public void Add()
        {
            new PrivateType(typeof(Elpf)).SetStaticField("ind", 0);
            new PrivateType(typeof(GameMap)).SetStaticField("instance", null);
            GameMap map  = GameMap.GetInstance();
            Elpf    per1 = new Elpf();
            Elpf    per2 = new Elpf();

            Assert.AreEqual(per1.Name, "Elpf0");
            Assert.AreEqual(per2.Name, "Elpf1");
            Assert.IsTrue(map.Add(per1, 20));
            Assert.IsFalse(map.Add(per1, 20));
            Assert.IsFalse(map.Add(per2, 20));
            Assert.IsFalse(map.Add(per1, 21));
            Assert.IsTrue(map.Add(per2, 21));
        }
Exemple #5
0
        public void ClassInitialize()
        {
            new PrivateType(typeof(Elpf)).SetStaticField("ind", 0);
            new PrivateType(typeof(GameMap)).SetStaticField("instance", null);
            GameMap map  = GameMap.GetInstance();
            GameMap map1 = GameMap.GetInstance();

            Assert.AreEqual(map.Map.ToString(), "_".PadLeft(30, '_'));
            Elpf per1 = new Elpf();

            Assert.IsTrue(map.Add(per1, 20));
            Assert.AreEqual(map.Map[20], "Elpf0");
            Assert.AreEqual(map1.Map[20], "Elpf0");
            GameMap map2 = GameMap.GetInstance();

            Assert.AreEqual(map2.Map[20], "Elpf0");
        }
        public void Move()
        {
            new PrivateType(typeof(Elpf)).SetStaticField("ind", 0);
            new PrivateType(typeof(GameMap)).SetStaticField("instance", null);
            GameMap map  = GameMap.GetInstance();
            Elpf    per1 = new Elpf();
            Elpf    per2 = new Elpf();

            Assert.IsTrue(map.Add(per1, 13));
            Assert.IsTrue(map.Add(per2, 12));
            Assert.IsTrue(per1.Move(14));
            Assert.IsTrue(per2.Move(14));
            Assert.AreEqual(per2.Name, map[13]);
            Elpf per3 = new Elpf();

            Assert.IsTrue(map.Add(per3, 29));
            Assert.IsFalse(per3.Move(34));
        }
        public void Create()
        {
            new PrivateType(typeof(Elpf)).SetStaticField("ind", 0);
            BasicAtributs atributs = new Elpf();

            Assert.AreEqual(atributs.FullHp, 100);
            Assert.AreEqual(atributs.Hp, 100);
            Assert.AreEqual(atributs.FullMp, 50);
            Assert.AreEqual(atributs.Mp, 50);
            Assert.AreEqual(atributs.Str, 10);
            Assert.AreEqual(atributs.Int, 10);
            Assert.AreEqual(atributs.Agl, 20);
            Assert.AreEqual(atributs.Kill, 0);
            Assert.AreEqual(atributs.Name, "Elpf0");
            BasicAtributs atributs1 = new Elpf("hero");

            Assert.AreEqual(atributs1.Name, "hero");
        }