Beispiel #1
0
        public object InvokeChangeMood(string mood)
        {
            MoodAnalyser moodObject   = new MoodAnalyser("happy");
            object       invokeObject = moodObject.AnalyseMood();

            return(invokeObject);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to mood analyzer portal!");
            Console.WriteLine("Type how you feeling right now:");
            string       mood         = Console.ReadLine();
            MoodAnalyser moodAnalyser = new MoodAnalyser(mood);

            Console.WriteLine("Currently you are : " + moodAnalyser.AnalyseMood());
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Enter message: ");
            string       message   = Console.ReadLine();
            MoodAnalyser checkmood = new MoodAnalyser(message);
            string       result    = checkmood.AnalyseMood();

            Console.WriteLine(result + " MOOD");
            MoodAnalyserFactory.CreateMoodAnalyserObject("MoodAnalyzerProblem.MoodAnalyser", "MoodAnalyser");
        }
Beispiel #4
0
 public static string SetField(string message, string fieldName)
 {
     try
     {
         MoodAnalyser moodAnalyse = new MoodAnalyser();
         Type         type        = typeof(MoodAnalyser);
         FieldInfo    field       = type.GetField(fieldName, BindingFlags.Public | BindingFlags.Instance);
         if (message == null)
         {
             throw new MoodAnalyserCustomException(MoodAnalyserCustomException.ExceptionType.NO_SUCH_FIELD, "Message should not be null");
         }
         field.SetValue(moodAnalyse, message);
         return(moodAnalyse.message);
     }
     catch (NullReferenceException)
     {
         throw new MoodAnalyserCustomException(MoodAnalyserCustomException.ExceptionType.NO_SUCH_FIELD, "Field not found");
     }
 }
Beispiel #5
0
 public static string SetField(string message, string fieldName)
 {
     try
     {
         MoodAnalyser moodAnalyser = new MoodAnalyser();
         Type         type         = typeof(MoodAnalyser);
         FieldInfo    field        = type.GetField(fieldName, BindingFlags.Public | BindingFlags.Instance);
         if (message == null)
         {
             throw new MoodAnalysisException(MoodAnalysisException.ExceptionType.EMPTY_MESSAGE, "message should not be null.");
         }
         field.SetValue(moodAnalyser, message);
         return(moodAnalyser.message);
     }
     catch (NullReferenceException)
     {
         throw new MoodAnalysisException(MoodAnalysisException.ExceptionType.NO_SUCH_FIELD, "no such field found.");
     }
 }
Beispiel #6
0
 static void Main(string[] args)
 {
     Console.WriteLine("----Welcome To Mood Analyser----");
     //Console.Read();
     MoodAnalyser mood = new MoodAnalyser();
 }