public void TestMethodForSadMood() { //Access MoodAnalyserClass moodAnalyserClass = new MoodAnalyserClass("I am in sad mood today"); //Act string actual = moodAnalyserClass.analyseMood(); //Assert Assert.AreEqual(SAD_MOOD, actual); }
public void InvokeMethodOfMoodAnalyserNullMessage() { //Act try { MoodAnalyserClass moodAnalyser = new MoodAnalyserClass(); object expected = moodAnalyser.analyseMood(); object actual = MoodAnalyserReflector.InvokeMethod("MoodAnalyserProblem.MoodAnalyserClass", "MoodAnalyserClass", null, "InvalidMethod"); } //Assert catch (MoodAnalysisCustomException exception) { Assert.AreEqual("Mood should not be NULL", exception.Message); } }
public void InvokeMethodOfMoodAnalyserInvalid() { //Act try { MoodAnalyserClass moodAnalyser = new MoodAnalyserClass("I am in happy mood today"); object expected = moodAnalyser.analyseMood(); object actual = MoodAnalyserReflector.InvokeMethod("MoodAnalyserProblem.MoodAnalyserClass", "MoodAnalyserClass", "I am in happy mood today", "InvalidMethod"); } //Assert catch (MoodAnalysisCustomException exception) { Assert.AreEqual("No such method found", exception.Message); } }
public void TestMethodForHappyMoodForNull() { //Access MoodAnalyserClass moodAnalyserClass = new MoodAnalyserClass(null); //Act try { string actual = moodAnalyserClass.analyseMood(); } catch (MoodAnalysisCustomException exception) { //Assert Assert.AreEqual("Mood should not be NULL", exception.Message); } }