Esempio n. 1
0
        private IEnumerable <string> GetUsings(ClassDeclarationSyntax node)
        {
            if (node != null)
            {
                var isTest = node.Annotations.EmptyIfNull().Any(a => a?.IsTest ?? false);
                if (!isTest)
                {
                    var testMethods =
                        from method in node.Members.EmptyIfNull().OfType <MethodDeclarationSyntax>()
                        from ann in method.Annotations.EmptyIfNull()
                        where ann?.IsTest ?? false
                        select method;

                    isTest = testMethods.Any();
                }

                if (isTest)
                {
                    return(Usings.Concat(UnitTestUsings));
                }
            }

            return(Usings);
        }