private static TestModel Create(Type fixture, MethodInfo test, FactAttribute fact) { var name = TestName(fixture, test); TestModel Create(TestModel.Test body) => TestModel.Create(name, body, fact.ExpectAssertionException); TestModel Error(string msg) => throw new Exception(msg); if (test.GetGenericArguments().Length > 0) { return(Error("Test method cannot be generic")); } if (test.GetParameters().Length > 0) { return(Error("Test method cannot have parameters")); } return(Create(s => { var fixtureInstance = CreateFixture(fixture, s); test.Invoke(fixtureInstance); })); }
public Fact(MethodInfo method, FactAttribute attribute) { Method = method; Attribute = attribute; }