Beispiel #1
0
        public void Given_Nullmood_Expecting_happy_Result() //Method
        {
            MoodAnalyzer mood     = new MoodAnalyzer(null); //Create object and arrange
            string       expected = "happy";

            string actual = mood.Analyzer();    //act

            Assert.AreEqual(expected, actual);  //Assert
        }
Beispiel #2
0
        public void Given_Nullmood_Expecting_Exception_Result() //Method
        {
            MoodAnalyzer mood     = new MoodAnalyzer(null);     //Create object and arrange
            string       expected = "Object reference not set to an instance of an object.";

            string actual = mood.Analyzer();    //act

            Assert.AreEqual(expected, actual);  //Assert
        }
Beispiel #3
0
        public void AnalyseMood_ShouldReturn_Sad()
        {
            //Arraneg
            string       expected = "sad";
            MoodAnalyzer obj      = new MoodAnalyzer("I am in sad Mood");
            //Act
            string actual = obj.Analyzer();

            //Assert
            Assert.AreEqual(expected, actual);
        }
Beispiel #4
0
        public void Given_Nullmood_Expecting_happy_Result()
        {
            //Arrange
            MoodAnalyzer mood     = new MoodAnalyzer(null); //Create object
            string       expected = "happy";
            //Act
            string actual = mood.Analyzer();

            //Assert
            Assert.AreEqual(expected, actual);
        }
Beispiel #5
0
        public void Given_Happymood_Expecting_Happy_Result()
        {
            //Arrange
            MoodAnalyzer mood     = new MoodAnalyzer("I am in happy mood"); //create object
            string       expected = "happy";
            //Act
            string actual = mood.Analyzer();

            //Assert
            Assert.AreEqual(expected, actual);
        }
Beispiel #6
0
        public void Given_Nullmood_Expecting_Exception_Result()
        {
            //Arrange
            MoodAnalyzer mood     = new MoodAnalyzer(null);
            string       expected = "Object reference not set to an instance of an object.";

            //Act
            string actual = mood.Analyzer();

            //Assert
            Assert.AreEqual(expected, actual);
        }
Beispiel #7
0
        public void Given_Emptymood_Using_CustomExpection_Return_Empty()  //Method
        {
            string actual = "";

            try
            {
                string       message = string.Empty;
                MoodAnalyzer mood    = new MoodAnalyzer(message); //Create object and arrange
                actual = mood.Analyzer();                         //act
            }
            catch (MoodAnalyserException exception)
            {
                Assert.AreEqual("Mood should not be empty", exception.Message);  //Assert
            }
        }
Beispiel #8
0
        public void Given_Nullmood_Using_CustomExpection_Return_Null() //Method
        {
            MoodAnalyzer mood = new MoodAnalyzer(null);                //Create object and arrange
            //string actual = "";
            string actual = "";

            try
            {
                actual = mood.Analyzer();    //act
            }
            catch (MoodAnalyserException exception)
            {
                Assert.AreEqual("Mood should not be null", exception.Message);  //Assert
            }
        }
Beispiel #9
0
        public void Given_Nullmood_Using_CustomExpection_Return_Null()
        {
            //Arrange
            MoodAnalyzer mood   = new MoodAnalyzer(null); //Create object
            string       actual = "";

            try
            {
                //Act
                actual = mood.Analyzer();
            }
            catch (Exception ex)
            {
                //Assert
                Assert.AreEqual("Mood should not be null", ex.Message);
            }
        }
Beispiel #10
0
        public void GivenMood_IfEmpty_ShouldThrowException()
        {
            string actual = "";

            try
            {
                //Arrange
                string       message = string.Empty;
                MoodAnalyzer mood    = new MoodAnalyzer(message); //Create object
                //Act
                actual = mood.Analyzer();
            }
            catch (Exception ex)
            {
                //Assert
                Assert.AreEqual("Mood should not be empty", ex.Message);
            }
        }