示例#1
0
        public override IEnumerable <object[]> GetData(MethodInfo testMethod)
        {
            if (testMethod.ReflectedType == null)
            {
                return(new List <object[]>());
            }

            var fields = FieldHelper.GetFields(testMethod.ReflectedType);

            return(fields.First(x => x.Key.Name == "then").Value.Select(f => new[] { f.Name }));
        }
示例#2
0
        public void Run(string then)
        {
            var context = new T();

            var fields = FieldHelper.GetFields(GetType());

            fields[typeof(given)].ToList().ForEach(x => ((given)x.GetValue(this)).Invoke(context));
            fields[typeof(when)].ToList().ForEach(x => ((when)x.GetValue(this)).Invoke(context));
            var currentThen = (then)fields[typeof(then)].First(x => x.Name == then).GetValue(this);

            currentThen.Invoke(context);
        }