static bool OnTestStart(ITestCommand command, ExecutorCallback callback) { XmlNode node = command.ToStartXml(); if (node != null) callback.Notify(node.OuterXml); return callback.ShouldContinue(); }
static bool OnTestStart(ITestCommand command, ExecutorCallback callback) { XmlNode node = command.ToStartXml(); if (node != null) { callback.Notify(node.OuterXml); } return(callback.ShouldContinue()); }
static bool OnTestResult(ITestResult result, ExecutorCallback callback) { XmlDocument doc = new XmlDocument(); doc.LoadXml("<foo/>"); XmlNode node = result.ToXml(doc.ChildNodes[0]); if (node != null) callback.Notify(node.OuterXml); return callback.ShouldContinue(); }
static bool OnTestResult(ITestResult result, ExecutorCallback callback) { XmlDocument doc = new XmlDocument(); doc.LoadXml("<foo/>"); XmlNode node = result.ToXml(doc.ChildNodes[0]); if (node != null) { callback.Notify(node.OuterXml); } return(callback.ShouldContinue()); }
public AssemblyTestCount(Executor executor, object _handler) { ExecutorCallback handler = ExecutorCallback.Wrap(_handler); int result = 0; foreach (Type type in executor.assembly.GetExportedTypes()) { ITestClassCommand testClassCommand = TestClassCommandFactory.Make(type); if (testClassCommand != null) { foreach (IMethodInfo method in testClassCommand.EnumerateTestMethods()) { result++; } } } handler.Notify(result.ToString()); }
public EnumerateTests(Executor executor, object _handler) { ExecutorCallback handler = ExecutorCallback.Wrap(_handler); XmlDocument doc = new XmlDocument(); doc.LoadXml("<dummy/>"); XmlNode assemblyNode = XmlUtility.AddElement(doc.ChildNodes[0], "assembly"); XmlUtility.AddAttribute(assemblyNode, "name", executor.assemblyFilename); foreach (Type type in executor.assembly.GetExportedTypes()) { ITestClassCommand testClassCommand = TestClassCommandFactory.Make(type); if (testClassCommand != null) { string typeName = type.FullName; XmlNode classNode = XmlUtility.AddElement(assemblyNode, "class"); XmlUtility.AddAttribute(classNode, "name", typeName); foreach (IMethodInfo method in testClassCommand.EnumerateTestMethods()) { string methodName = method.Name; string displayName = null; foreach (IAttributeInfo attr in method.GetCustomAttributes(typeof(FactAttribute))) { displayName = attr.GetPropertyValue <string>("Name"); } XmlNode methodNode = XmlUtility.AddElement(classNode, "method"); XmlUtility.AddAttribute(methodNode, "name", displayName ?? typeName + "." + methodName); XmlUtility.AddAttribute(methodNode, "type", typeName); XmlUtility.AddAttribute(methodNode, "method", methodName); string skipReason = MethodUtility.GetSkipReason(method); if (skipReason != null) { XmlUtility.AddAttribute(methodNode, "skip", skipReason); } var traits = MethodUtility.GetTraits(method); if (traits.Count > 0) { XmlNode traitsNode = XmlUtility.AddElement(methodNode, "traits"); traits.ForEach((name, value) => { XmlNode traitNode = XmlUtility.AddElement(traitsNode, "trait"); XmlUtility.AddAttribute(traitNode, "name", name); XmlUtility.AddAttribute(traitNode, "value", value); }); } } } } handler.Notify(assemblyNode.OuterXml); }