public void Mood_Analyser_Contructor_Checker_Test() { string className = "MoodAnalyser"; MoodAnalyserFactory <MoodAnalyser> factory = new MoodAnalyserFactory <MoodAnalyser>(); ConstructorInfo constrInfo = factory.ConstructorCreator(); object instanceOfClass = factory.InstanceCreator(className, constrInfo); Assert.IsInstanceOf(typeof(MoodAnalyser), instanceOfClass); }
public void Mood_Analyser_Parameterised_Constructor_Check_Test() { string message = "here i am in sad mood"; string className = "MoodAnalyser"; MoodAnalyser analysis = new MoodAnalyser(message); MoodAnalyserFactory <MoodAnalyser> factory = new MoodAnalyserFactory <MoodAnalyser>(); ConstructorInfo constrInfo = factory.ConstructorCreator(1); object instanceOfClass = factory.InstanceCreator(className, constrInfo, message); Assert.IsInstanceOf(typeof(MoodAnalyser), instanceOfClass); }
public void Improper_Class_Haandeling_Test() { try { string imProperClassName = "Mood"; MoodAnalyserFactory <MoodAnalyser> factory = new MoodAnalyserFactory <MoodAnalyser>(); ConstructorInfo constrInfo = factory.ConstructorCreator(); object instanceOfClass = factory.InstanceCreator(imProperClassName, constrInfo); } catch (MoodAnalyserException e) { Assert.AreEqual(MoodAnalyserException.TypeOfException.NO_CLASS_FOUND, e.exceptionType); } }
public void Improper_Constructor_Haandeling_Test() { try { string constructorOfClass = "MoodAnalysis.MoodAnalyserException"; string className = "MoodAnalyser"; MoodAnalyserFactory <MoodAnalyser> factory = new MoodAnalyserFactory <MoodAnalyser>(); ConstructorInfo constrInfo = factory.ConstructorCreator(constructorOfClass); object instanceOfClass = factory.InstanceCreator(className, constrInfo); } catch (MoodAnalyserException e) { Assert.AreEqual(MoodAnalyserException.TypeOfException.NO_CONSTRUCTOR_FOUND, e.exceptionType); } }
public void Improper_Class_Name_For_Parametersed_Constructor_Test() { try { string message = "here i am in happy mood"; string imProperClassName = "Mood"; MoodAnalyser analysis = new MoodAnalyser(message); MoodAnalyserFactory <MoodAnalyser> factory = new MoodAnalyserFactory <MoodAnalyser>(); ConstructorInfo constrInfo = factory.ConstructorCreator(1); object instanceOfClass = factory.InstanceCreator(imProperClassName, constrInfo, message); } catch (MoodAnalyserException e) { Assert.AreEqual(MoodAnalyserException.TypeOfException.NO_CLASS_FOUND, e.exceptionType); } }