Example #1
0
        public void ChangeMoodDynamicallyForValidFieldName()
        {
            // ACT
            object actual = MoodAnalyserFactory.ChangeMoodDynamically("I am happy today", "message");

            // Assert
            Assert.AreEqual("HAPPY", actual);
        }
Example #2
0
 public void ChangeMoodDynamically_WhenNull_ShouldThrowException()
 {
     try
     {
         dynamic result = MoodAnalyserFactory.ChangeMoodDynamically("MoodAnalyzer.MoodAnalyser", null);
     }
     catch (MoodAnalyzerCustomException e)
     {
         Assert.AreEqual(MoodAnalyzerCustomException.ExceptionType.NULL_EXCEPTION, e.Message);
     }
 }
Example #3
0
 public void ChangeMoodDynamically_WhenImproperMessage_ShouldThrowException()
 {
     try
     {
         string message = MoodAnalyserFactory.ChangeMoodDynamically("MoodAnalyzer.getMood", "HAPPY");
     }
     catch (MoodAnalyzerCustomException e)
     {
         Assert.AreEqual(MoodAnalyzerCustomException.ExceptionType.INVALID_INPUT, e.Message);
     }
 }
Example #4
0
 public void ChangeMoodDynamicallySetNull(string message, string fieldName)
 {
     try
     {
         // ACT
         object actual = MoodAnalyserFactory.ChangeMoodDynamically(message, fieldName);
     }
     catch (MoodAnalyserCustomException ex)
     {
         // Assert
         Assert.AreEqual("No such field found", ex.Message);
     }
 }
Example #5
0
        public void ChangeMoodDynamically_WhenHappyMessage_ShouldReturnHappy()
        {
            dynamic result = MoodAnalyserFactory.ChangeMoodDynamically("MoodAnalyser.MoodAnalyserMain", "HAPPY");

            Assert.AreEqual("HAPPY", result);
        }