asiftasleem / nbuilder

Automatically exported from code.google.com/p/nbuilder
0 stars 0 forks source link

Base class property with private setter but public getter are ignored for inherited classes #84

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
When a base class has a property with a private setter and a public getter on 
it and you inherit from this class, the property does not get set a value. This 
is because the private setter is not visible to the sub class and it thinks it 
is readonly. 

I think that it should set all properties that have a setter no matter if they 
are declared in the sub class or in the base class, or at least give an option 
to do so.  

Basically what was added is a method to the PropertyNamer class to recursively 
call the type.GetProperties until the type.BaseType is null.  I also added a 
binding flag for DeclaredOnly so it doesn't get the same property more than 
once.  In the SetValuesOf method instead of calling type.GetProperties, it 
calls this new method to get all the properties. 

I have included a diff file that shows what I changed. 

I am using 3.0.1 on Windows 7 x64 on .NET 4.0.

Thank you for your time in creating this tool.  It definitely is a timesaver 
and makes writing test code a lot easier.

Original issue reported on code.google.com by jimb....@gmail.com on 16 Feb 2012 at 3:43

Attachments: