public void CheckExp_AddExpWhenPetIsAlive_Int()
        {
            TamagotchiPet pet = new TamagotchiPet("Bit");

            pet.CheckExp();
            Assert.AreEqual(1, pet.GetExp());
        }
        public void AddExpGetExp_AddsExpAndGetsExp_Int()
        {
            TamagotchiPet pet = new TamagotchiPet("Anton");

            pet.AddExp();
            pet.AddExp();
            Assert.AreEqual(2, pet.GetExp());
        }
        public void CheckExp_DoesNotAddExpWhenPetIsDead_Int()
        {
            TamagotchiPet pet = new TamagotchiPet("Bit");

            pet.SetIsDead(true);
            pet.CheckExp();
            Assert.AreEqual(0, pet.GetExp());
        }
        public void CheckForLevel_DoesNotAddLevelDoesNotResetExpWhenPetIsDead_Int()
        {
            TamagotchiPet pet = new TamagotchiPet("Bit");

            pet.AddExp();
            pet.SetIsDead(true);
            pet.CheckForLevel();
            Assert.AreEqual(1, pet.GetLevel());
            Assert.AreEqual(1, pet.GetExp());
        }
        public void CheckForLevel_AddsLevelAndResetsExpWhenPetIsAlive_Int()
        {
            TamagotchiPet pet = new TamagotchiPet("Bit");

            for (int i = 0; i < 5; i++)
            {
                pet.AddExp();
            }
            pet.CheckForLevel();
            Assert.AreEqual(2, pet.GetLevel());
            Assert.AreEqual(0, pet.GetExp());
        }
Beispiel #6
0
        public ActionResult CreatePet(string name)
        {
            TamagotchiPet pet = new TamagotchiPet(name);

            return(Json(new {
                name = pet.GetName(),
                level = pet.GetLevel(),
                exp = pet.GetExp(),
                nextLevel = pet.GetNextLevel(),
                id = pet.GetId(),
                food = pet.GetFood(),
                attention = pet.GetAttention(),
                rest = pet.GetRest()
            }));
        }
Beispiel #7
0
        public ActionResult AddRest(int id)
        {
            TamagotchiPet pet = TamagotchiPet.Find(id);

            pet.RestReplenish();
            return(Json(new {
                name = pet.GetName(),
                level = pet.GetLevel(),
                exp = pet.GetExp(),
                nextLevel = pet.GetNextLevel(),
                id = pet.GetId(),
                food = pet.GetFood(),
                attention = pet.GetAttention(),
                rest = pet.GetRest()
            }));
        }