예제 #1
0
        public Func <ITestContext, InterfaceData[]> GetInheritedInterfaces(ITestInterfaceGenerationOptions options, int count)
        {
            return(context =>
            {
                var interfaces = Enumerable.Range(context.NextId(), count).Select(_ => GetInheritedInterfaceData(_, context)).ToArray();
                foreach (var @interface in interfaces)
                {
                    var namespaceData = new NamespaceData(@interface.Namespace, @interface);
                    var compilationEntryData = new CompilationEntryData(options.UsingNamespaces, namespaceData);
                    context.AddCompilationEntry(compilationEntryData);
                }

                return interfaces;
            });
        }
        public IEnumerable <Func <ITestContext, IEnumerable <AttributeData> > > GetPossibleCombinations(ITestInterfaceGenerationOptions options)
        {
            var attributeToInheritInterfacesNumbers = Enumerable.Range(0, 2);

            foreach (var attributeToInheritInterfacesNumber in attributeToInheritInterfacesNumbers)
            {
                yield return(context =>
                {
                    var interfacesToInherit = Enumerable.Range(context.NextId(), attributeToInheritInterfacesNumber)
                                              .Select(GetBaseTypeInterfaceData).ToArray();

                    foreach (var interfaceToInherit in interfacesToInherit)
                    {
                        var namespaceData = new NamespaceData(interfaceToInherit.Namespace, interfaceToInherit);
                        var compilationEntryData = new CompilationEntryData(options.UsingNamespaces, namespaceData);
                        context.AddCompilationEntry(compilationEntryData);
                    }

                    return new AttributeData[] { new LoggerInterfaceAttributeData(interfacesToInherit) };
                });
            }
        }