Just got a comment on .Net and FIT from a blog reader. This caused me to remember that I submitted a proposed patch to
source forge, artifact 1255429, which deals with using properties instead of member variables. The patch was submitted to source
forge in August of 2005. Nothing as of this post has been done, that I am aware of, so I thought I would put
it out for public consumption and comment.
In more detail, fixtures deriving from RowFixture have instantiated classes with public variables, instead of exposing the
instantiated object’s members via public properties. With these modifications you can write fixtures directly against objects
under test, which are typically the actual application classes, exposing properties instead of variables to the RowFixtures. This
enables the .Net developer to avoid writing additional code beyond the fixture and the actual application objects under test.
If needed, I have an article
that was posted July of 2005, that takes you through the steps of downloading and getting the fit solution working in VS 2003 on Windows XP Pro.
Once you have FIT working get this download. It contains modified ColumnFixture and TypeAdapter classes (that go into the
FIT project) along my test project, MarkTest, that gets added to the FIT solution. Once you rebuild the FIT solution, get
the Input.html file that is also part of the zip download and place it into a folder. This input file will test the book
object’s properties to be utilized with the RowFixture subclasses. Next get the fit.dll and the runFile.exe from the FIT
project’s output folder ([fit project folder]/bin/debug) and copy it to the same folder as the input.html file. Finally,
get the MarkTest.dll from the MarkTest project output folder ([MarkTest project folder]/bin/debug) and copy it to the
same folder as the input.html file. Your folder should look like the following once you have the files in place:
In short, the modifications discussed above test an object’s properties based on the expected values of the input
file. In the download, the Book class has two public properties, ID and Title. The input.html file’s content is:
Note the “[]” text that is used in the input file to signify the ID and Title fields are properties and not member variables.
Look at the modified ColumnFixture and TypeAdapter classes.
At the Visual Studio command prompt type the following: runFile Input.html result.html . (Note the space and period at the end)
Upon execution you should see the following result:
When you look at the result.html file, you see:
So now you do not have to edit your class’s properties into member variables before running FIT tests against your .Net objects.