public void WhenIReadTheSectionTables() { var fileName = ScenarioContext.Current.Get <string>("FileName"); var filePath = string.Format(@".\TestArtifacts\{0}", fileName); if (!File.Exists(filePath)) { filePath = string.Format(@".\{0}", fileName); Console.WriteLine(string.Format(@"File not Found: .\TestArtifacts\{0}", fileName)); } using (FileStream inputFile = File.OpenRead(filePath)) { var msdos20Section = ScenarioContext.Current.Get <MSDOS20Section>("MSDOS20Section"); var coffHeader = ScenarioContext.Current.Get <COFFHeader>("COFFHeader"); var coffOptionalHeaderStandardFields = ScenarioContext.Current.Get <COFFOptionalHeaderStandardFields>("COFFOptionalHeaderStandardFields"); List <SectionTable> sectionTables = new List <SectionTable>(); inputFile.Position = SectionTable.StartingPosition(msdos20Section, coffOptionalHeaderStandardFields); for (int i = 0; i < coffHeader.NumberOfSections; i++) { SectionTable?sectionTable = inputFile.ReadStructure <SectionTable>(); sectionTables.Add(sectionTable.Value); } ScenarioContext.Current.Add("SectionTables", sectionTables); } }