Exemplo n.º 1
0
        public void SetGetIsDead_SetsGetsIsDead_Bool()
        {
            TamagotchiPet pet = new TamagotchiPet("Anton");

            pet.SetIsDead(true);
            Assert.AreEqual(true, pet.GetIsDead());
        }
Exemplo n.º 2
0
        public void IncrementGetNextLevel_IncrementsGetsNextLevel_Int()
        {
            TamagotchiPet pet = new TamagotchiPet("Anton");

            pet.IncrementNextLevel();
            Assert.AreEqual(10, pet.GetNextLevel());
        }
Exemplo n.º 3
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());
        }
Exemplo n.º 4
0
        [TestMethod] //fix this - how do I test random nums?
        public void FoodDecay_SubtractsFood_Int()
        {
            TamagotchiPet pet = new TamagotchiPet("Anton");

            pet.FoodDecay();
            Assert.AreEqual(pet.GetFood(), pet.GetFood());
        }
Exemplo n.º 5
0
        public void SetGetName_ReturnsName_String()
        {
            TamagotchiPet pet = new TamagotchiPet("Anton");

            pet.SetName("Tamagot");
            Assert.AreEqual("Tamagotchi", pet.GetName());
        }
Exemplo n.º 6
0
        public void SetGetReplenishValue_SetsGetsReplenishValue_Int()
        {
            TamagotchiPet pet     = new TamagotchiPet("Anton");
            int           randNum = pet.GetReplenishValue(1, 5);

            Assert.AreEqual(randNum, pet.GetReplenishValue(1, 5));
        }
Exemplo n.º 7
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());
        }
Exemplo n.º 8
0
        [TestMethod] //how do I test random nums?
        public void RestDecay_SubtractsRest_Int()
        {
            TamagotchiPet pet = new TamagotchiPet("Anton");

            pet.RestDecay();
            Assert.AreEqual(pet.GetRest(), pet.GetRest());
        }
Exemplo n.º 9
0
        public void LevelUpGetLevel_GetsSetsLevel_Int()
        {
            TamagotchiPet pet = new TamagotchiPet("Anton");

            pet.LevelUp();
            Assert.AreEqual(2, pet.GetLevel());
        }
Exemplo n.º 10
0
        public void SetBuryGetIsBuried_GetsSetsBuried_True()
        {
            TamagotchiPet pet = new TamagotchiPet("Tan");

            pet.Bury();
            Assert.AreEqual(true, pet.IsBuried());
        }
Exemplo n.º 11
0
        public void CheckExp_AddExpWhenPetIsAlive_Int()
        {
            TamagotchiPet pet = new TamagotchiPet("Bit");

            pet.CheckExp();
            Assert.AreEqual(1, pet.GetExp());
        }
Exemplo n.º 12
0
        public void CheckForMax_ChecksIfStatIsHigherThanMax_Int()
        {
            TamagotchiPet pet = new TamagotchiPet("Tan");

            pet.FoodReplenish();
            Assert.AreEqual(100, pet.GetFood());
        }
Exemplo n.º 13
0
        public void AddExpGetExp_AddsExpAndGetsExp_Int()
        {
            TamagotchiPet pet = new TamagotchiPet("Anton");

            pet.AddExp();
            pet.AddExp();
            Assert.AreEqual(2, pet.GetExp());
        }
Exemplo n.º 14
0
        public void DisplayPetData_ReturnsCorrectView_True()
        {
            TamagotchiPet  pet            = new TamagotchiPet("Gandalf");
            HomeController controller     = new HomeController();
            ActionResult   DisplayPetData = controller.DisplayPetData(1);

            Assert.IsInstanceOfType(DisplayPetData, typeof(ViewResult));
        }
Exemplo n.º 15
0
        public void CheckExp_DoesNotAddExpWhenPetIsDead_Int()
        {
            TamagotchiPet pet = new TamagotchiPet("Bit");

            pet.SetIsDead(true);
            pet.CheckExp();
            Assert.AreEqual(0, pet.GetExp());
        }
