private static Attribute[] GetAttributes(XUnitTheory theory) => theory == null ? new Attribute[] { XUnitAttributes.Fact() } : GetTheoryAttributes(theory).ToArray();
public static Method Create( string name, IEnumerable <Statement> arrange, IEnumerable <Statement> act, IEnumerable <Statement> assert, XUnitTheory theory = null, bool isAsync = false) => new Method( name, GetType(isAsync), XUnitTestParameters.Create(theory), XUnitTestBlocks.Create(arrange, act, assert), GetModifiers(isAsync), attributes: XUnitTestAttributes.Create(theory));
private static IEnumerable <Attribute> GetTheoryAttributes(XUnitTheory theory) { yield return(XUnitAttributes.Theory()); var memberData = theory.MemberDataNameOfLiteral; if (!string.IsNullOrWhiteSpace(memberData)) { yield return(XUnitAttributes.MemberData(memberData)); yield break; } foreach (var literal in theory.InlineDataLiterals) { yield return(XUnitAttributes.InlineData(literal)); } }
public static AttributeListCollection Create(XUnitTheory theory) => AttributeLists.Create(GetAttributes(theory));
public static ParameterList Create(XUnitTheory theory) => !Any(theory?.Parameters) ? null : ParameterLists.Create( GetParameters(theory.Parameters).ToArray());