コード例 #1
0
        public void TestMethodGivenHappyMessageUsingReflectionWhenProperShouldReturnHappy()
        {
            //Arrange
            string message    = "HAPPY";
            string methodName = "AnalyseMood";
            //Act
            string actual = MoodAnalyserFactory.AnalyseMood(message, methodName);

            //Assert
            Assert.AreEqual("HAPPY", actual);
        }
コード例 #2
0
 public void TestMethodGivenImproperMethodNameShouldThrowMoodAnalysisExceptionIndicatingNoSuchMethod()
 {
     try
     {
         //Arrange
         string message    = "HAPPY";
         string methodName = "WrongMethodName";
         //Act
         string actual = MoodAnalyserFactory.AnalyseMood(message, methodName);
     }
     catch (MoodAnalysisException e)
     {
         //Assert
         Assert.AreEqual("no such method", e.Message);
     }
 }