Пример #1
0
        public void GivenProperParamter_ReturnMoodAnalyserObject_UsingMessageParamter()
        {
            string input_Message    = "I am kinda Sad";
            string class_Name       = "MoodAnalyzerApp";
            string constructor_Name = "MoodAnalyzerApp";

            object expected_Object = new MoodAnalyzerApp(input_Message);
            object actual_Object   = MoodAnalyzerFactory.Create_Mood_Analyser_Object_With_Parameter(class_Name, constructor_Name, input_Message);

            Assert.AreEqual(actual_Object.GetType(), expected_Object.GetType());
        }
Пример #2
0
        public void GivenEmptyInput_ThrowsEnteredEmptyException_WhenMoodAnalyzerAppIsInvoked()
        {
            string expected_SadMood   = "sad";
            string expected_HappyMood = "happy";
            string input_Message      = string.Empty;

            try
            {
                MoodAnalyzerApp m1          = new MoodAnalyzerApp(input_Message);
                string          output_Mood = m1.Analyse_Mood();
            }
            catch (MoodAnalyserCustomException e)
            {
                Assert.AreEqual(MoodAnalyserCustomException.ExceptionType.ENTERED_EMPTY, e.type);
            }
        }
Пример #3
0
        public void GivenWrongConstructorName_ReturnMoodAnalyserObject_UsingMessageParamter()
        {
            string input_Message    = "I am kinda Sad";
            string class_Name       = "MoodAnalyzerApp";
            string constructor_Name = "WrongMoodAnalyzerApp";

            try
            {
                object expected_Object = new MoodAnalyzerApp(input_Message);
                object actual_Object   = MoodAnalyzerFactory.Create_Mood_Analyser_Object_With_Parameter(class_Name, constructor_Name, input_Message);
            }
            catch (MoodAnalyserCustomException e)
            {
                Assert.AreEqual(MoodAnalyserCustomException.ExceptionType.NO_SUCH_METHODS, e.type);
            }
        }
Пример #4
0
        public void GivenImproperConstructorName_ReturnMoodAnalyserObject_UsingParameterizedConstructor()
        {
            string input_Message    = null;
            string class_Name       = "MoodAnalyzerApp";
            string constructor_Name = "WrongMoodAnalyzerApp";

            try
            {
                object expected_Object = new MoodAnalyzerApp(input_Message);
                object actual_Object   = MoodAnalyzerFactory.Create_Mood_Analyser_Object(class_Name, constructor_Name);
            }
            catch (MoodAnalyserCustomException e)
            {
                Assert.AreEqual(MoodAnalyserCustomException.ExceptionType.NO_SUCH_METHODS, e.type);
                //expected_Object.Equals(actual_Object);
            }
        }