[Test] //this test requires internet connection public void GetColumnHeadersTest() { using (var uow = ObjectFactory.GetInstance <IUnitOfWork>()) { var cloudFileManager = new MockedCloudFileManager(); // https://yardstore1.blob.core.windows.net/default-container-dev/SampleFile1.xlsx var blobUrl = "https://yardstore1.blob.core.windows.net/default-container-dev/SampleFile1.xlsx"; try { var byteArray = cloudFileManager.GetRemoteFile(blobUrl); var columns = ExcelUtils.GetColumnHeaders(byteArray, "xlsx"); Assert.IsNotNull(columns); Assert.AreEqual(columns.Count(), 3); Assert.AreEqual(columns[0], "FirstName"); Assert.AreEqual(columns[1], "LastName"); Assert.AreEqual(columns[2], "Email Address"); } finally { } } }
public void GetRowsTest() { using (var uow = ObjectFactory.GetInstance <IUnitOfWork>()) { var cloudFileManager = new MockedCloudFileManager(); // https://yardstore1.blob.core.windows.net/default-container-dev/SampleFile1.xlsx var blobUrl = "https://yardstore1.blob.core.windows.net/default-container-dev/SampleFile1.xlsx"; try { var byteArray = cloudFileManager.GetRemoteFile(blobUrl); var rows = ExcelUtils.GetTabularData(byteArray, "xlsx"); Assert.IsNotNull(rows); Assert.AreEqual(rows.Count(), 3); Assert.AreEqual(rows["1"].Count, 3); Assert.AreEqual(rows["1"][0].Item1, "1"); Assert.AreEqual(rows["1"][0].Item2, "Alex"); Assert.AreEqual(rows["2"].Count, 3); Assert.AreEqual(rows["3"].Count, 3); } finally { } } }