Exemplo n.º 16
0
        public void DisplayPetData_HasCorrectModelType_Account()
        {
            TamagotchiPet pet            = new TamagotchiPet("Gandalf");
            ViewResult    DisplayPetData = new HomeController().DisplayPetData(1) as ViewResult;
            var           result         = DisplayPetData.ViewData.Model;

            Assert.IsInstanceOfType(result, typeof(List <TamagotchiPet>));
        }
Exemplo n.º 17
0
        public void BuryPet_ReturnsCorrectView_True()
        {
            TamagotchiPet  pet        = new TamagotchiPet("Balrog");
            HomeController controller = new HomeController();
            ActionResult   BuryPet    = controller.BuryPet(1);

            Assert.IsInstanceOfType(BuryPet, typeof(ViewResult));
        }
Exemplo n.º 18
0
        public void BuryPet_HasCorrectModelType_Account()
        {
            TamagotchiPet pet     = new TamagotchiPet("Sauron");
            ViewResult    BuryPet = new HomeController().BuryPet(1) as ViewResult;
            var           result  = BuryPet.ViewData.Model;

            Assert.IsInstanceOfType(result, typeof(List <TamagotchiPet>));
        }
Exemplo n.º 19
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());
        }
Exemplo n.º 20
0
        public void SetGetDecayValue_SetsGetsDecayValue_Int()
        {
            TamagotchiPet pet = new TamagotchiPet("Anton");

            pet.SetDecayValue();
            int randNum = pet.GetDecayValue();

            Assert.AreEqual(randNum, pet.GetDecayValue());
        }
Exemplo n.º 21
0
        public ActionResult BuryPet(int id)
        {
            TamagotchiPet pet = TamagotchiPet.Find(id);

            pet.Bury();
            List <TamagotchiPet> allPets = TamagotchiPet.GetAll();

            return(View("DisplayPetData", allPets));
        }
Exemplo n.º 22
0
        public ActionResult Decay()
        {
            List <TamagotchiPet> allPets = TamagotchiPet.GetAll();

            foreach (TamagotchiPet pet in allPets)
            {
                pet.RunLifeCycle();
            }
            return(View("DisplayPetData", allPets));
        }
Exemplo n.º 23
0
        public ActionResult DisplayPetData(int id)
        {
            TamagotchiPet        pet           = TamagotchiPet.Find(id);
            List <TamagotchiPet> singlePetList = new List <TamagotchiPet>()
            {
                pet
            };

            return(View(singlePetList));
        }
Exemplo n.º 24
0
        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());
        }
Exemplo n.º 25
0
        public void GetAll_GetsAllInstancesOfTamagotchiPet_List()
        {
            TamagotchiPet        pet1 = new TamagotchiPet("Antony");
            TamagotchiPet        pet2 = new TamagotchiPet("Jonathon");
            TamagotchiPet        pet3 = new TamagotchiPet("Karamo");
            List <TamagotchiPet> TamagotchiPetList = new List <TamagotchiPet> {
                pet1, pet2, pet3
            };

            CollectionAssert.AreEqual(TamagotchiPetList, TamagotchiPet.GetAll());
        }
Exemplo n.º 26
0
        public void CheckVitals_ChecksIfPetIsDead_Bool()
        {
            TamagotchiPet pet = new TamagotchiPet("Tan");

            for (int i = 0; i < 20; i++)
            {
                pet.FoodDecay();
            }
            pet.CheckVitals();
            Assert.AreEqual(true, pet.GetIsDead());
        }
Exemplo n.º 27
0
        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());
        }
Exemplo n.º 28
0
        public void ClearAll_ClearsAllInstancesOfBasket_Int()
        {
            TamagotchiPet pet1 = new TamagotchiPet("Antony");
            TamagotchiPet pet2 = new TamagotchiPet("Jonathon");
            TamagotchiPet pet3 = new TamagotchiPet("Karamo");

            TamagotchiPet.ClearAll();
            List <TamagotchiPet> emptyList = new List <TamagotchiPet>()
            {
            };

            CollectionAssert.AreEqual(emptyList, TamagotchiPet.GetAll());
        }
Exemplo n.º 29
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()
            }));
        }
Exemplo n.º 30
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()
            }));
        }