Esempio n. 1
0
        public void GeneratesTheRightType(IDataGenerator dg)
        {
            dg.NullProbability = 0;
            // generate row
            DataRow row = dg.Column.Table.NewRow();

            dg.GenerateData(row);
            Assert.IsFalse(row.HasErrors);
            // check that value has the right type
            ReflectionAssert.IsAssignableFrom(dg.GeneratedType, row[dg.Column].GetType());
        }
Esempio n. 2
0
        public static void CheckSignature(MethodInfo mi, Type returnType)
        {
            if (mi == null)
            {
                throw new ArgumentNullException("mi");
            }
            if (returnType == null)
            {
                throw new ArgumentNullException("returnType");
            }

            ReflectionAssert.IsAssignableFrom(returnType, mi.ReturnType);
            ParameterInfo[] pis = mi.GetParameters();
            Assert.AreEqual(pis.Length, 0);
        }
Esempio n. 3
0
        public void Check(MethodInfo method)
        {
            if (method == null)
            {
                throw new ArgumentNullException("method");
            }

            try
            {
                ReflectionAssert.IsAssignableFrom(this.returnType, method.ReturnType);
                ParameterInfo[] pis = method.GetParameters();
                Assert.AreEqual(this.parameters.Length, pis.Length,
                                "Parameters count are not equal");
                for (int i = 0; i < pis.Length; ++i)
                {
                    Assert.AreEqual(this.parameters[i], pis[i].ParameterType,
                                    "Parameter {0} is not of the same type");
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Invalid method signature", ex);
            }
        }
Esempio n. 4
0
 public void StringIsNotAssignableFromObject()
 {
     ReflectionAssert.IsAssignableFrom(typeof(string), typeof(Object));
 }
Esempio n. 5
0
 public void ObjectIsAssignableFromString()
 {
     ReflectionAssert.IsAssignableFrom(typeof(Object), typeof(string));
 }