public void GivenHappyMoodShouldReturnHappyUsingReflection() { object expected = "HAPPY"; object actual = MoodAnalyserFactory.InvokeAnalyseMood("HAPPY", "AnalyseMood"); Assert.AreEqual(expected, actual); }
public void GivenWrongMethodNameShouldThrowException() { object expected = "HAPPY"; object actual = MoodAnalyserFactory.InvokeAnalyseMood("HAPPY", "AnalyseMoodWrong"); Assert.AreEqual(expected, actual); }
public void Given_Happy_Message_Using_Reflection_When_Proper_Should_Return_Happy() { //Arrange string message = "HAPPY"; string methodName = "AnalyseMood"; //Act string actual = MoodAnalyserFactory.InvokeAnalyseMood(message, methodName); //Assert Assert.AreEqual("HAPPY", actual); }
public void Given_Improper_Method_Name_Should_Throw_MoodAnalysisException_Indicating_No_Such_Method() { try { //Arrange string message = "HAPPY"; string methodName = "WrongMethodName"; //Act string actual = MoodAnalyserFactory.InvokeAnalyseMood(message, methodName); } catch (MoodAnalysisException e) { //Assert Assert.AreEqual("no such method.", e.Message); } }