예제 #1
0
        public void GivenAnyMoodShouldReturnHappy(string message)
        {
            //arrange
            string      expected = "HAPPY";
            MoodAnalyse mood     = new MoodAnalyse(message);
            //Act
            string actual = mood.AnalyserMethod();

            //Assert
            Assert.AreEqual(expected, actual);
        }
예제 #2
0
        public void Given_Null_Mood_Should_Throw_MoodAnalysisCustomException_IndicatingNullMood()
        {
            try
            {
                string      message = null;
                MoodAnalyse mood    = new MoodAnalyse(message);
                string      actual  = mood.AnalyserMethod();
            }

            catch (MoodAnalyserCustomException exception)
            {
                Assert.AreEqual("Mood Should not be NULL", exception.Message);
            }
        }
예제 #3
0
 //TC 6.2 : Given Improper method name must return mood analyser custom exception
 public void GivenHappyMessage_WhenImproperMethod_ShouldThrowMoodAnalysisException()
 {
     //Act
     try
     {
         MoodAnalyse mood     = new MoodAnalyse("I am in happy mood");
         object      expected = mood.AnalyserMethod();
         object      actual   = MoodAnalyserFactory.InvokeAnalyserMethod("MoodAnalyser.MoodAnalyse", "MoodAnalyse", "i am in happy mood", "InvalidMethod");
     }
     catch (MoodAnalyserCustomException exception)
     {
         //Assert
         Assert.AreEqual("method not found", exception.Message);
     }
 }