コード例 #1
0
        public void Given_nullmood_Expecting_Exception_Result()
        {
            //Arrange
            MoodToAnalyse mood     = new MoodToAnalyse(null);
            string        expected = "Object reference not set to an instance of an object";

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

            //Assert
            Assert.AreEqual(expected, actual);
        }
コード例 #2
0
        public void Given_nullmood_Expecting_happy_Result()
        {
            //Arrange
            MoodToAnalyse mood     = new MoodToAnalyse(null);
            string        expected = "happy";

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

            //Assert
            Assert.AreEqual(expected, actual);
        }
コード例 #3
0
        public void Given_Happymood_Expecting_Happy_Results()
        {
            //Arrange
            MoodToAnalyse mood     = new MoodToAnalyse("I am in happy mood");
            string        expected = "happy";

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

            //Assert
            Assert.AreEqual(expected, actual);
        }
コード例 #4
0
        public void Given_Emptymood_Using_CustomException_Return_Empty()
        {
            //Arrange
            MoodToAnalyse mood     = new MoodToAnalyse("");
            string        expected = "Mood should not be empty";

            try
            {
                //Act
                string actual = mood.Analyser();
            }
            catch (MoodAnalyserException exception)
            {
                //Assert
                Assert.AreEqual(expected, exception.Message);
            }
        }