예제 #1
0
        public void GivenAnyMoodShouldReturnHAPPY()
        {
            string      expected    = "HAPPY";
            string      message     = "I am in Any Mood";
            MoodAnalyse moodAnalyse = new MoodAnalyse(message);
            string      mood        = moodAnalyse.AnalyseMood();

            Assert.AreEqual(expected, mood);
        }
예제 #2
0
        public void GivenSadMoodShouldReturnSAD()
        {
            string      expected    = "SAD";
            string      message     = "I am in Sad Mood";
            MoodAnalyse moodAnalyse = new MoodAnalyse(message);
            string      mood        = moodAnalyse.AnalyseMood();

            Assert.AreEqual(expected, mood);
        }
예제 #3
0
        public void TestMethod1()
        {
            string      expected    = "SAD";
            string      Message     = "I am in sad Mood";
            MoodAnalyse moodAnalyse = new MoodAnalyse(Message);

            string mood = moodAnalyse.AnalyseMood();

            Assert.AreEqual(expected, mood);
        }
예제 #4
0
        public void GivenHappyShouldReturnHAPPYMood()
        {
            string      expected    = "HAPPY";
            MoodAnalyse moodAnalyse = new MoodAnalyse();

            MoodAnalyseFactory.SetField(moodAnalyse, "Happy", "message");
            string mood = moodAnalyse.AnalyseMood();

            Assert.AreEqual(expected, mood);
        }
        public void GiveHappyAndGetHappy(string message)
        {
            // Arrange
            moodAnalyse = new MoodAnalyse(message);

            // Act
            var actual = moodAnalyse.AnalyseMood();

            // Assert
            Assert.AreEqual("happy mood", actual);
        }
        public void GiveSadAndGetSad(string message)
        {
            // Arrange
            moodAnalyse = new MoodAnalyse(message);

            // Act
            var actual = moodAnalyse.AnalyseMood();

            //Assert
            Assert.AreEqual("sad mood", actual);
        }
예제 #7
0
        public void GivenEmptyMoodShouldThrowMoodAnalysisException()
        {
            string      expected    = "Please Enter Proper Mood";
            string      message     = "";
            MoodAnalyse moodAnalyse = new MoodAnalyse(message);

            try
            {
                string mood = moodAnalyse.AnalyseMood();
            }
            catch (MoodAnalysisException exception)
            {
                Assert.AreEqual(expected, exception.Message);
            }
        }
예제 #8
0
        public void GivenNullMoodShouldThrowMoodAnaylsisException()
        {
            string      expected    = "Can Not Set Null To Field";
            string      message     = null;
            MoodAnalyse moodAnalyse = new MoodAnalyse(message);

            try
            {
                string mood = moodAnalyse.AnalyseMood();
            }
            catch (MoodAnalysisException exception)
            {
                Assert.AreEqual(expected, exception.Message);
            }
        }
예제 #9
0
        public void GivenNullFieldShouldThrowMoodAnalysisException()
        {
            string expected = "Can Not Set Null To Field";

            try
            {
                MoodAnalyse moodAnalyse = new MoodAnalyse();
                MoodAnalyseFactory.SetField(moodAnalyse, null, "message");
                string mood = moodAnalyse.AnalyseMood();
            }
            catch (MoodAnalysisException exception)
            {
                Assert.AreEqual(expected, exception.Message);
            }
        }
예제 #10
0
        public void GivenImproperFieldShouldThrowMoodAnalysisException()
        {
            string expected = "No Such Field Found";

            try
            {
                MoodAnalyse moodAnalyse = new MoodAnalyse();
                MoodAnalyseFactory.SetField(moodAnalyse, "Happy", "anyField");
                string mood = moodAnalyse.AnalyseMood();
            }
            catch (MoodAnalysisException exception)
            {
                Assert.AreEqual(expected, exception.Message);
            }
        }
 public void GiveEmptyAndGetExceptionMessage(string message)
 {
     // Arrange
     moodAnalyse = new MoodAnalyse(message);
     try
     {
         // Act
         var actual = moodAnalyse.AnalyseMood();
     }
     catch (MoodAnalyserExceptions e)
     {
         // Assert
         Assert.AreEqual("MoodAnalyser exception : Mood cannot be empty", e.Message);
     }
 }
 public void GiveNullAndGetExceptionMessage(string message)
 {
     // Arrange
     moodAnalyse = new MoodAnalyse(message);
     try
     {
         // Act
         var actual = moodAnalyse.AnalyseMood();
     }
     catch (MoodAnalyserExceptions e)
     {
         // Assert
         Assert.AreEqual("MoodAnalyser exception : Null mood not accepted", e.Message);
     }
 }
 public void InvokeMethodOfMoodAnalyserInvalid(string message, string methodName)
 {
     try
     {
         // Act
         moodAnalyse = new MoodAnalyse("Happy");
         object expected = moodAnalyse.AnalyseMood();
         object actual   = MoodAnalyserReflector.InvokeMethod(message, methodName);
     }
     catch (MoodAnalyserExceptions e)
     {
         // Assert
         Assert.AreEqual("MoodAnalyser exception : No such method found", e.Message);
     }
 }