Sunday, August 07, 2005

How can we be sure we are singing from the same page of music? – Fit in the key of C#

To build on an earlier posting on the use of Fit with C#, here are examples of Fit fixtures implemented in C#. The fixtures I demonstrate are the ActionFixture, ColumnFixture and RowFixture.

I also briefly discuss the desire to test properties in addition to fields and methods with Fit. I have "tweaked" the source code to provide this. My initial tests work but I would like to further test the code and submit it to other Fit developers as I am sure this has already been considered. My guess is that I may not be implementing the RowFixture subclass correctly. I will provide my source code on this later following more tests and discussion.

UPDATE 7-10-2006: After posting the above info, 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 update 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.

The new post: Testing .Net Properties with FIT

No comments: