示例#1
0
        private void CheckValuesWithinTolerance(string methodName, params object[] expected)
        {
            MethodInfo      method = GetType().GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Instance);
            ParameterInfo   param  = method.GetParameters()[0];
            ValuesAttribute attr   = param.GetCustomAttributes(typeof(ValuesAttribute), false)[0] as ValuesAttribute;

            Assert.That(attr.GetData(param), Is.EqualTo(expected).Within(0.000001));
        }
示例#2
0
        private void CheckValues(string methodName, params object[] expected)
        {
            MethodInfo      method = GetType().GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Instance);
            ParameterInfo   param  = method.GetParameters()[0];
            ValuesAttribute attr   = param.GetCustomAttributes(typeof(ValuesAttribute), false)[0] as ValuesAttribute;

            Assert.That(attr.GetData(new ParameterWrapper(new MethodWrapper(GetType(), method), param)), Is.EqualTo(expected));
        }
示例#3
0
        private static string GenerateEventValues(EventInfo eventInfo)
        {
            string values = "";

            ValuesAttribute valuesAttr = eventInfo.GetCustomAttribute <ValuesAttribute>();

            if (valuesAttr != null)
            {
                values += "[Values(\"" + valuesAttr.Name + "\")]\n";
            }

            return(values);
        }
示例#4
0
        private static string GenerateActionValues(MethodInfo method)
        {
            string values = "";

            ValuesAttribute valuesAttr = method.GetCustomAttribute <ValuesAttribute>();

            if (valuesAttr != null)
            {
                values += "[Values(\"" + valuesAttr.Name + "\")]\n";
            }

            return(values);
        }
示例#5
0
        private static string GenerateSetterValues(PropertyInfo property)
        {
            string values = "";

            ValuesAttribute valuesAttr = property.GetCustomAttribute <ValuesAttribute>();

            if (valuesAttr != null)
            {
                values += "[Values(\"" + valuesAttr.Name + "\")]\n";
            }

            return(values);
        }