Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Using Moq with Boo
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Georges Benatti Junior  
View profile  
 More options Jul 3, 4:48 pm
From: Georges Benatti Junior <gbena...@gmail.com>
Date: Fri, 3 Jul 2009 17:48:56 -0300
Local: Fri, Jul 3 2009 4:48 pm
Subject: Using Moq with Boo
Hi,

I'm trying to use Moq with Boo, but i'm having some problems in how to
pass the lambdas to Moq.

If someone can help, i would be really glad.

Here the code:

interface IBehavior:
  Name as string:
    get
    set

  def Start()

behavior = Mock[of IBehavior]()
behavior.Setup({b as IBehavior | b.Name}).Returns("Behavior_1")
behavior.Setup({b as IBehavior | b.Start()})

The compiler complains in the Setyp methods.

Using Boo 0.9.1.3287

Thanks,

--
Georges "The Firewalker"


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Cedric Vivier  
View profile  
 More options Jul 4, 12:36 am
From: Cedric Vivier <cedr...@neonux.com>
Date: Sat, 4 Jul 2009 12:36:07 +0800
Local: Sat, Jul 4 2009 12:36 am
Subject: Re: Using Moq with Boo

On Sat, Jul 4, 2009 at 4:48 AM, Georges Benatti Junior
<gbena...@gmail.com>wrote:

Hi Georges,

Are you using Boo trunk or Boo 0.9.1 (the version number is still the same,
Rodrigo feel free to "bin update" ;-) ) ?
If confirmed with trunk can you post the -vvv output here.

Thanks,


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Georges Benatti Jr  
View profile  
 More options Jul 5, 7:06 pm
From: Georges Benatti Jr <gbena...@gmail.com>
Date: Sun, 5 Jul 2009 20:06:22 -0300
Local: Sun, Jul 5 2009 7:06 pm
Subject: Re: Using Moq with Boo

Hi

I'm using one version between the latest stable and the trunk version.

But looking at the Moq code, it looks like the setup method needs a  
lambda expression as parameter. Exists in Boo any way to express  
lambda expressios ? If i'm not mistaken they aren't the samething as  
callables/delegates.

Thx

Sent from my iPhone

On 04/07/2009, at 01:36, Cedric Vivier <cedr...@neonux.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Justin Chase  
View profile  
 More options Jul 6, 11:57 am
From: Justin Chase <justin.m.ch...@gmail.com>
Date: Mon, 6 Jul 2009 10:57:34 -0500
Local: Mon, Jul 6 2009 11:57 am
Subject: Re: Using Moq with Boo

What is the error exactly?
Lambdas in C# are sort of interesting in that they can be used to express
two different types, Delegates or Expressions. I'm not sure how it works in
Boo, but if it can't compile a lambda into an expression that might explain
your error. For example in C#:

void A<T>(Expression<Func<T, bool>> expression) { ... }

void B<T>(Func<T, bool>> func) { ... }

Can both be called like this:

A(a => a.Value > 100);
B(b => b.Value > 100);

But will compile to different types. I'm guessing the Moq framework is using
the Expression<T, bool>? In that case you get an expression tree which you
can look at and query to get all of the inner expressions at runtime and do
reflection and what not. You can also compile it into a delegate on the fly
and execute it. Will boo compile lambdas into Expression<Delegate>? or does
it always build a delegate?

On Sun, Jul 5, 2009 at 6:06 PM, Georges Benatti Jr <gbena...@gmail.com>wrote:

--
Justin Chase
http://www.justnbusiness.com

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Georges Benatti Junior  
View profile  
 More options Jul 6, 2:51 pm
From: Georges Benatti Junior <gbena...@gmail.com>
Date: Mon, 6 Jul 2009 15:51:34 -0300
Local: Mon, Jul 6 2009 2:51 pm
Subject: Re: Using Moq with Boo
Ye,

That is the case, Moq expects Expressions and not delegates, because
it introspect the Expression to see if some call to the method defined
in the expression tree was called.

I'm almost sure that Boo doesn't compile a lambda to a Expression, so
it can't be used with Moq :(

Thanks, Guys

--
Georges "The Firewalker"

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Justin Chase  
View profile  
 More options Jul 6, 3:08 pm
From: Justin Chase <justin.m.ch...@gmail.com>
Date: Mon, 6 Jul 2009 14:08:55 -0500
Local: Mon, Jul 6 2009 3:08 pm
Subject: Re: Using Moq with Boo

I bet you could make a macro for this:
Foo(expression { a | ... });

The expression macro could convert the AST from a lambda into an actual
Expression objects. Of course built-in compiler support would be even nicer.

On Mon, Jul 6, 2009 at 1:51 PM, Georges Benatti Junior
<gbena...@gmail.com>wrote:

--
Justin Chase
http://www.justnbusiness.com

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google