Am curious what you all see as the correct behavior. Am thinking about making an enhancement where the last value set on a stub is what is used. The usage scenario is that I have some common set up code and in some tests want to override with a new stubbed value, however when using expressions the new updated value "doesn't take" (it uses the original). When using setable properties (ie. PropertyBehavior) the last set value is the one that is returned (which allows me to override as I wish).
Here's an example...which is proper (I'm proposing that the ShowSetable example should be allowed (ie. "last in wins")). What am I overlooking? public interface IFoo { bool ReadProperty { get; } bool SetableProperty { get; set; } } [Test] public void ShowReadable() { var order = MockRepository.GenerateStub<IFoo>(); order.Stub(x => x.ReadProperty).Return(false); order.Stub(x => x.ReadProperty).Return(true); Console.WriteLine(order.ReadProperty ); Console.WriteLine(order.ReadProperty); } Returns: False, False ("first in wins") [Test] public void ShowSetable() { var order = MockRepository.GenerateStub<IFoo>(); order.SetableProperty = false; order.SetableProperty = true; Console.WriteLine(order.SetableProperty); Console.WriteLine(order.SetableProperty); } Returns: True, True ("last in wins") Tim -- Tim Barcz Microsoft C# MVP Microsoft ASPInsider http://timbarcz.devlicio.us http://www.twitter.com/timbarcz --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Rhino Tools Dev" group. To post to this group, send email to rhino-tools-dev@googlegroups.com To unsubscribe from this group, send email to rhino-tools-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rhino-tools-dev?hl=en -~----------~----~----~----~------~----~------~--~---