コード例 #1
0
        public void GivenMoodAnalyseClassName_ShouldReturnMoodAnalyseObject()
        {
            object expected = new MoodAnalyse();
            object obj      = MoodAnalyseFactory.CreateMoodAnalyse("MoodAnalyzerApp.MoodAnalyse", "MoodAnalyse");

            expected.Equals(obj);
        }
コード例 #2
0
        public void GivenMoodAnalyseShouldReturnMoodAnalyse()
        {
            object          expected    = new MoodAnalyse();
            ConstructorInfo constructor = MoodAnalyseFactory.GetConstructor("MoodAnalyse");

            string[] message   = { "I am in Sad Mood" };
            object   newObject = MoodAnalyseFactory.CreateMoodAnalyse(constructor, message);

            expected.Equals(newObject);
        }
コード例 #3
0
        public void GivenImproperClassNameShouldThrowMoodAnalysisException()
        {
            string expected = "Class Not Found";

            try
            {
                object moodAnalyseObject = MoodAnalyseFactory.CreateMoodAnalyse("MoodAnalyzerApp.DemoClass", "DemoClass");
            }
            catch (MoodAnalysisException exception)
            {
                Assert.AreEqual(expected, exception.Message);
            }
        }
コード例 #4
0
        public void GivenImproperClassNameShouldThrowMoodAnalysisException()
        {
            string expected = "No Such Class Found";

            try
            {
                ConstructorInfo constructor = MoodAnalyseFactory.GetConstructor("AnyClass");
                string[]        message     = { "I am in Sad Mood" };
                object          newObject   = MoodAnalyseFactory.CreateMoodAnalyse(constructor, message);
            }
            catch (MoodAnalysisException exception)
            {
                Assert.AreEqual(expected, exception.Message);
            }
        }
コード例 #5
0
        public void GivenImproperConstructorShouldThrowMoodAnalysisException()
        {
            string expected = "No Such Method Found";

            try
            {
                object            testObject  = new object();
                Type              type        = testObject.GetType();
                ConstructorInfo[] constructor = type.GetConstructors();
                string[]          message     = { "I am in Sad Mood" };
                object            newObject   = MoodAnalyseFactory.CreateMoodAnalyse(constructor[0], message);
            }
            catch (MoodAnalysisException exception)
            {
                Assert.AreEqual(expected, exception.Message);
            }
        }