My 2c
A unit test would spot this bug in 1 second as well

[TestMethod()]
        public void BaseControlProperties_SetAllProperties_NoException()
        {
            BaseControl target = new BaseControl();

            target.SetAllPublicProperties();
            target.GetAllPublicProperties();

            Assert.IsNotNull(target);
        }



This test would try to

   1. set all properties, and then try to
   2. read all properties

PS
Implementation of these helpers are on the web or on my blog (plug)
http://peitor.blogspot.com/2010/04/spot-bug-and-avoid-bug-with-unit-test.html

*The implementation of those methods is not complete (exercise for the
reader :-)*

PS2
I love Resharper

.peter.gfader.
http://peitor.blogspot.com/
http://twitter.com/peitor


On Mon, Apr 26, 2010 at 11:53 PM, Greg Harris <
[email protected]> wrote:

>
> My 2c worth...
>
>
>
> As we spend so much time looking at code, it should be as clear as
> possible, to help us understand what we are looking at, to achieve that I
> follow a strong naming standard on all projects I have control over.
>
> ·         Class/object variables start with an underscore.
>
> ·         Method argument variables start with an “a” (argument).
>
> ·         Local method variables start with an “l” (local).
>
>
>
> Also I switch off all auto formatting so I can do it myself better than the
> machine will do it, so you will see my code looking like:
>
>   // Instance private data
>
>   private string _Name         ; // The name that the member is known by
>
>   private string _MemberNumber ; // Membership number
>
>   private int    _expiryMonth  ; // Month that the membership expires
> range = 1..12
>
>   private int    _expiryYear   ; // Year  that the membership expires
>
>                                  // (four digit years, so 2010 is 2010,
> not 10)
>
>
>
> Our brains are very good a pattern matching, so we should help them with
> this sort of layout style.
>
>
>
> I have a rule I call the 3am rule, you should be able to look at code at
> 3am and immediately be able to understand what it does and how it does it.
> If you can’t, you need to refactor your code for clarity.
>
>
>
> All the best
>
> Greg Harris
>

Reply via email to