public void GivenMoodAnalyseClassName_ShouldReturnMoodAnalyseObject_UsingParameterizedConstructor() { object expected = new MoodAnalyse("HAPPY"); object obj = MoodAnalyserFactory.CreateMoodAnalyseUsingParameterizedConstructor("MoodAnalyser.MoodAnalyse", "MoodAnalyse", "SAD"); expected.Equals(obj); }
public static string InvokeAnalyseMood(string message, string methodName) { try { Type type = Type.GetType("MoodAnalyser.MoodAnalyse"); object moodAnalyseObject = MoodAnalyserFactory.CreateMoodAnalyseUsingParameterizedConstructor("MoodAnalyser.MoodAnalyse", "MoodAnalyse", message); MethodInfo analyseMoodInfo = type.GetMethod(methodName); object mood = analyseMoodInfo.Invoke(moodAnalyseObject, null); return mood.ToString(); } catch { throw new MoodAnalyzerCustomException(MoodAnalyzerCustomException.ExceptionType.NO_SUCH_METHOD, "Method is not found"); } }