コード例 #1
0
        [TestMethod] //how do I test random nums?
        public void AttentionDecay_SubtractsAttention_Int()
        {
            TamagotchiPet pet = new TamagotchiPet("Anton");

            pet.AttentionDecay();
            Assert.AreEqual(pet.GetAttention(), pet.GetAttention());
        }
コード例 #2
0
        [TestMethod] //how do I test random nums?
        public void AttentionReplenish_AddsAttentionDecaysRestAndFood_Int()
        {
            TamagotchiPet pet = new TamagotchiPet("Anton");

            pet.AttentionReplenish();
            Assert.AreEqual(100, pet.GetAttention());
        }
コード例 #3
0
        public void FoodReplenish_AddsFoodAttentionAndRest_Int()
        {
            TamagotchiPet pet = new TamagotchiPet("Anton");

            pet.FoodReplenish();
            Assert.AreEqual(100, pet.GetFood());
            Assert.AreEqual(100, pet.GetAttention());
            Assert.AreEqual(100, pet.GetRest());
        }
コード例 #4
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()
            }));
        }
コード例 #5
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()
            }));
        }