コード例 #1
0
        public void givenMood_whenAnalysisMood_CreateObjectusingReflactionPassParametrizedConstructor()
        {
            object       reflactObj = MoodAnalyserReflaction.CreateObjectUsingReflection("MoodAnalysers.moodAnalyser", "I am in Happy Mood");
            moodAnalyser moodObj    = new moodAnalyser();
            bool         actual     = moodObj.Equals(reflactObj);

            Assert.AreEqual(false, actual);
        }
コード例 #2
0
 public void GivenMoodMessageToInvokeUsingReflectionMethod_WhenNotProper_ShouldThrowException()
 {
     try
     {
         string result = MoodAnalyserReflaction.InvokeMethodUsingReflection("007AnalyseMood", "I am in Any Mood");
     }
     catch (MoodAnalyserException e)
     {
         Assert.AreEqual(MoodAnalyserException.ExceptionType.No_Class_Method, e.type);
     }
 }
コード例 #3
0
        public void givenMood_whenAnalysisMood_SetFieldValueShouldReturnHappy()
        {
            string result = MoodAnalyserReflaction.InvokeMethodUsingReflection("AnalyserMood", "I am in Any Mood");

            Assert.AreEqual("Happy", result);
        }
コード例 #4
0
        public void givenMood_whenAnalysisMood_CreateObjectusingReflactionNotPassProperParametrizedConstructor()
        {
            object reflactObj = MoodAnalyserReflaction.CreateObjectUsingReflection("MoodAnalysers.moodAnalyser", 123);

            Assert.AreEqual(MoodAnalyserException.ExceptionType.No_Class_Method, reflactObj);
        }