示例#1
0
        public void GivenMoodAnalyseClassName_ShouldReturnMoodAnalyseObject_UsingParameterizedConstructor()
        {
            object expected = new MoodAnalyser("HAPPY");
            object obj      = MoodAnalyserFactory.CreateMoodAnalyseUsingParameterizedConstructor("MoodAnalyserAppWithCore.MoodAnalyser", "MoodAnalyser", "SAD");

            expected.Equals(obj);
        }
示例#2
0
        public void GivenMoodAnalyser_WhenAnalysed_UsingParameterizedConstructor_ShouldReturnMoodAnalyserObject()
        {
            object expected = new MoodAnalyser();
            object actual   = MoodAnalyserFactory.CreateObjectOfMoodAnalyserUsingParameterizedConstructor("MoodAnalyserApp.MoodAnalyser", "MoodAnalyser", "Happy");

            Assert.AreEqual(expected.GetType(), actual.GetType());
        }
示例#3
0
        public void GivenMoodAnalyserClassName_WhenAnalysed_ShouldReturn_MoodAnalyserObject()
        {
            object expected = new MoodAnalyser();
            object actual   = MoodAnalyserFactory.MoodAnalyseObjectCreation("MoodAnalyserApp.MoodAnalyser", "MoodAnalyser");

            Assert.AreEqual(expected.GetType(), actual.GetType());
        }
示例#4
0
        public void GivenMoodAnalyseClass_ShouldReturn_MoodAnalyserObject_UsingParameterizedConstrucor(string message)
        {
            object expected = new MoodAnalyser(message);
            object obj      = MoodAnalyzerFactory.CreateMoodAnalyserUsingParameterisedConstructors("MoodAnalyserProblem2.MoodAnalyser", "MoodAnalyser", message);

            expected.Equals(obj);
        }
示例#5
0
        public void Given_MoodAnalyserClassName_Should_ReturnMoodAnalyserObject_usingParameterisedConstructor()
        {
            object expected = new MoodAnalyser("HAPPY");
            object actual   = MoodAnalyserFactory.CreateMoodAnalyserUsingParameterizedConstructor("MoodAnalyserApp.MoodAnalyser", "MoodAnalyser", "SAD");

            Assert.AreEqual(expected.GetType(), actual.GetType());
        }
示例#6
0
        public void AnalyseMood_WhenSadReturnSad()
        {
            MoodAnalyser moodobj  = new MoodAnalyser("I am in sad mood");
            string       Expected = "SAD";

            Assert.AreEqual(Expected, moodobj.AnalyseMood());
        }
示例#7
0
        public void GivenMoodAnalyseClassName_ShouldReturnMoodAnalyseObject()
        {
            object expected = new MoodAnalyser();
            object obj      = MoodAnalyseFactory.CreateMoodAnalyserObject("MoodAnalyse.MoodAnalyser", "MoodAnalyser");

            expected.Equals(obj);
        }
示例#8
0
        public void AnalyseMood_WhenHappyMoodReturnHappy()
        {
            MoodAnalyser moodobj  = new MoodAnalyser("I am in happy mood");
            string       Expected = "HAPPY";

            Assert.AreEqual(Expected, moodobj.AnalyseMood());
        }
示例#9
0
        static void Main(string[] args)
        {
            MoodAnalyser mood = new MoodAnalyser("sad");

            mood.analyseMoodLive1();
            Console.ReadKey();
        }
示例#10
0
        public void whenMood_IsSad_ShouldReturnSad()
        {
            MoodAnalyser moodAnalyser = new MoodAnalyser();
            string       mood         = moodAnalyser.analyseMood("I am in sad Mood");

            Assert.AreEqual("SAD", mood);
        }
示例#11
0
        public void whenMood_IsHappy_ShouldReturnHappy()
        {
            MoodAnalyser moodAnalyser = new MoodAnalyser();
            string       mood         = moodAnalyser.analyseMood("I am in happy Mood");

            Assert.AreEqual("HAPPY", mood);
        }
