public void LevelUpGetLevel_GetsSetsLevel_Int() { TamagotchiPet pet = new TamagotchiPet("Anton"); pet.LevelUp(); Assert.AreEqual(2, pet.GetLevel()); }
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()); }
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() })); }
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() })); }