Esempio n. 1
0
        public void compareDefaultConstructor()
        {
            analyseMoodFactory <analyseMood> mood = new analyseMoodFactory <analyseMood>();
            ConstructorInfo constructor           = mood.defaultConstructor();
            object          obj_compare           = mood.GetInstance("analyseMood", constructor);

            Assert.IsInstanceOf(typeof(analyseMood3), obj_compare);
        }
Esempio n. 2
0
 public void SetNullField_throwException()
 {
     try
     {
         analyseMoodFactory <analyseMood3> mood = new analyseMoodFactory <analyseMood3>();
         Assert.AreEqual("Null_Exception", mood.InvokeMethodUsing("analyseMood3", null));
     }
     catch (NullReferenceException e)
     {
         _ = e.StackTrace;
     }
 }
Esempio n. 3
0
 public void reflectionNoSuchMethoEception()
 {
     try
     {
         analyseMoodFactory <analyseMood> mood = new analyseMoodFactory <analyseMood>();
         ConstructorInfo constructor           = mood.defaultConstructor();
         object          obj_compare           = mood.GetInstance("analyseMood", constructor);
     }
     catch (analyseMoodException e)
     {
         Assert.AreEqual(analyseMoodException.Exception_Type.No_Such_Method_Exception, e.ex_ty);
     }
 }
Esempio n. 4
0
 public void InvokemethodUsingReflection_returnHappy()
 {
     try
     {
         analyseMoodFactory <string> mood = new analyseMoodFactory <string>();
         string result = mood.InvokeMethodUsingReflection();
         Assert.AreEqual(result, "Happy");
     }
     catch (NullReferenceException e)
     {
         _ = e.StackTrace;
     }
 }
Esempio n. 5
0
 public void UsingParmConstructor_NoSuchMethod()
 {
     try
     {
         analyseMoodFactory <analyseMood3> mood = new analyseMoodFactory <analyseMood3>();
         ConstructorInfo constructor            = mood.defaultConstructor();
         object          obj_compare            = mood.GetParameterizedInstance("analyseMood3", constructor, "I am in sad mood");
     }
     catch (analyseMoodException e)
     {
         Assert.AreEqual(analyseMoodException.Exception_Type.No_Such_Method_Exception, e.ex_ty);
     }
 }
Esempio n. 6
0
 public void UsingParmConstructor_noSuchClassException()
 {
     try
     {
         analyseMoodFactory <analyseMood3> mood = new analyseMoodFactory <analyseMood3>();
         ConstructorInfo constructor            = mood.defaultConstructor(1);
         object          obj_compare            = mood.GetParameterizedInstance("analyseMood3", constructor, "i am happy");
     }
     catch (analyseMoodException e)
     {
         Assert.AreEqual(analyseMoodException.Exception_Type.No_Such_Class_Exception, e.ex_ty);
     }
 }
Esempio n. 7
0
 public void SetImproperField_throwException()
 {
     try
     {
         analyseMoodFactory <analyseMood3> mood = new analyseMoodFactory <analyseMood3>();
         string actual   = mood.InvokeMethodUsing("analyseMood3", "inproper field name");
         string Expected = "No_Such_Field_Exception";
         Assert.AreEqual(Expected, actual);
     }
     catch (NullReferenceException e)
     {
         _ = e.StackTrace;
     }
 }
Esempio n. 8
0
 public void SetFieldValue_shouldReturnHappy()
 {
     try
     {
         analyseMoodFactory <analyseMood3> mood = new analyseMoodFactory <analyseMood3>();
         string actual   = mood.InvokeMethodUsing("analyseMood3", "message");
         string Expected = "HAPPY";
         Assert.AreEqual(Expected, actual);
     }
     catch (NullReferenceException e)
     {
         _ = e.StackTrace;
     }
 }
Esempio n. 9
0
 public void CompareObj_UsingParmeterConstructor()
 {
     analyseMoodFactory <analyseMood3> mood = new analyseMoodFactory <analyseMood3>();
     ConstructorInfo constructor            = mood.defaultConstructor(1);
     object          obj_compare            = mood.GetParameterizedInstance("analyseMood3", constructor, "I am in sad mood");
 }