Exemple #1
0
        private static Attribute[] GetAttributes(XUnitTheory theory)
        => theory == null
            ? new Attribute[]
        {
            XUnitAttributes.Fact()
        }

            : GetTheoryAttributes(theory).ToArray();
Exemple #2
0
 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));
Exemple #3
0
        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));
            }
        }
Exemple #4
0
 public static AttributeListCollection Create(XUnitTheory theory)
 => AttributeLists.Create(GetAttributes(theory));
Exemple #5
0
 public static ParameterList Create(XUnitTheory theory)
 => !Any(theory?.Parameters) ? null
     : ParameterLists.Create(
     GetParameters(theory.Parameters).ToArray());