Buy Me a Coffee

Buy Me a Coffee!

Friday, February 24, 2017

Reading Structured Binary files in C#: Part 10

I am not happy with what I am doing, but it is the best that I can see clear to do.  The dissection of the binary files has reached the SectionTable portion and here we run into the limitation of using a communication tool such as SpecFlow as a framework for testing.  The ScenarioOutline in SpecFlow allows us to provide an Examples table, but the table is limited.  I will need to introduce some logic into the steps that blur some lines that I generally want crispy.
The section table contains an arbitrary but known number of sections of indeterminate types.  We 'know' that there are three, and will test for that.  But how will we test the values?  I will test that they are in the same order among the files, and will test each type separately.  I will include multiple entries within a field as a comma delimited list and have the step split the list for comparison.  Here is what it looks like testing one file when completed:

It isn't pretty, but it gets the job done.  The step file for this test looks like this:

If you read this far, I hope you skipped a bunch.  You see what I mean about ugly. If you know of a better way to accomplish this with SpecFlow, please speak up!

Keep your bits in line.