public void GetFileDetails_SmallFiles_ReturnDetails() { //Arrange var stubFiles = new List <string>() { "resources/t1.xlsx", "resources/t2.xlsx", "resources/t3.xlsx" }; var expectedSheetCounts = new Dictionary <string, int>() { { "t1.xlsx", 1 }, { "t2.xlsx", 3 }, { "t3.xlsx", 4 } }; var stubOptions = new SpreadsheetCollectionOptions() { Files = stubFiles }; var fakeCollection = new SpreadsheetCollection(stubOptions); //Act var actualCollectionDetails = fakeCollection.GetFileDetails(); var actualFilesLoaded = actualCollectionDetails.Count; //Assert Assert.Equal(3, actualFilesLoaded); foreach (var sheetCount in expectedSheetCounts) { var expectedCount = sheetCount.Value; var matches = actualCollectionDetails.Where(p => p.SourceFile.Name == sheetCount.Key).ToList(); var actualCount = matches[0].Sheets.Count; Assert.Equal(expectedCount, actualCount); } }
public DataFileInfo(string src, List <string> sheets) { SourceFile = new FileInfo(src); Sheets = sheets; FileExtension = SpreadsheetCollection.DetermineExtension(src.ToLower()); }