[Fat-develop] FAT/src/FAT.Core TestFixtureDescription.cs,NONE,1.1 FAT.Core.csproj,1.3,1.4 ITestFixtu
Brought to you by:
exortech
|
From: <dmc...@us...> - 2004-02-08 16:56:39
|
Update of /cvsroot/fat/FAT/src/FAT.Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21286/src/FAT.Core Modified Files: FAT.Core.csproj ITestFixtureLoader.cs TestFixtureLoader.cs Added Files: TestFixtureDescription.cs Log Message: Added TestFixtureDescription - paves the way for text fixture help page. --- NEW FILE: TestFixtureDescription.cs --- using System; using System.Collections; using System.Reflection; using System.Text.RegularExpressions; using System.Text; namespace FAT.Core { public class TestFixtureDescription { private string fixtureName; private Type type; public TestFixtureDescription(ITestFixtureLoader loader, string fixtureName) { this.fixtureName = fixtureName; type = loader.GetType(fixtureName); } public string Fixture { get { return fixtureName; }} public string Type { get { return type.FullName; }} public string []Methods { get { ArrayList methodDescriptions = new ArrayList(); for (Type currentType = type; currentType != typeof(object); currentType = currentType.BaseType) { foreach (MethodInfo methodInfo in currentType.GetMethods(BindingFlags.Public|BindingFlags.Instance|BindingFlags.DeclaredOnly)) { methodDescriptions.Add(ConvertToFATMethodName(methodInfo.Name) + GetMethodParameterNames(methodInfo.GetParameters())); } } return (string [])methodDescriptions.ToArray(typeof(string)); } } private string ConvertToFATMethodName(string methodName) { return methodName.Substring(0, 1) + Regex.Replace(methodName.Substring(1), "([A-Z])", " $1").ToLower().Trim(); } private string GetMethodParameterNames(ParameterInfo []parameterInfos) { return parameterInfos.Length == 0 ? string.Empty : ": " + String.Join(" ", GetMethodParameterNamesAsStringArray(parameterInfos)); } private string []GetMethodParameterNamesAsStringArray(ParameterInfo []parameterInfos) { string []names = new string[parameterInfos.Length]; for (int n = 0; n < parameterInfos.Length; n++) { names[n] = parameterInfos[n].Name; } return names; } } } Index: FAT.Core.csproj =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Core/FAT.Core.csproj,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FAT.Core.csproj 28 Jan 2004 22:14:47 -0000 1.3 --- FAT.Core.csproj 8 Feb 2004 16:53:23 -0000 1.4 *************** *** 203,206 **** --- 203,211 ---- /> <File + RelPath = "TestFixtureDescription.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "TestFixtureLoader.cs" SubType = "Code" Index: ITestFixtureLoader.cs =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Core/ITestFixtureLoader.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ITestFixtureLoader.cs 6 Feb 2004 20:27:31 -0000 1.2 --- ITestFixtureLoader.cs 8 Feb 2004 16:53:23 -0000 1.3 *************** *** 5,10 **** public interface ITestFixtureLoader { ! ITestFixture GetFixture(string story); string []GetFixtureNames(); } } --- 5,11 ---- public interface ITestFixtureLoader { ! ITestFixture GetFixture(string fixture); string []GetFixtureNames(); + Type GetType(string fixture); } } Index: TestFixtureLoader.cs =================================================================== RCS file: /cvsroot/fat/FAT/src/FAT.Core/TestFixtureLoader.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TestFixtureLoader.cs 7 Feb 2004 18:11:31 -0000 1.3 --- TestFixtureLoader.cs 8 Feb 2004 16:53:23 -0000 1.4 *************** *** 28,31 **** --- 28,36 ---- } + public Type GetType(string fixture) + { + return typeof(TestFileScanner); + } + private void VisitFixtures(IFixtureVisitor fixtureVisitor) { |