示例#12
0
        public void Given_MoodAnalyserClassName_Should_ReturnMoodAnalyserObject()
        {
            string message  = null;
            object expected = new MoodAnalyser(message);
            object actual   = MoodAnalyserFactory.MoodAnalyseObjectCreation("MoodAnalyserApp.MoodAnalyser", "MoodAnalyser");

            Assert.AreEqual(expected.GetType(), actual.GetType());
        }
示例#13
0
        public void GivenMoodAnalyseClassName_ShouldReturnMoodAnalyseObject()
        {
            string message  = null;
            object expected = new MoodAnalyser(message);
            object obj      = MoodAnalyserFactory.CreateMoodAnalyser("MoodAnalyserAppWithCore.MoodAnalyser", "MoodAnalyser");

            expected.Equals(obj);
        }
示例#14
0
        public void Given_Happy_MoodAnalyser_Should_Return_Happy()
        {
            //Arrange
            MoodAnalyser moodAnalyse = new MoodAnalyser("I am in a Happy mood");
            //Act
            string mood = moodAnalyse.AnalyseMood();

            //Assert
            Assert.AreEqual("HAPPY", mood);
        }
示例#15
0
        public void Given_Sad_MoodAnalyser_Should_Return_Sad()
        {
            //Arrange
            MoodAnalyser moodAnalyse = new MoodAnalyser("I am in a Sad mood");
            //Act
            string mood = moodAnalyse.AnalyseMood();

            //Assert
            Assert.AreEqual("SAD", mood);
        }
示例#16
0
        public void GivenSadMessage_WhenAnalysed_ShouldReturnSadMood()
        {
            //Arrange
            MoodAnalyser analyser = new MoodAnalyser("I am in a Sad mood");
            //Act
            string mood = analyser.AnalyseMood();

            //Assert
            Assert.AreEqual("Sad", mood);
        }
示例#17
0
        public void GivenHappyMessage_WhenAnalysed_ShouldReturnHappyMood()
        {
            //Arrange
            MoodAnalyser analyser = new MoodAnalyser("I am in a Happy mood");
            //Act
            string mood = analyser.AnalyseMood();

            //Assert
            Assert.AreEqual("Happy", mood);
        }
示例#18
0
        public void GivenSadMessage_WhenSad_ShouldReturnSAD()
        {
            //Arrange
            string       Expected     = "SAD";
            MoodAnalyser moodAnalyser = new MoodAnalyser("I am in Sad Mood");
            //Act
            string result = moodAnalyser.AnalyseMood();

            //Assert
            Assert.AreEqual(Expected, result);
        }
示例#19
0
        public void GivenNULLMessage_WhenANULL_ShouldReturnHAPPY(string message)
        {
            //Arrange
            string       Expected     = "Happy";
            MoodAnalyser moodAnalyser = new MoodAnalyser(message);
            //Act
            string result = moodAnalyser.AnalyseMood();

            //Assert
            Assert.AreEqual(Expected, result);
        }
示例#20
0
        public void Given_HappyMoodMessage_Should_Return_HAPPY()
        {
            ///Arrange
            string       expected     = "HAPPY";
            MoodAnalyser moodAnalyser = new MoodAnalyser("i am very happy".ToUpper());
            ///Act
            string mood = moodAnalyser.AnalyseMood();

            ///Assert
            Assert.AreEqual(expected, mood);
        }
示例#21
0
        public void Given_SadMoodMessage_Should_Return_SAD()
        {
            ///Arrange
            string       expected     = "SAD";
            MoodAnalyser moodAnalyser = new MoodAnalyser("i am very sad".ToUpper());
            ///Act
            string mood = moodAnalyser.AnalyseMood();

            ///Assert
            Assert.AreEqual(expected, mood);
        }
示例#22
0
        public void GivenAnyMessage_WhenAnyMood_ShouldReturnHAPPY()
        {
            //Arrange
            string       Expected     = "HAPPY";
            MoodAnalyser moodAnalyser = new MoodAnalyser("I am in Any Mood");
            //Act
            string result = moodAnalyser.AnalyseMood();

            //Assert
            Assert.AreEqual(Expected, result);
        }
