예제 #1
0
        public void Given_MoodAnalyse_ClassName_Should_Return_MoodAnalyse_Object()
        {
            object expected = new MoodAnalyser();
            object obj      = MoodAnalyseReflector.CreateMoodAnalyse("MoodAnalyserProblem.MoodAnalyser", "MoodAnalyser");

            expected.Equals(obj);
        }
예제 #2
0
        public void Given_Happy_Message_With_Reflector_Should_Return_Happy()
        {
            string expected = "HAPPY";
            string result   = MoodAnalyseReflector.SetField("HAPPY", "message");

            Assert.AreEqual(expected, result);
        }
예제 #3
0
        public void Given_Happy_Mood_Using_Reflection_When_Proper_Should_Return_Happy()
        {
            string expected = "HAPPY";
            string mood     = MoodAnalyseReflector.InvokeAnalyseMood("Happy", "AnalyseMood");

            Assert.AreEqual(expected, mood);
        }
예제 #4
0
        public void Given_Proper_Message_To_MoodAnalyse_Should_Return_MoodAnalyse_Object()
        {
            object expected = new MoodAnalyser("HAPPY");
            object obj      = MoodAnalyseReflector.CreateMoodAnalyseUsingParameterizedConstructor("MoodAnalyserProblem.MoodAnalyser", "MoodAnalyser", "I am in Happy Mood");

            expected.Equals(obj);
        }
예제 #5
0
 public void Given_Happy_Message_Improper_Field_Should_Throw_MoodAnalyserCustomException()
 {
     try
     {
         string result = MoodAnalyseReflector.SetField("HAPPY", "any");
     }
     catch (MoodAnalyserCustomException e)
     {
         Assert.AreEqual("Field not found", e.Message);
     }
 }
예제 #6
0
 public void Given_Null_Message_With_Reflection_Should_Throw_MoodAnalyserCustomException()
 {
     try
     {
         string message = null;
         string result  = MoodAnalyseReflector.SetField(message, "message");
     }
     catch (MoodAnalyserCustomException e)
     {
         Assert.AreEqual("Message should not be null", e.Message);
     }
 }
예제 #7
0
 public void Given_Improper_MoodAnalyse_Constructor_Should_throw_MoodAnalysisException_Indicating_NoSuchMethod()
 {
     try
     {
         object expected = new MoodAnalyser();
         object obj      = MoodAnalyseReflector.CreateMoodAnalyse("MoodAnalyserProblem.MoodAnalyser", "MoodAnalyyserr");
         expected.Equals(obj);
     }
     catch (MoodAnalyserCustomException e)
     {
         Assert.AreEqual("Constructor is Not Found", e.Message);
     }
 }
예제 #8
0
 public void Given_Happy_Message_But_Improper_Method_Should_throw_MoodAnalysisException_Indicating_NoSuchMethod()
 {
     try
     {
         string expected = "HAPPY";
         string mood     = MoodAnalyseReflector.InvokeAnalyseMood("Happy", "AnalyyseMood");
         expected.Equals(mood);
     }
     catch (MoodAnalyserCustomException e)
     {
         Assert.AreEqual("Constructor is Not Found", e.Message);
     }
 }
예제 #9
0
 public void Given_Proper_Message_But_Improper_MoodAnalyse_ClassName_Should_throw_MoodAnalysisException_Indicating_NoSuchClass()
 {
     try
     {
         object expected = new MoodAnalyser();
         object obj      = MoodAnalyseReflector.CreateMoodAnalyseUsingParameterizedConstructor("MoodAnalyserProblem.MoodAnalyyser", "MoodAnalyyser", "I am in Happy Mood");
         expected.Equals(obj);
     }
     catch (MoodAnalyserCustomException e)
     {
         Assert.AreEqual("Class Not Found", e.Message);
     }
 }