private static XunitTest CreateMethodTest(XunitTypeInfoAdapter typeInfo, XunitMethodInfoAdapter methodInfo) { XunitTest methodTest = new XunitTest(methodInfo.Name, methodInfo.Target, typeInfo, methodInfo); methodTest.Kind = TestKinds.Test; methodTest.IsTestCase = true; // Add skip reason. if (XunitMethodUtility.IsSkip(methodInfo)) { string skipReason = XunitMethodUtility.GetSkipReason(methodInfo); if (skipReason != null) { methodTest.Metadata.SetValue(MetadataKeys.IgnoreReason, skipReason); } } // Add traits. if (XunitMethodUtility.HasTraits(methodInfo)) { XunitMethodUtility.GetTraits(methodInfo).ForEach((key, value) => methodTest.Metadata.Add(key ?? @"", value ?? @"")); } // Add XML documentation. string xmlDocumentation = methodInfo.Target.GetXmlDocumentation(); if (xmlDocumentation != null) { methodTest.Metadata.SetValue(MetadataKeys.XmlDocumentation, xmlDocumentation); } return(methodTest); }
/// <summary> /// Initializes a test initially without a parent. /// </summary> /// <param name="name">The name of the component.</param> /// <param name="codeElement">The point of definition, or null if none.</param> /// <param name="typeInfo">The Xunit test type information.</param> /// <param name="methodInfo">The Xunit test method information, or null if none.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="name"/> or <paramref name="typeInfo"/> is null.</exception> public XunitTest(string name, ICodeElementInfo codeElement, XunitTypeInfoAdapter typeInfo, XunitMethodInfoAdapter methodInfo) : base(name, codeElement) { if (typeInfo == null) throw new ArgumentNullException(@"typeInfo"); this.typeInfo = typeInfo; this.methodInfo = methodInfo; }
/// <summary> /// Initializes a test initially without a parent. /// </summary> /// <param name="name">The name of the component.</param> /// <param name="codeElement">The point of definition, or null if none.</param> /// <param name="typeInfo">The Xunit test type information.</param> /// <param name="methodInfo">The Xunit test method information, or null if none.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="name"/> or <paramref name="typeInfo"/> is null.</exception> public XunitTest(string name, ICodeElementInfo codeElement, XunitTypeInfoAdapter typeInfo, XunitMethodInfoAdapter methodInfo) : base(name, codeElement) { if (typeInfo == null) { throw new ArgumentNullException(@"typeInfo"); } this.typeInfo = typeInfo; this.methodInfo = methodInfo; }
private static XunitTest CreateMethodTest(XunitTypeInfoAdapter typeInfo, XunitMethodInfoAdapter methodInfo) { XunitTest methodTest = new XunitTest(methodInfo.Name, methodInfo.Target, typeInfo, methodInfo); methodTest.Kind = TestKinds.Test; methodTest.IsTestCase = true; // Add skip reason. if (XunitMethodUtility.IsSkip(methodInfo)) { string skipReason = XunitMethodUtility.GetSkipReason(methodInfo); if (skipReason != null) methodTest.Metadata.SetValue(MetadataKeys.IgnoreReason, skipReason); } // Add traits. if (XunitMethodUtility.HasTraits(methodInfo)) { XunitMethodUtility.GetTraits(methodInfo).ForEach((key, value) => methodTest.Metadata.Add(key ?? @"", value ?? @"")); } // Add XML documentation. string xmlDocumentation = methodInfo.Target.GetXmlDocumentation(); if (xmlDocumentation != null) methodTest.Metadata.SetValue(MetadataKeys.XmlDocumentation, xmlDocumentation); return methodTest; }