MudassarRasool / mb-unit

Automatically exported from code.google.com/p/mb-unit
0 stars 0 forks source link

Incorrect Databinding with static class fields #737

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem? (see example StaticDataFixture.cs)
1.  define a static class fixture with a static member
2.  define a datasource for the member at the class level, and a bind on the 
member to the datasource
4.  define a test which uses the member variable
3.  run the test fixture

What is the expected output? What do you see instead?
expected the test will run with the values defined in the datasource
found that the test runs the proper number of times (for joins etc.) but the 
Tests find default values in the members (such as 0 for int, null for object).

What version of the product are you using? On what operating system?
3.2 build 601
Windows XP Pro SP3 (x86)

Please provide any additional information below.
The bug is not present on a non-static class with static members.

Work Around:
The bug is very easy to work around.  Just remove 'static' from the class 
declaration.  Then the user just has to use diligence to only declare static 
members.  Inheritance might be prevented by sealed keyword, I haven't tried it.

Original issue reported on code.google.com by tyr...@irdinc.com on 27 Sep 2010 at 6:28

Attachments:

GoogleCodeExporter commented 8 years ago
Static test fixtures are not supported; as written in the API doc:
http://gallio.org/api/html/T_MbUnit_Framework_TestFixtureAttribute.htm

However, this limitation should be emphasized by the framework itself. A 
PatternUsageException should be thrown when a static test fixture is detected.

Original comment by Yann.Tre...@gmail.com on 28 Sep 2010 at 6:49

GoogleCodeExporter commented 8 years ago

Original comment by Yann.Tre...@gmail.com on 28 Sep 2010 at 6:54

GoogleCodeExporter commented 8 years ago

Original comment by Yann.Tre...@gmail.com on 28 Sep 2010 at 8:12