asiftasleem / nbuilder

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

DisablePropertyNamingFor Item HOWTO? #36

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1. Create an object with an indexer:

        public string this[string propertyName]
        {
            get
            {
                return result.GetErrorMessage(propertyName);
            }
        }

2. Set up a static Create() method in a Mother object with some 
DisablePropertyNamingFor statements:

        public static PositionMother CreatePositionMother()
        {
            BuilderSetup.DisablePropertyNamingFor<Position, string>(p => 
p.Error);
            BuilderSetup.DisablePropertyNamingFor<Position, bool>(p => 
p.HasErrors);

            return new PositionMother() { Positions = 
Builder<Position>.CreateListOfSize(5).Build() };
        }

3. Run up the mother object.

What is the expected output? What do you see instead?

It all works but the Warning message is there for the indexer and we'd 
like to avoid it:

NBuilder warning: Item threw an exception when attempting to read its 
current value

What version of the product are you using? On what operating system?

Debug version: 1.1.2925.23829
Windows 7 x64

Please provide any additional information below.

Minor inconvienience but how do we write a DisablePropertyNamingFor 
statement to ignore the indexer?

Original issue reported on code.google.com by richard....@gmail.com on 19 Jan 2010 at 3:53

GoogleCodeExporter commented 8 years ago
I've asked Gareth to advise on how he'd like this issue resolved. For the 
moment I'm just going to lower the priority.

Original comment by joshuajr...@gmail.com on 10 Sep 2010 at 8:31

GoogleCodeExporter commented 8 years ago

Original comment by joshuajr...@gmail.com on 10 Sep 2010 at 8:32

GoogleCodeExporter commented 8 years ago
At the moment we are trying to figure out why we've put the warning there in 
the first place. Our thoughts are either to remove the warning or work on a 
feature that allows the indexer to be ignored.

We'll let you know how we go.

Original comment by joshuajr...@gmail.com on 15 Sep 2010 at 7:52

GoogleCodeExporter commented 8 years ago
moved to github

Original comment by garethdo...@googlemail.com on 1 Feb 2013 at 4:47