Пример #1
0
        public void Given_Happy_Message_With_Reflection_Should_Return_Happy()
        {
            //Arrange
            string message   = "HAPPY";
            string fieldName = "message";
            //Act
            string actual = MoodAnalyserFactory.SetField(message, fieldName);

            //Assert
            Assert.AreEqual("HAPPY", actual);
        }
Пример #2
0
 public void ChangeMoodDynamically_WhenNull_ShouldThrowException()
 {
     try
     {
         string result = MoodAnalyserFactory.SetField(null, "message");
     }
     catch (MoodAnalyserException e)
     {
         Assert.AreEqual(MoodAnalyserException.ExceptionType.EnteredNull, e.TYPE);
     }
 }
Пример #3
0
 public void Given_Null_Message_Should_Throw_MoodAnalysisException_Indicating_Null_Message()
 {
     try
     {
         //Arrange
         string message   = null;
         string fieldName = "message";
         //Act
         string actual = MoodAnalyserFactory.SetField(message, fieldName);
     }
     catch (MoodAnalysisException e)
     {
         //Assert
         Assert.AreEqual("message should not be null", e.Message);
     }
 }
Пример #4
0
 public void Given_Improper_Field_Name_Should_Throw_MoodAnalysisException_Indicating_No_Such_Field()
 {
     try
     {
         //Arrange
         string message   = "HAPPY";
         string fieldName = "wrongName";
         //Act
         string actual = MoodAnalyserFactory.SetField(message, fieldName);
     }
     catch (MoodAnalysisException e)
     {
         //Assert
         Assert.AreEqual("no such field found", e.Message);
     }
 }
Пример #5
0
        public void Change_Mood_Dynamically()
        {
            string result = MoodAnalyserFactory.SetField("Happy", "message");

            Assert.AreEqual("Happy", result);
        }
Пример #6
0
        public void Given_HAPPYMessag_WithReflector_should_ReturnHAPPY()
        {
            string result = MoodAnalyserFactory.SetField("HAPPY", "message");

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