public void TestGetNodeDollarYear() { var content = System.IO.File.ReadAllText(TestAssembly.TestDataDir + @"\ExampleSecXbrl.xml"); var testSubject = SecXbrlInstanceFile.GetXmlAndNsMgr(content); var testResult = SecXbrlInstanceFile.GetNodeDollarYear(testSubject.Item1, "//us-gaap:SalesRevenueServicesNet", testSubject.Item2); Assert.IsNotNull(testResult); Assert.IsTrue(testResult.Any()); foreach (var tr in testResult) { System.Console.WriteLine(tr); } content = System.IO.File.ReadAllText(TestAssembly.TestDataDir + @"\ExampleSecXbrl2.xml"); testSubject = SecXbrlInstanceFile.GetXmlAndNsMgr(content); testResult = SecXbrlInstanceFile.GetNodeDollarYear(testSubject.Item1, "//us-gaap:Revenues", testSubject.Item2); Assert.IsNotNull(testResult); Assert.IsTrue(testResult.Any()); foreach (var tr in testResult) { System.Console.WriteLine(tr); } }
public void TestGetXmlAndNsMgr() { var content = System.IO.File.ReadAllText(TestAssembly.TestDataDir + @"\ExampleSecXbrl.xml"); var testResult = SecXbrlInstanceFile.GetXmlAndNsMgr(content); Assert.IsNotNull(testResult); Assert.IsNotNull(testResult.Item1); Assert.IsNotNull(testResult.Item2); Assert.AreEqual("http://xbrl.sec.gov/dei/2014-01-31", testResult.Item2.LookupNamespace(SecXbrlInstanceFile.XmlNs.DEI)); Assert.AreEqual("http://fasb.org/us-gaap/2015-01-31", testResult.Item2.LookupNamespace(SecXbrlInstanceFile.XmlNs.US_GAAP)); Assert.AreEqual("http://www.xbrl.org/2003/instance", testResult.Item2.LookupNamespace(SecXbrlInstanceFile.XmlNs.ROOTNS)); content = System.IO.File.ReadAllText(TestAssembly.TestDataDir + @"\ExampleSecXbrl2.xml"); testResult = SecXbrlInstanceFile.GetXmlAndNsMgr(content); Assert.IsNotNull(testResult); Assert.IsNotNull(testResult.Item1); Assert.IsNotNull(testResult.Item2); Assert.AreEqual("http://xbrl.sec.gov/dei/2014-01-31", testResult.Item2.LookupNamespace(SecXbrlInstanceFile.XmlNs.DEI)); Assert.AreEqual("http://fasb.org/us-gaap/2015-01-31", testResult.Item2.LookupNamespace(SecXbrlInstanceFile.XmlNs.US_GAAP)); Assert.AreEqual("http://www.xbrl.org/2003/instance", testResult.Item2.LookupNamespace(SecXbrlInstanceFile.XmlNs.ROOTNS)); }
public void TestTryGetYear() { var content = System.IO.File.ReadAllText(TestAssembly.TestDataDir + @"\ExampleSecXbrl.xml"); var testSubject = SecXbrlInstanceFile.GetXmlAndNsMgr(content); int testResultOut; var testResult = SecXbrlInstanceFile.TryGetYear("FD2013Q4YTD", testSubject.Item1, testSubject.Item2, out testResultOut); Assert.IsTrue(testResult); Assert.AreEqual(2013, testResultOut); content = System.IO.File.ReadAllText(TestAssembly.TestDataDir + @"\ExampleSecXbrl2.xml"); testSubject = SecXbrlInstanceFile.GetXmlAndNsMgr(content); testResult = SecXbrlInstanceFile.TryGetYear("FYCurrentYearM12", testSubject.Item1, testSubject.Item2, out testResultOut); Assert.IsTrue(testResult); Assert.AreEqual(2015, testResultOut); }