a. why are you new-ing the helper? they are all being created anyway by the
framework.
b. it appear that the failing call is ObtainRootInstance, with the target Id
you supply to the TextField method.
is there something in the PropertyBag that corresponds to fieldId in the
test environment?


On Wed, Apr 8, 2009 at 12:36 PM, [email protected] <
[email protected]> wrote:

>
> I'm currently working on a ViewComponent however I'm struggling the
> testing side of things.
>
> The ViewComponent uses the FormHelper within it.
>
> formHelper = new FormHelper(EngineContext);
>
> and is creating a series of TextFields dynamically
>
> formHelper.TextField(fieldId)
>
> This works fine when running the view.  However when running the test
> which inherits from BaseViewComponentTest I'm getting the following
> error message when the formHelper.TextField(fieldId) code is run.
>
> System.NullReferenceException: Object reference not set to an instance
> of an object.
> at
>
> Castle.MonoRail.Framework.Helpers.AbstractFormRelatedHelper.ObtainRootInstance
> (RequestContext context, String target)
> at
>
> Castle.MonoRail.Framework.Helpers.AbstractFormRelatedHelper.ObtainRootInstance
> (RequestContext context, String target, String[]& pieces)
> at
> Castle.MonoRail.Framework.Helpers.AbstractFormRelatedHelper.ObtainValue
> (RequestContext context, String target)
> at
> Castle.MonoRail.Framework.Helpers.AbstractFormRelatedHelper.ObtainValue
> (String target)
> at
> Castle.MonoRail.Framework.Helpers.AbstractFormRelatedHelper.ObtainValue
> (String target, IDictionary attributes)
> at Castle.MonoRail.Framework.Helpers.FormHelper.TextField(String
> target, IDictionary attributes)
> at Castle.MonoRail.Framework.Helpers.FormHelper.TextField(String
> target)
>
> Is there something I'm missing?  I've seen this discussion about the
> lack of PropertyBag http://markmail.org/message/xremym6hthsudx4o but
> as I said the same code works fine when running the viewcomponent in
> the view.
>
> Hope this makes sense
>
> John
> >
>


-- 
Ken Egozi.
http://www.kenegozi.com/blog
http://www.delver.com
http://www.musicglue.com
http://www.castleproject.org
http://www.gotfriends.co.il

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" 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/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to