public void TestPythiaFullFile() { var f = new FileInfo("full-mcfile.root"); Assert.IsTrue(f.Exists, "input file is there"); var testit = new ParseTFile(); var r = testit.ParseFile(f).ToArray(); // This next line will throw if the classes have the same name. var classMap = r.ToDictionary(c => c.Name, c => c); Assert.IsFalse(r.Where(c => c.Items.Where(i => i.Name.Contains(":")).Any()).Any(), "Bad C# name in item name"); Assert.IsFalse(r.Where(c => c.Items.Where(i => i.ItemType.Contains(":")).Any()).Any(), "Bad C# name in item type"); Assert.IsFalse(r.Where(c => c.Name.Contains(":")).Any(), "Bad C# name"); }
public void TestMCObjectsWithFunnyNames() { var f = new FileInfo("atest.root"); Assert.IsTrue(f.Exists, "File not there"); var p = new ParseTFile(); var results = p.ParseFile(f).ToArray(); foreach (var c in results) { Console.WriteLine("Class " + c.Name); Assert.IsFalse(c.Name.Contains("."), string.Format("Class {0} contains bad characters", c.Name)); foreach (var item in c.Items) { Console.WriteLine(" item " + item.Name + " - " + item.ItemType); Assert.IsFalse(item.Name.Contains("."), string.Format("Object {0} contains item {1}", c.Name, item.Name)); Assert.IsFalse(item.Name.Contains(":"), string.Format("Object {0} contains item {1}", c.Name, item.Name)); } } }