This is a migrated thread and some comments may be shown as answers.

Possible bug with private property read?

1 Answer 56 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 29 Apr 2015, 05:50 PM

 Mock.NonPublic.Arrange<int>(mockedClass, "_prop").Returns(5);

Works as long as my private variable is setup like so:

private int _prop {get; set;}

However these:

private int _prop; 

or 

private int _prop = 5;

get an error attempting to read it. 

 

 

Thanks in advance, 

Mark 

 

1 Answer, 1 is accepted

Sort by
0
Mark
Top achievements
Rank 1
answered on 30 Apr 2015, 04:17 PM
Already know my own answer..
Backing fields aren't properties... sigh sleep helped
Tags
General Discussions
Asked by
Mark
Top achievements
Rank 1
Answers by
Mark
Top achievements
Rank 1
Share this question
or