I am writing a test (TDD) for an MVP app. I want to test that the
presenter gets the proper values from the
view and passes them in a lambda to the model. For Example:

the view has a "Keyword" property that returns the value the user
typed in. I am mocking that and passing back "foo". The presenter
should build a lambda with that value and pass it to an NHibernate
repository's Search<Item>(Expression) method like so:

 repository.Search<Item>(x=>x.Description.Contains(view.Keyword));

In my test, I mock the repository and the view, so the SUT is the
presenter. All I want to verify is that the lambda tha the presenter
sent is "x=>x.Description.Contains("foo")" but It never matches.

I create the lambda:

  Expression<Func<Item, bool>> expr = x =>
x.Description.Contains("foo");

When I Console.WriteLine it out, the Lambda coming from the presenter
looks like this:

 
x=>x.Description.Contains(value(Project.Presentation.SearchPresenter).view.Keyword))

and the lambda in my test looks like:

  x=>x.Description.Contains("foo")

so they are never going to match up.

Any ideas how I can test that my lambda is good?

Thanks in advance.

~Lee
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibernate@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to