<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>DevForce Community Forum : DevForce is NUnit / Moq unfriendly</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2012 : DevForce is NUnit / Moq unfriendly</description>
  <pubDate>Thu, 14 May 2026 09:25:24 -700</pubDate>
  <lastBuildDate>Fri, 22 Mar 2013 08:59:36 -700</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.ideablade.com/forum/RSS_post_feed.asp?TID=4060</WebWizForums:feedURL>
  <image>
   <title>DevForce Community Forum</title>
   <url>http://www.ideablade.com/forum/forum_images/IdeaBlade_logo_tm.png</url>
   <link>http://www.ideablade.com/forum/</link>
  </image>
  <item>
   <title>DevForce is NUnit / Moq unfriendly : I admit, the SaveResult is a bit...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4060&amp;PID=16108#16108</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1005" rel="nofollow">mgood</a><br /><strong>Subject:</strong> 4060<br /><strong>Posted:</strong> 22-Mar-2013 at 8:59am<br /><br />I admit, the SaveResult is a bit annoying. I was actually debating whether to expose it through the unit of work. In retrospect I should have not done it.&nbsp;<div><br></div><div>You can hide the underlying CommitAsync behind your own interface that doesn't return Task&lt;SaveResult&gt; and instead returns your own result object. Then you can mock it. During integration test you can test the actual save using the fake store.&nbsp;</div><div><br></div><div>In most other cases you can fake repositories etc. and simply return test entities that you new up or use a disconnected EntityManager with its cache&nbsp;populated&nbsp;with test entities, so you can run queries against the cache.&nbsp;</div>]]>
   </description>
   <pubDate>Fri, 22 Mar 2013 08:59:36 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4060&amp;PID=16108#16108</guid>
  </item> 
  <item>
   <title>DevForce is NUnit / Moq unfriendly : Hi Marcel,these are very great...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4060&amp;PID=16098#16098</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1600" rel="nofollow">cypher</a><br /><strong>Subject:</strong> 4060<br /><strong>Posted:</strong> 22-Mar-2013 at 2:00am<br /><br />Hi Marcel,<div><br></div><div>these are <b>very great options for integration tests</b>, but we are trying to achive Test Driven Development with a lot of Unit Tests instead of a Integration Test (with a fake composition resolver).</div><div><br></div><div>Using the Fake option is really great, but as per definition of TDD, these are Integration Tests, and we should be able to Mock out the dependencys for a smal unit test, without the overhead of a Fake Composition in place.&nbsp;</div><div><br></div><div>Cocktail is highly testable, but the underlying devforce components dont use interfaces or virtual propertys and some dont even have a public ctor.</div><div><br></div><div>so we are running into problems when mocking depenencys for a Unit test.</div><div><br></div><div>It will be highly appreceated, if you could introduce some interfaces in the underlying devforce components, to allow better testability for TDD.&nbsp;</div><div><br></div><div><br></div><div><br></div>]]>
   </description>
   <pubDate>Fri, 22 Mar 2013 02:00:22 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4060&amp;PID=16098#16098</guid>
  </item> 
  <item>
   <title>DevForce is NUnit / Moq unfriendly : cypher,A mock framework is very...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4060&amp;PID=16088#16088</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1005" rel="nofollow">mgood</a><br /><strong>Subject:</strong> 4060<br /><strong>Posted:</strong> 21-Mar-2013 at 11:25am<br /><br />cypher,<div>A mock framework is very rarely necessary to test DevForce/Cocktail applications. DevForce and Cocktail have built in support for faking. The need for a mock framework generally arises if one is faced with code that wasn't written with testing in mind in the first place. Properly written and designed applications don't need a mock framework to be tested. The code would have ample&nbsp;substitution&nbsp;points to fake out implementations for testing.&nbsp;</div><div><br></div><div>As a reference take a look at the unit tests in Cocktail. They use the faking&nbsp;capabilities&nbsp;built into DevForce to test Cocktail functionality.</div><div><br></div><div>More on faking can be found here:</div><div><br></div><div>http://drc.ideablade.com/devforce-2012/bin/view/Documentation/discovery-compositioncontext-fake</div><div><br></div><div>And here you can find information on how to configure Cocktail to use the DevForce fake backing store:</div><div><br></div><div>http://drc.ideablade.com/devforce-2012/bin/view/Documentation/cocktail-entitymanager-provider</div>]]>
   </description>
   <pubDate>Thu, 21 Mar 2013 11:25:45 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4060&amp;PID=16088#16088</guid>
  </item> 
  <item>
   <title>DevForce is NUnit / Moq unfriendly : We have just started using DevForce...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4060&amp;PID=16067#16067</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1600" rel="nofollow">cypher</a><br /><strong>Subject:</strong> 4060<br /><strong>Posted:</strong> 20-Mar-2013 at 1:30am<br /><br />We have just started using DevForce / Cocktail for our new Project and we are trying to implement some Unit Tests for Cocktail.&nbsp;<div><br></div><div>We are always running into Situations, where we cant access or mock, stub ore fake some DevForce internals.&nbsp;</div><div><br></div><div>For example, we are trying to write a test, how the system behaves, when the user saves&nbsp;</div><div><br></div><div><div>&nbsp; &nbsp; &#091;TestMethod&#093;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; public void User_closes_with_changes_and_accept_dialog()</div><div>&nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // create mocks</div><div><span style="line-height: 1.4;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span>&nbsp; &nbsp; var saveResult = new Mock&lt;SaveResult&gt;(); // not mockable due tue internal constructor...</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var unitOfWork = new Mock&lt;IUnitOfWork&gt;();</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unitOfWork.Setup(p =&gt; p.CommitAsync()).Returns(Task.FromResult(saveResult)); // no way to mock it</div></div><div><br></div><div>Is there any know way how to mock or stub the SaveResult, to write some tests?</div><div><br></div>]]>
   </description>
   <pubDate>Wed, 20 Mar 2013 01:30:14 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4060&amp;PID=16067#16067</guid>
  </item> 
 </channel>
</rss>