Does CallBaseMethod () works for virtual property in FakeItEasy?


I have simple class
public class Simple  {      public virtual int VirtualProperty { get; set; }  }  
When i run (FakeItEasy.1.13.1)
var strict = A.Fake<Simple>(options => options.Strict());  A.CallTo(() => strict.VirtualProperty).CallsBaseMethod();  strict.VirtualProperty = 999;  
I get an error
Call to non configured method "set_VirtualProperty" of strict fake.  
And I have to
var strict = A.Fake<Simple>(options => options.Strict());  A.CallTo(strict).Where(a => a.Method.Name == "get_VirtualProperty").CallsBaseMethod();  A.CallTo(strict).Where(a => a.Method.Name == "set_VirtualProperty").CallsBaseMethod();  strict.VirtualProperty = 999;  
Does CallBaseMethod () works for virtual property? What am I doing wrong?


Update: since 2.0.0 has been released, there's a more convenient way to configure a property setter in some cases.
As more light has been shone on this over at FakeItEasy Issue 175, it's become apparent that the real snag is that A.CallTo(() => strict.VirtualProperty).CallsBaseMethod() configures the property getter, but not the setter. After that configuration, get calls made on strict.VirtualProperty will call the base method (property).
However, there's no convenient way to configure the property setter. The workaround you have is about as good as it gets.

Note:If u also have question or solution just comment us below or mail us on
Next Post »