GIVEN_a_virtual_pet_WHEN_the_game_starts_Update_the_model_and_alter_the_emotional_levels( int happyEmotionLevel, int notHungryEmotionLevel, int notBoredEmotionLevel, int healthyEmotionLevel, VirtualPetsModel.PetMood expectedPetMood) { ////PREPARE ////create a new instance of the VirtualPetsModel VirtualPetsModel virtualPetsModel = new VirtualPetsModel(); virtualPetsModel.happyEmotionLevel = happyEmotionLevel; virtualPetsModel.notBoredEmotionLevel = notBoredEmotionLevel; virtualPetsModel.notHungryEmotionLevel = notHungryEmotionLevel; virtualPetsModel.healthyEmotionLevel = healthyEmotionLevel; //ACT //TestCase 4 happyEmotionLevel = virtualPetsModel.happyEmotionLevel; notBoredEmotionLevel = virtualPetsModel.notBoredEmotionLevel; notHungryEmotionLevel = virtualPetsModel.notHungryEmotionLevel; healthyEmotionLevel = virtualPetsModel.healthyEmotionLevel; virtualPetsModel.UpdateEmotionLevels(); VirtualPetsModel.PetMood mood10 = virtualPetsModel.CalculateOverallMood();//unhealthy virtualPetsModel.GetMood(); //ASSERT Assert.AreEqual(mood10, expectedPetMood); }
public void GIVEN_a_virtual_pet_WHEN_the_game_starts_AND_mood_set_have_reset_method_to_push_the_levels_back_to_100( int happyEmotionLevel, int notHungryEmotionLevel, int notBoredEmotionLevel, int healthyEmotionLevel, VirtualPetsModel.PetMood expectedPetMood) { //PREPARE //create a new instance of the VirtualPetsModel VirtualPetsModel virtualPetsModel = new VirtualPetsModel(); virtualPetsModel.happyEmotionLevel = happyEmotionLevel; virtualPetsModel.notBoredEmotionLevel = notBoredEmotionLevel; virtualPetsModel.notHungryEmotionLevel = notHungryEmotionLevel; virtualPetsModel.healthyEmotionLevel = healthyEmotionLevel; ///ACT VirtualPetsModel.PetMood mood1 = virtualPetsModel.CalculateOverallMood();//bored virtualPetsModel.GetMood(); virtualPetsModel.ResetPetEmotions(); happyEmotionLevel = virtualPetsModel.happyEmotionLevel; notBoredEmotionLevel = virtualPetsModel.notBoredEmotionLevel; notHungryEmotionLevel = virtualPetsModel.notHungryEmotionLevel; healthyEmotionLevel = virtualPetsModel.healthyEmotionLevel; VirtualPetsModel.PetMood mood9 = virtualPetsModel.GetMood(); // ASSERT Assert.AreNotEqual(mood9, expectedPetMood); }
GIVEN_a_virtual_pet_WHEN_the_game_starts_AND_mood_set_have_different_methods_change_overall_mood_Love( int happyEmotionLevel, int notHungryEmotionLevel, int notBoredEmotionLevel, int healthyEmotionLevel, VirtualPetsModel.PetMood expectedPetMood) { ////PREPARE ////create a new instance of the VirtualPetsModel VirtualPetsModel virtualPetsModel = new VirtualPetsModel(); virtualPetsModel.happyEmotionLevel = happyEmotionLevel; virtualPetsModel.notBoredEmotionLevel = notBoredEmotionLevel; virtualPetsModel.notHungryEmotionLevel = notHungryEmotionLevel; virtualPetsModel.healthyEmotionLevel = healthyEmotionLevel; //ACT //TestCase 3 VirtualPetsModel.PetMood mood5 = virtualPetsModel.CalculateOverallMood(); //unhappy virtualPetsModel.GetMood(); virtualPetsModel.PetInteraction(VirtualPetsModel.GiveAction.Love); // now not unhappy VirtualPetsModel.PetMood mood6 = virtualPetsModel.CalculateOverallMood(); //hungry virtualPetsModel.GetMood(); //ASSERT Assert.AreNotEqual(mood6, expectedPetMood); }
GIVEN_a_virtual_pet_WHEN_the_game_starts_load_game_with_different_emotion_levels_AND_select_the_lowest_emotion_for_the_pet( int happyEmotionLevel, int notHungryEmotionLevel, int notBoredEmotionLevel, int healthyEmotionLevel, VirtualPetsModel.PetMood expectedPetMood) { //PREPARE //create a new instance of the VirtualPetsModel VirtualPetsModel virtualPetsModel = new VirtualPetsModel(); virtualPetsModel.happyEmotionLevel = happyEmotionLevel; virtualPetsModel.notBoredEmotionLevel = notBoredEmotionLevel; virtualPetsModel.notHungryEmotionLevel = notHungryEmotionLevel; virtualPetsModel.healthyEmotionLevel = healthyEmotionLevel; //ACT VirtualPetsModel.PetMood result = virtualPetsModel.CalculateOverallMood(); virtualPetsModel.GetMood(); //ASSERT Assert.AreEqual(expectedPetMood, result); }
private void timerUpdateMood_Tick(object sender, EventArgs e) { model.UpdateEmotionLevels(); levelHappy.Value = model.happyEmotionLevel; levelHealthy.Value = model.healthyEmotionLevel; levelBored.Value = model.notBoredEmotionLevel; levelHungry.Value = model.notHungryEmotionLevel; var mood = model.CalculateOverallMood(); switch (mood) { case VirtualPetsModel.PetMood.Bored: pictureBoxMood.Image = imageListMoods.Images[2]; labelMood.Text = "I am bored!"; break; case VirtualPetsModel.PetMood.Hungry: pictureBoxMood.Image = imageListMoods.Images[3]; labelMood.Text = "I am Hungry!"; break; case VirtualPetsModel.PetMood.Unhappy: pictureBoxMood.Image = imageListMoods.Images[4]; labelMood.Text = "I am Sad!"; break; case VirtualPetsModel.PetMood.Unhealthy: pictureBoxMood.Image = imageListMoods.Images[1]; labelMood.Text = "I am Sick!"; break; case VirtualPetsModel.PetMood.Okay: pictureBoxMood.Image = imageListMoods.Images[0]; break; case VirtualPetsModel.PetMood.Death: pictureBoxMood.Image = imageListMoods.Images[9]; labelMood.Text = "You Killed me!"; break; } }
//What happens if the same number is returned for two moods it will take the last value of the if conditions public void GIVEN_a_virtual_pet_WHEN_the_game_starts_load_it_with_same_emotion_values_select_the_last_value( int happyEmotionLevel, int notHungryEmotionLevel, int notBoredEmotionLevel, int healthyEmotionLevel, VirtualPetsModel.PetMood expectedPetMood ) { //PREPARE //create a new instance of the VirtualPetsModel VirtualPetsModel virtualPetsModel = new VirtualPetsModel(); virtualPetsModel.happyEmotionLevel = happyEmotionLevel; virtualPetsModel.notBoredEmotionLevel = notBoredEmotionLevel; virtualPetsModel.notHungryEmotionLevel = notHungryEmotionLevel; virtualPetsModel.healthyEmotionLevel = healthyEmotionLevel; //ACT VirtualPetsModel.PetMood result = virtualPetsModel.CalculateOverallMood(); virtualPetsModel.GetMood(); //ASSERT Assert.AreEqual(expectedPetMood, result); }
public void GIVEN_a_virtual_pet_WHEN_the_game_starts_load_it_with_a_different_emotion_attribute_AND_ensure_that_right_mood_is_returned( int happyEmotionLevel, int notHungryEmotionLevel, int notBoredEmotionLevel, int healthyEmotionLevel, VirtualPetsModel.PetMood expectedPetMood) { //PREPARE //create a new instance of the VirtualPetsModel VirtualPetsModel virtualPetsModel = new VirtualPetsModel(); virtualPetsModel.happyEmotionLevel = happyEmotionLevel; virtualPetsModel.notBoredEmotionLevel = notBoredEmotionLevel; virtualPetsModel.notHungryEmotionLevel = notHungryEmotionLevel; virtualPetsModel.healthyEmotionLevel = healthyEmotionLevel; //ACT VirtualPetsModel.PetMood actualMood = virtualPetsModel.CalculateOverallMood(); virtualPetsModel.GetMood(); //ASSERT Assert.AreNotSame(expectedPetMood, actualMood); }
GIVEN_a_virtual_pet_WHEN_the_game_starts_load_it_with_a_different_emotion_attribute_AND_ensure_lowest_number_wins( int happyEmotionLevel, int notHungryEmotionLevel, int notBoredEmotionLevel, int healthyEmotionLevel, VirtualPetsModel.PetMood expectedPetMood) { //PREPARE //Create the different emotions for the Pet //Randomly select the dominant emotion VirtualPetsModel virtualPetsModel = new VirtualPetsModel(); virtualPetsModel.happyEmotionLevel = happyEmotionLevel; virtualPetsModel.notBoredEmotionLevel = notBoredEmotionLevel; virtualPetsModel.notHungryEmotionLevel = notHungryEmotionLevel; virtualPetsModel.healthyEmotionLevel = healthyEmotionLevel; //ACT //Assign a number level between 1-10 to each emotion, //where 1 is the best state and 10 the worst // select an emotion VirtualPetsModel.PetMood actualMood = virtualPetsModel.CalculateOverallMood(); virtualPetsModel.GetMood(); //ASSERT Assert.AreEqual(expectedPetMood, actualMood); Assert.AreEqual(expectedPetMood, actualMood); }