<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Unit Testing Expression Tree Equality</title>
	<atom:link href="http://quickduck.com/blog/2009/08/25/unit-testing-expression-tree-equality/feed/" rel="self" type="application/rss+xml" />
	<link>http://quickduck.com/blog/2009/08/25/unit-testing-expression-tree-equality/</link>
	<description>Straight from the mind of geniuseseses....</description>
	<lastBuildDate>Fri, 06 Aug 2010 07:40:27 -0700</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Drew</title>
		<link>http://quickduck.com/blog/2009/08/25/unit-testing-expression-tree-equality/comment-page-1/#comment-11909</link>
		<dc:creator>Drew</dc:creator>
		<pubDate>Thu, 24 Dec 2009 04:10:22 +0000</pubDate>
		<guid isPermaLink="false">http://quickduck.com/blog/?p=131#comment-11909</guid>
		<description>Ian,
That sounds like a great idea. We could feature it in an upcoming post if you like?</description>
		<content:encoded><![CDATA[<p>Ian,<br />
That sounds like a great idea. We could feature it in an upcoming post if you like?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ian</title>
		<link>http://quickduck.com/blog/2009/08/25/unit-testing-expression-tree-equality/comment-page-1/#comment-11688</link>
		<dc:creator>Ian</dc:creator>
		<pubDate>Sat, 21 Nov 2009 12:11:10 +0000</pubDate>
		<guid isPermaLink="false">http://quickduck.com/blog/?p=131#comment-11688</guid>
		<description>Hi,

It seems like compiling the expression and invoking it with an arbitrary value is a really bad way of unit testing expressions, because the only way to be certain that the expressions are for all intents and purposes equal is to perform this comparison with every possible value. That&#039;s not too big a task when the input is a single Int32, but considering System.Func can accept up to 5 input parameters even testing with ints will get unrealistic very quickly.

It seems like the best way to test equivalence of expressions is to do as you suggest and compare each part of the tree using an expression visitor. This isn&#039;t very hard to do. In fact, I&#039;ve written an expression visitor that does exactly this in less than 200 lines of code, and most of those lines are very mundane. You&#039;re welcome to it if you&#039;d like.

Thanks,
Ian</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>It seems like compiling the expression and invoking it with an arbitrary value is a really bad way of unit testing expressions, because the only way to be certain that the expressions are for all intents and purposes equal is to perform this comparison with every possible value. That&#8217;s not too big a task when the input is a single Int32, but considering System.Func can accept up to 5 input parameters even testing with ints will get unrealistic very quickly.</p>
<p>It seems like the best way to test equivalence of expressions is to do as you suggest and compare each part of the tree using an expression visitor. This isn&#8217;t very hard to do. In fact, I&#8217;ve written an expression visitor that does exactly this in less than 200 lines of code, and most of those lines are very mundane. You&#8217;re welcome to it if you&#8217;d like.</p>
<p>Thanks,<br />
Ian</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben</title>
		<link>http://quickduck.com/blog/2009/08/25/unit-testing-expression-tree-equality/comment-page-1/#comment-11424</link>
		<dc:creator>Ben</dc:creator>
		<pubDate>Fri, 13 Nov 2009 00:19:24 +0000</pubDate>
		<guid isPermaLink="false">http://quickduck.com/blog/?p=131#comment-11424</guid>
		<description>You&#039;re a douche ;)

The snippet:

&quot;So if you have two expressions that are syntactically the same but not the same reference the easiest way to ensure they are the same is to compile the expression and invoke it comparing the resultant value.&quot;

Says exactly that.

*jerk*</description>
		<content:encoded><![CDATA[<p>You&#8217;re a douche ;)</p>
<p>The snippet:</p>
<p>&#8220;So if you have two expressions that are syntactically the same but not the same reference the easiest way to ensure they are the same is to compile the expression and invoke it comparing the resultant value.&#8221;</p>
<p>Says exactly that.</p>
<p>*jerk*</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert</title>
		<link>http://quickduck.com/blog/2009/08/25/unit-testing-expression-tree-equality/comment-page-1/#comment-11373</link>
		<dc:creator>Robert</dc:creator>
		<pubDate>Wed, 11 Nov 2009 06:06:57 +0000</pubDate>
		<guid isPermaLink="false">http://quickduck.com/blog/?p=131#comment-11373</guid>
		<description>Correct me if im wrong. (anyone please) but this will only actually test that the final output value of the Actual Expression is the same as the final output value of the Expected Expression, given some dummy input value. It wont actually test expression equality since some simple logic would show that you can have two completely different expressions return the same result for any given input.</description>
		<content:encoded><![CDATA[<p>Correct me if im wrong. (anyone please) but this will only actually test that the final output value of the Actual Expression is the same as the final output value of the Expected Expression, given some dummy input value. It wont actually test expression equality since some simple logic would show that you can have two completely different expressions return the same result for any given input.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
