/* [DeploymentItem("TestAssembly.xml")] -- once is enough */ public void MethodBaseDocumenterTestTest1() { var c = typeof(WrongTableClass); var constructor = c.GetConstructors()[0]; var documenter = new MethodBaseDocumenter(constructor); Assert.AreEqual( "WrongTableClass is a fixture with a wrong Table or Query Signature, so should not be recognized as table. Class with a wrong Table/Query signature, so only supports Script and Decision", documenter.ConstructorDocumentation); }
/// <summary>Add a documentation row of all constructors of the given type to the result list</summary> /// <remarks>Part of the Template pattern for DoTable</remarks> protected override void AddToList(List <object> result, Type type) { Debug.Assert(result != null, "result != null"); foreach (var constructor in type.GetConstructors()) { var documenter = new MethodBaseDocumenter(constructor); var resultEntry = documenter.Parameters; var deprecatedMessage = documenter.DeprecationMessage; var documentation = documenter.ConstructorDocumentation; documentation = string.Empty + deprecatedMessage + documentation; result.Add(Row(type.Namespace, type.Name, resultEntry, SupportedTables(type), documentation)); } }
/// <param name="type">the fixture type to inspect</param> /// <returns>a list of FitNesse tables that the type supports</returns> internal static IList <string> SupportedTables(Type type) { var tables = new List <string>(); tables = MethodBaseDocumenter.RelevantMethods(type) .Select(methodInfo => new FixtureDocumenter(methodInfo)) .Aggregate(tables, (current, method) => current.Union(method.TablesSupported).ToList()); // no sense reporting the presence of optional methods here. if the mandatory ones are there, we report it, and if not we don't. tables.Remove("Decision-Optional"); tables.Remove("Query-Optional"); tables.Sort(); return(tables); }
/// <summary>Add a documentation row of all constructors of the given type to the result list</summary> /// <remarks>Part of the Template pattern for DoTable</remarks> protected override void AddToList(List <object> result, Type type) { foreach (var methodInfo in MethodBaseDocumenter .RelevantMethods(type) .OrderBy(method => RealName(method.Name))) { var methodHelper = new FixtureDocumenter(methodInfo); var deprecationMessage = methodHelper.DeprecationMessage; var documentation = methodHelper.MethodBaseDocumentation; documentation = string.Empty + deprecationMessage + documentation; var scope = methodHelper.Scope; if (string.IsNullOrEmpty(documentation) && scope.Contains("internal")) { documentation = "[Internal use only. Do not use in tests]"; } result.Add(Row(type, scope, methodInfo, methodHelper, documentation)); } }