예제 #1
0
        public ActionResult AddNewMon(string monname, int monlevel, int monhp, int monattack, int mondefense, int monspecialattack, int monspecialdefense, int monspeed, string montype1, string montype2, string move1, string move2, string move3, string move4)
        {
            int     move1int = int.Parse(move1);
            int     move2int = int.Parse(move2);
            int     move3int = int.Parse(move3);
            int     move4int = int.Parse(move4);
            MonType typeOne  = MonType.Find(montype1);
            Mon     newMon   = new Mon(monname, monlevel, monhp, monattack, mondefense, monspecialattack, monspecialdefense, monspeed);
            Move    monmove1 = Move.Find(move1int);

            newMon.Save();
            newMon.AddMonType(typeOne);
            newMon.AddMove(monmove1);


            if (montype2 != "NOOOO")
            {
                MonType typeTwo = MonType.Find(montype2);
                newMon.AddMonType(typeTwo);
            }
            if (move2int != 0)
            {
                Move monmove2 = Move.Find(move2int);
                newMon.AddMove(monmove2);
            }
            if (move3int != 0)
            {
                Move monmove3 = Move.Find(move3int);
                newMon.AddMove(monmove3);
            }
            if (move4int != 0)
            {
                Move monmove4 = Move.Find(move4int);
                newMon.AddMove(monmove4);
            }


            return(RedirectToAction("Dev"));
        }
예제 #2
0
        public void GetMonTypes_Test()
        {
            Mon newMon = new Mon("Rattata", 50, 30, 56, 35, 25, 35, 72);

            newMon.Save();
            MonType newMonType = new MonType("Grass");

            newMonType.Save();
            MonType newMonType1 = new MonType("Fire");

            newMonType1.Save();

            //Act
            newMon.AddMonType(newMonType);
            newMon.AddMonType(newMonType1);

            List <MonType> expectedResult = new List <MonType> {
                newMonType, newMonType1
            };
            List <MonType> result = newMon.GetMonTypes();

            //Assert
            CollectionAssert.AreEqual(expectedResult, result);
        }