public void TestForSomeObjects() { using (var f = new FileCreator("TestForSomeObjects_only.root")) { f.AddObject <ROOTNET.NTObject>(5); } var fin = new ROOTNET.NTFile("TestForSomeObjects_only.root", "READ"); Assert.AreEqual(5, Utils.FindAllOfType <ROOTNET.Interface.NTObject>(fin).Count(), "was just the right types in it"); fin.Close(); using (var f = new FileCreator("TestForSomeObjects_combo.root")) { f.AddObject <ROOTNET.NTObject>(5); f.AddObject <ROOTNET.NTH1F>(5); } fin = new ROOTNET.NTFile("TestForSomeObjects_combo.root", "READ"); Assert.AreEqual(10, Utils.FindAllOfType <ROOTNET.Interface.NTObject>(fin).Count(), "was just the right types in it"); Assert.AreEqual(5, Utils.FindAllOfType <ROOTNET.Interface.NTH1F>(fin).Count(), "was just the mostly the types in it"); fin.Close(); }
public void TestForNoObjects() { using (var f = new FileCreator("TestForNoObjects_empty.root")) { } var fin = new ROOTNET.NTFile("TestForNoObjects_empty.root", "READ"); Assert.AreEqual(0, Utils.FindAllOfType <ROOTNET.Interface.NTObject>(fin).Count(), "was an empty file"); fin.Close(); using (var f = new FileCreator("TestForNoObjects_wrong.root")) { f.AddObject <ROOTNET.NTObject>(5); } fin = new ROOTNET.NTFile("TestForNoObjects_wrong.root", "READ"); Assert.AreEqual(0, Utils.FindAllOfType <ROOTNET.Interface.NTH1F>(fin).Count(), "was a file with incorrect objects file"); fin.Close(); }