Exemplo n.º 1
0
 public MethodTester(string name, Object testedInstance, MethodInfo method, params Object[] parameters)
 {
     this.suite             = new TestSuite(name);
     this.testedInstance    = testedInstance;
     this.method            = method;
     this.parameterInfos    = method.GetParameters();
     this.parameters        = parameters;
     this.nullableAttribute = NullableAttributeAttribute.GetAttribute(method.DeclaringType);
 }
Exemplo n.º 2
0
 public MethodTester(string name, Object testedInstance, MethodInfo method, params Object[] parameters)
 {
     this.suite=new TestSuite(name);
     this.testedInstance=testedInstance;
     this.method = method;
     this.parameterInfos=method.GetParameters();
     this.parameters = parameters;
     this.nullableAttribute = NullableAttributeAttribute.GetAttribute(method.DeclaringType);
 }
        /// <summary>
        /// Returns the type of the <see cref="NullableAttributeAttribute"/> for the assembly containing the current method
        /// </summary>
        /// <param name="t">The class containing the method being tested</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="t"/> is null</exception>
        public static NullableAttributeAttribute GetAttribute(Type t)
        {
            if (t == null)
            {
                throw new ArgumentNullException("t");
            }
            Assembly a = t.Assembly;
            NullableAttributeAttribute attribute =
                (NullableAttributeAttribute)TypeHelper.TryGetFirstCustomAttribute(a, typeof(NullableAttributeAttribute));

            return(attribute);
        }