/// <summary> /// Sets up the feature lookup, if it has not been already. /// </summary> private void SetupFeatureLookup() { if (!IndexMode) { int i = 0; foreach (DataRow dr in _attributeTable.Table.Rows) { Features[i].DataRow = dr; if (FeatureLookup.ContainsKey(dr)) { FeatureLookup[dr] = Features[i]; } else { FeatureLookup.Add(dr, Features[i]); } i++; } } }
private static void Run() { var generator = new Generator("AutoGen", new CSharpSolutionExplorer()); var analyzers = new FeatureLookup( @"C:\Dev\Aikixd.CodeGeneration\Aikixd.CodeGeneration.TestSolution.sln", new IFeatureQuery[] { /*new TypeQuery( * new TypeAttributeSearchPattern<SerializableAttribute>(), * new TypeGeneration("serialized", TestSerialized)), * * new TypeQuery( * new TypeAttributeSearchPattern<DetectAttribute>(), * new TypeGeneration("detect", TestSymbol)), * * new TypeQuery( * new TypeAttributeSearchPattern<TestPropertiesAttribute>(), * new TypeGeneration("testprops", TestProperties)), * * new TypeQuery( * new TypeAttributeSearchPattern<RecursiveAttribute>(), * new TypeGeneration("rec", TestRecursive)), * * new TypeQuery( * new TypeAttributeSearchPattern<ArrayArgAttribute>(), * new TypeGeneration("arrayarg", TestArrayArg)), * * new TypeQuery( * new TypeAttributeSearchPattern<TypeAttribute>(), * new TypeGeneration("type", TestType)),*/ new TypeQuery( new TypeAttributeSearchPattern <TestAttribute>(), new TypeGeneration("test", RouteTest)), /* * new TypeQuery( * new TypeAttributeSearchPattern<CombinedAttribute>(), * new [] { * new TypeGeneration("combined.serializzed", TestSerialized), * new TypeGeneration("combined.arrayarg", TestArrayArg) * }) */ }); var nfos = analyzers.GenerateInfo(); RunFirstOrderTests(); #if DEBUG var g = nfos .SelectMany(x => x.FileGeneration) .GroupBy(x => x.Name + "." + x.Group.Modifier); if (g.Any(x => x.Count() > 1)) { var group = g.First(x => x.Count() > 1); var allGroups = g.Where(x => x.Count() > 1).ToArray(); Debug.Fail($"More than one generation exist for file {group.Key}."); } #endif generator.Generate(nfos); // TODO: check trough reflection that all tests have run. Console.Write(testResults.ToString()); Console.WriteLine(failedTests ? "Has failed tests." : "All tests passed."); Console.ReadKey(); }