I got similar problem before, and it was a bug in version 3.5.0.2 from
RC1(?),  it has been fixed in the latest release.

On Feb 3, 11:07 am, Sean <[email protected]> wrote:
> Hi,
> We run into an issue with the following code. If Line A and B are
> switched, it works as expected, and the stubbed property is returning
> the value it was given. If the original code is left (first Line A,
> then Line B), the stubbed property is returning the default value and
> not what was given to it during context establishment. Is this a bug
> or something we are missing?
> Thank you
>
> Sean
>
> -------------------------Code-------------------------
>
> namespace QTUS.Server.Task
> {
>     [Concern(typeof (GetVersionsTask))]
>     public abstract class GetVersionsTask_Specs :
> ContextSpecification<IGetVersionsTask>
>     {
>         protected override void establish_context()
>         {
>             system_under_test = create_system_under_test();
>         }
>
>         protected override IGetVersionsTask create_system_under_test()
>         {
>             return new GetVersionsTask();
>         }
>     }
>
>     public class When_GetVersionsTask_is_asked_to_GetOutputXML :
> GetVersionsTask_Specs
>     {
>         private QuikTikitUser quikTikitUser;
>         private Application application;
>         private const bool isActive = true;
>         private readonly ReadOnlyCollection<string>
> userErrorCollection = new ReadOnlyCollection<string>(new List<string>
> {"user error"});
>         private readonly ReadOnlyCollection<string> appErrorCollection
> = new ReadOnlyCollection<string>(new List<string>{"app error"});
>         private string result;
>         private const string dataVersion = "1";
>         private const string appVersion = "1.1.1.1";
>
>         protected override void establish_context()
>         {
>             quikTikitUser = dependency<QuikTikitUser>();
>             application = dependency<Application>();
>
>             quikTikitUser.setup_result(x => x.GetErrors()).Return
> (userErrorCollection);
>             quikTikitUser.IsActive =
> isActive;                                                             //
> <--- ISSUE (Line A)
>             quikTikitUser.setup_result(x => x.GetDataVersion()).Return
> (dataVersion);   //                 (Line B)
>
>             application.setup_result(x => x.GetErrors())
>                 .Return(appErrorCollection);
>             application.Version = appVersion;
>
>             base.establish_context();
>         }
>
>         protected override void because()
>         {
>             result = system_under_test.CreateXMLOutput(quikTikitUser,
> application);
>         }
>
>         [Observation]
>         public void
> Should_ask_the_user_and_the_application_for_any_errors()
>         {
>             quikTikitUser.was_told_to(x => x.GetErrors());
>             application.was_told_to(x => x.GetErrors());
>         }
>
>         [Observation]
>         public void Should_ask_the_user_for_its_dataversion()
>         {
>             quikTikitUser.was_told_to(x => x.GetDataVersion());
>         }
>
>         private const string outputXML =
>             @"<reply>
>                 <error>{0}</error>
>                 <user>
>                     <active>{1}</active>
>                 </user>
>                 <app>
>                     <version>{2}</version>
>                 </app>
>                 <data>
>                     <version>{3}</version>
>                 </data>
>               </reply>";
>
>         [Observation]
>         public void Should_create_valid_xml()
>         {
>             var validXML = string.Format(outputXML, "user error - app
> error", isActive, appVersion, dataVersion);
>             result.should_be_equal_to(validXML);
>         }
>     }
>
> }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Rhino.Mocks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/RhinoMocks?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to