<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Andrey Shchekin &#187; Moq</title>
	<atom:link href="http://blog.ashmind.com/category/agile/mocking/moq/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.ashmind.com</link>
	<description></description>
	<lastBuildDate>Mon, 15 Mar 2010 18:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Mocking internal interfaces with Moq</title>
		<link>http://blog.ashmind.com/2008/05/09/mocking-internal-interfaces-with-moq/</link>
		<comments>http://blog.ashmind.com/2008/05/09/mocking-internal-interfaces-with-moq/#comments</comments>
		<pubDate>Fri, 09 May 2008 08:57:00 +0000</pubDate>
		<dc:creator>Andrey Shchekin</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Mocking]]></category>
		<category><![CDATA[Moq]]></category>
		<category><![CDATA[Solutions]]></category>

		<guid isPermaLink="false">http://blog.ashmind.com/index.php/2008/05/09/mocking-internal-interfaces-with-moq/</guid>
		<description><![CDATA[Is a same method you would use with NMock2, but with &#8220;DynamicProxyGenAssembly2&#8243; in InternalsVisibleTo. This strange name is a default dynamic assembly name used by Castle.DynamicProxy. Do not forget that the attribute should be added to the assembly with internal types, not to the tests assembly (obvious, but I got it wrong the first time). [...]]]></description>
			<content:encoded><![CDATA[<p>Is a <a href="http://blog.ashmind.com/index.php/2007/07/07/mocking-internal-interfaces-with-nmock2/">same method</a> you would use with NMock2, but with &#8220;DynamicProxyGenAssembly2&#8243; in InternalsVisibleTo.<br /> This strange name is a default dynamic assembly name used by Castle.DynamicProxy.</p>
<p>Do not forget that the attribute should be added to the assembly with internal types, not to the tests assembly (obvious, but I got it wrong the first time).</p>
<blockquote><p><strong>Update:</strong> <a href="http://groups.google.com/groups/profile?hl=en&#038;enc_user=MrWd7RcAAABFAu4WJ_yZyMt4VseX6ryvHqZiDvCVswhrZ6TQxKj0ww">yesthatmcgurk</a> has <a href="http://groups.google.com/group/moqdisc/browse_thread/thread/ebe69d235dfa69d9?hl=en">pointed me</a> to the fact that for strongly named assemblies you have to specify the public key as well. So the correct attribute for the strongly named assembly should be</p>
<pre class="csharpcode">[<span class="kwrd">assembly</span>:InternalsVisibleTo(<span class="str">"DynamicProxyGenAssembly2,
PublicKey=002400000480000094000000060200000024000052534
1310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b
3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d926665
4753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb
4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c486
1eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7"</span>)]
<span class="rem">// without line-breaks</span></pre>
</blockquote>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
]]></content:encoded>
			<wfw:commentRss>http://blog.ashmind.com/2008/05/09/mocking-internal-interfaces-with-moq/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

