<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: nUnit fails to load assembly ESRI.ArcGIS.Version in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/nunit-fails-to-load-assembly-esri-arcgis-version/m-p/364027#M9583</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Use fuslogvw to diagnoise assembly loading problems.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 13 Oct 2011 00:42:30 GMT</pubDate>
    <dc:creator>RichardWatson</dc:creator>
    <dc:date>2011-10-13T00:42:30Z</dc:date>
    <item>
      <title>nUnit fails to load assembly ESRI.ArcGIS.Version</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/nunit-fails-to-load-assembly-esri-arcgis-version/m-p/364026#M9582</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello Unit Testers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm experimenting with MSTest (via VS2010) and nUnit for building .NET class libraries for large modular applications using Arc 10.&amp;nbsp; My main problem is described in the title, but since there's not a great deal of information on the subject I'd like to share a little of my experiences so far as part of the setup to my question.&amp;nbsp; (But if you just want to get to the point, you can go straight to the end of the post &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My goal is to have an automated build process check out the sources and run the unit tests.&amp;nbsp; I also want to be able to test 'internal' classes (internal scoped constructors), but I'm not looking to test private methods.&amp;nbsp; Based on various readings, this appears to be the most robust setup for the long term.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;MSTest works except for testing internal classes, which is a serious drawback.&amp;nbsp; The problem is that it seems to require a separate project externally referencing the class library under test.&amp;nbsp; For example, if you write some code and want to create a test, adding a new test in VS2010 actually creates a new project containing a template unit test class and adds it to the class lib solution.&amp;nbsp; (A variety of readings around the web indicate other less serious issues relating to MS's infamous version instability, as well as clarity of expressions, among others).&amp;nbsp; One interesting quirk is that, for me, the license manager only works when the tests are run in multi-threaded mode, unlike &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/38517-UnitTesting-and-ArcObjects-10?highlight=unit+test"&gt;the discussion here&lt;/A&gt;&lt;SPAN&gt; suggests.&amp;nbsp; Otherwise, an error is thrown indicating that the RCW has been separated from the underlying COM object.&amp;nbsp; There are some helpful discussions &lt;/SPAN&gt;&lt;A href="http://blogs.msdn.com/b/martijnh/archive/2009/12/31/unit-testing-com-object-that-has-been-separated-from-its-underlying-rcw-cannot-be-used.aspx"&gt;here&lt;/A&gt;&lt;SPAN&gt; and &lt;/SPAN&gt;&lt;A href="http://social.msdn.microsoft.com/Forums/en-US/vststest/thread/e53fdc45-23f3-4aee-aad9-f63769f2c638"&gt;here&lt;/A&gt;&lt;SPAN&gt;.&amp;nbsp; Based on these discussions, multi-threaded tests are the way to go for the short term, but it might be worth figuring out STA if this becomes the test environment for the long term.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;nUnit has a lot of good opinions around the web, and easily accommodates tests within the class library, and therefore tests that instantiate internal classes.&amp;nbsp; This would be my preferred route, except that Arc licensing fails when I run the tests.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The licensing fails just at the point of initializing the products, while trying to load the ESRI.ArcGIS.Version assembly.&amp;nbsp; The exact message is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;"Could not load file or assembly 'ESRI.ArcGIS.Version, Version=10.0.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86' or one of its dependencies. The system cannot find the file specified.":"ESRI.ArcGIS.Version, Version=10.0.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86"&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My licensing code is adapted from the LicenseInitializer snippet available in the console application template.&amp;nbsp; For example, create a new console application in VS, then click the Project menu, then "Add ArcGIS License Checking".&amp;nbsp; I'm confident the methodology is not a problem, plus there's the fact the same code works under MSTest.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So if anyone has any idea why nUnit might be failing here I'd be very grateful for your insights.&amp;nbsp; And of course comments on any of the above points are most welcome.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Chris.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Sep 2011 09:32:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/nunit-fails-to-load-assembly-esri-arcgis-version/m-p/364026#M9582</guid>
      <dc:creator>ChristopherBennett1</dc:creator>
      <dc:date>2011-09-22T09:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: nUnit fails to load assembly ESRI.ArcGIS.Version</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/nunit-fails-to-load-assembly-esri-arcgis-version/m-p/364027#M9583</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Use fuslogvw to diagnoise assembly loading problems.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Oct 2011 00:42:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/nunit-fails-to-load-assembly-esri-arcgis-version/m-p/364027#M9583</guid>
      <dc:creator>RichardWatson</dc:creator>
      <dc:date>2011-10-13T00:42:30Z</dc:date>
    </item>
  </channel>
</rss>