示例#23
0
        public void Given_MoodAnalyser_Class_Name_Should_Return_MoodAnalyser_Object_Using_Parametrized_Constructor()
        {
            //Arrange
            string       className       = "MoodAnalyse.MoodAnalyser";
            string       constructorName = "MoodAnalyser";
            MoodAnalyser expectedObj     = new MoodAnalyser("HAPPY");
            //Act
            object resultObj = MoodAnalyseFactory.CreateMoodAnalyserUsingParameterizedConstructor(className, constructorName, "HAPPY");

            //Assert
            expectedObj.Equals(resultObj);
        }
示例#24
0
 public void Given_ImproperClassName_MoodAnalyserFactoryWithParameterisedConstructor_Should_ThrowMoodAnalysisException_NO_SUCH_CLASS()
 {
     try
     {
         object expected = new MoodAnalyser();
         object actual   = MoodAnalyserFactory.CreateMoodAnalyserUsingParameterizedConstructor("WrongClass", "MoodAnalyser", "SAD");
     }
     catch (MoodAnalyserCustomException e)
     {
         Assert.AreEqual("No such class found", e.Message);
     }
 }
示例#25
0
 public void GivenImproperConstructorName_WhenAnalyse_ShouldThrowMoodAnalysisException()
 {
     try
     {
         object expected = new MoodAnalyser();
         object actual   = MoodAnalyserFactory.MoodAnalyseObjectCreation("Mood", "MoodAnalyser");
     }
     catch (MoodAnalyserCustomException e)
     {
         Assert.AreEqual("Constructor not found", e.Message);
     }
 }
示例#26
0
 public void GivenImproperClassName_WhenAnalyse_ShouldThrowMoodAnalysisException()
 {
     try
     {
         object expected = new MoodAnalyser();
         object actual   = MoodAnalyserFactory.MoodAnalyseObjectCreation("abc", "abc");
     }
     catch (MoodAnalyserCustomException e)
     {
         Assert.AreEqual("No such class found", e.Message);
     }
 }
示例#27
0
 public void Given_ImproperConstructorName_MoodAnalyserFactoryWithParameterisedConstructor_Should_ThrowMoodAnalysisException_NO_SUCH_METHOD()
 {
     try
     {
         object expected = new MoodAnalyser();
         object actual   = MoodAnalyserFactory.CreateMoodAnalyserUsingParameterizedConstructor("MoodAnalyserApp.MoodAnalyser", "WrongConstructor", "HAPPY");
     }
     catch (MoodAnalyserCustomException e)
     {
         Assert.AreEqual("No such Constructor found", e.Message);
     }
 }
示例#28
0
 public void GivenImproperConstructorName_WhenAnalyse_UsingParameterisedConstructor_ShouldThrowMoodAnalysisException()
 {
     try
     {
         object expected = new MoodAnalyser();
         object actual   = MoodAnalyserFactory.CreateObjectOfMoodAnalyserUsingParameterizedConstructor("MoodAnalyserApp.MoodAnalyser", "Mood", "Happy");
     }
     catch (MoodAnalyserCustomException e)
     {
         Assert.AreEqual("Constructor not found", e.Message);
     }
 }
示例#29
0
 public void Given_ImproperClassName_Should_Throw_MoodAnalysisException_NO_SUCH_CLASS()
 {
     try
     {
         object expected = new MoodAnalyser();
         object actual   = MoodAnalyserFactory.MoodAnalyseObjectCreation("WrongClass", "MoodAnalyser");
     }
     catch (MoodAnalyserCustomException e)
     {
         Assert.AreEqual("No such class found", e.Message);
     }
 }
示例#30
0
 public void Given_ImproperConstructorName_Should_Throw_MoodAnalysisException_NO_SUCH_METHOD()
 {
     try
     {
         object expected = new MoodAnalyser();
         object actual   = MoodAnalyserFactory.MoodAnalyseObjectCreation("WrongConstructor", "WrongConstructor");
     }
     catch (MoodAnalyserCustomException e)
     {
         Assert.AreEqual("No such Constructor found", e.Message);
     }
 }