예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        //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);
        }
예제 #5
0
        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);
        }
예제 #6
0
        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);
        }
예제 #7
0
        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);
        }