<?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: UnitTesting and ArcObjects 10 in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/unittesting-and-arcobjects-10/m-p/36034#M918</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That sounds very reasonble:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;So you needed to change the mode to STA.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you very much for the hint.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But I was looking for the "switch" to change to STA. Can you give me another hint, how to do it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you very much,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Yvo&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 05 Sep 2011 04:47:08 GMT</pubDate>
    <dc:creator>YvoWeidmann</dc:creator>
    <dc:date>2011-09-05T04:47:08Z</dc:date>
    <item>
      <title>UnitTesting and ArcObjects 10</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/unittesting-and-arcobjects-10/m-p/36030#M914</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Dear List&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to use UnitTests with the provided framework within VisualStudio 2010 and ArcGIS (ArcEditor) with C#.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The main problem seems the initializing of the ArcObjects. As soon as I am using an ArcObject object in a test method the following exception is thrown:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;System.Runtime.InteropServices.InvalidComObjectException: COM object that has been separated from its underlying RCW cannot be used.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As first I initialize the ArcObjects environment with a test method defined as [AssemblyInitialize]:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-----------------------------&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;private static AoInitialize aoInitialize;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[AssemblyInitialize]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;public static void AssemblyInitialize(TestContext context) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; RuntimeManager.BindLicense(ProductCode.EngineOrDesktop);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; aoInitialize = new AoInitializeClass();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; aoInitialize.Initialize(esriLicenseProductCode.esriLicenseProductCodeArcEditor);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-----------------------------&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The license is correctly checked out. But as mentioned, ArcObjects-based objects are throwing the InvalidComObjectException.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried several ways of initializing, but till now unsuccessfully.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does anyone has an idea? I am looking for any hint.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Yvo&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Aug 2011 08:34:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/unittesting-and-arcobjects-10/m-p/36030#M914</guid>
      <dc:creator>YvoWeidmann</dc:creator>
      <dc:date>2011-08-31T08:34:33Z</dc:date>
    </item>
    <item>
      <title>Re: UnitTesting and ArcObjects 10</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/unittesting-and-arcobjects-10/m-p/36031#M915</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I've not done much in the way of tests and haven't looked at this one in particular but wanted to share some things that I have seen in the past related to this. I know with VS 2008 by default Unit Test projects were set to execute in MTA mode. All ArcObjects components are marked as single threaded apartment (STA). STAs are limited to one thread each. So you needed to change the mode to STA. Also setting the runtime configuration manager to x86 may have an impact if you are running on a 64 bit system. Prior to VS 2010 SP1 new test projects would always target .NET 4.0 even if 3.5 was set in the new project dialog. .NET 4.0 won't be officially supported by ESRI until the ArcGIS 10.1 release. I would suggest that you also install SP1 for VS 2010 so you can properly target .NET 3.5.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope this helps!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Sep 2011 17:49:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/unittesting-and-arcobjects-10/m-p/36031#M915</guid>
      <dc:creator>JohnHauck</dc:creator>
      <dc:date>2011-09-02T17:49:20Z</dc:date>
    </item>
    <item>
      <title>Re: UnitTesting and ArcObjects 10</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/unittesting-and-arcobjects-10/m-p/36032#M916</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I use ArcObjects inside integration tests I have written using Visual Studio 2010 SP1 using the built-in C# unit test framework.&amp;nbsp; What I do is to initialize ArcObjects as part of the test, i.e. I have not tried any assembly level initialization.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't have the code in front of me but I think that I did use an attribute to try and force STA.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Oh, and I am using 9.3.1 but I would not think that that would make a difference (other than having to bind to a version).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you send me an email then I'll send you a code snippet when I get back to the office next Tuesday.&amp;nbsp; rwatson at telcoridia dot com.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Sep 2011 18:48:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/unittesting-and-arcobjects-10/m-p/36032#M916</guid>
      <dc:creator>RichardWatson</dc:creator>
      <dc:date>2011-09-02T18:48:11Z</dc:date>
    </item>
    <item>
      <title>Re: UnitTesting and ArcObjects 10</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/unittesting-and-arcobjects-10/m-p/36033#M917</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you email him, use telcordia, not telcoridia!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Sep 2011 18:51:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/unittesting-and-arcobjects-10/m-p/36033#M917</guid>
      <dc:creator>MelitaKennedy</dc:creator>
      <dc:date>2011-09-02T18:51:07Z</dc:date>
    </item>
    <item>
      <title>Re: UnitTesting and ArcObjects 10</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/unittesting-and-arcobjects-10/m-p/36034#M918</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That sounds very reasonble:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;So you needed to change the mode to STA.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you very much for the hint.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But I was looking for the "switch" to change to STA. Can you give me another hint, how to do it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you very much,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Yvo&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Sep 2011 04:47:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/unittesting-and-arcobjects-10/m-p/36034#M918</guid>
      <dc:creator>YvoWeidmann</dc:creator>
      <dc:date>2011-09-05T04:47:08Z</dc:date>
    </item>
    <item>
      <title>Re: UnitTesting and ArcObjects 10</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/unittesting-and-arcobjects-10/m-p/36035#M919</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Here is a Microsoft article that talks about how to &lt;/SPAN&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/ms404663.aspx"&gt;Run Unit Tests in MTA mode&lt;/A&gt;&lt;SPAN&gt;. You would just want to use STA instead.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Sep 2011 15:15:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/unittesting-and-arcobjects-10/m-p/36035#M919</guid>
      <dc:creator>JohnHauck</dc:creator>
      <dc:date>2011-09-06T15:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: UnitTesting and ArcObjects 10</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/unittesting-and-arcobjects-10/m-p/36036#M920</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Configure Visual Studio to use MTA.&amp;nbsp; The tests are run on different threads and ArcObjects do not handle this well.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Oct 2011 00:48:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/unittesting-and-arcobjects-10/m-p/36036#M920</guid>
      <dc:creator>RichardWatson</dc:creator>
      <dc:date>2011-10-13T00:48:04Z</dc:date>
    </item>
    <item>
      <title>Re: UnitTesting and ArcObjects 10</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/unittesting-and-arcobjects-10/m-p/36037#M921</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm having similar problems with 10.1 (final release) and unit testing of ArcObject code. The license retrieval and usage is causing problems. Anybody found a proper way to initialize the license and keep it active during the tests while running the geoprocessor and arcobjects tools in STA ? I tried different things but haven't found a solution so far. Any tips or tricks would be helpful.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Aug 2012 17:35:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/unittesting-and-arcobjects-10/m-p/36037#M921</guid>
      <dc:creator>BKuiper</dc:creator>
      <dc:date>2012-08-01T17:35:21Z</dc:date>
    </item>
    <item>
      <title>Re: UnitTesting and ArcObjects 10</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/unittesting-and-arcobjects-10/m-p/36038#M922</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;so after a while nobody has a solution?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Nobody got a reply from Esri. Inc?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am struggling with the issue too...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Aug 2012 11:20:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/unittesting-and-arcobjects-10/m-p/36038#M922</guid>
      <dc:creator>MannusEtten</dc:creator>
      <dc:date>2012-08-17T11:20:19Z</dc:date>
    </item>
    <item>
      <title>Re: UnitTesting and ArcObjects 10</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/unittesting-and-arcobjects-10/m-p/36039#M923</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I use VS2008 but I put the AO license and product initialization in the ClassInitialize method of the test class with the appropriate method decorator.&amp;nbsp; I have never done it in the Assembly initialize method.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Aug 2012 13:39:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/unittesting-and-arcobjects-10/m-p/36039#M923</guid>
      <dc:creator>AlexanderGray</dc:creator>
      <dc:date>2012-08-17T13:39:20Z</dc:date>
    </item>
    <item>
      <title>Re: UnitTesting and ArcObjects 10</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/unittesting-and-arcobjects-10/m-p/36040#M924</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I don't believe that this is related to the STA/MTA portion of this issue &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;(sorry for the bump, but this looks like the most directly related Unit Testing thread across the forums)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm getting hit by the following error every time I run into anything that initially sits in the &lt;/SPAN&gt;&lt;STRONG&gt;ESRI.ArcGIS.esriSystem&lt;/STRONG&gt;&lt;SPAN&gt; package (specifically UID/UIDClass and IPropertySet).&amp;nbsp; This will happen regardless of whether or not I attempt to access through a mocking framework (I'm currently using Rhino Mocks):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;Warning: Test Run deployment issue:&amp;nbsp; The assembly or module 'ESRI.DADF.Core' directly or indirectly referenced by the container 'C:\[MyArcGISAddinDeploymentDirectory]\editorassisttests.dll' was not found.&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have been working through the process of refactoring as much of my code to NOT use AO as much as possible, in the expectation that I could reach a target of around 80% code coverage (unit/integration test combo). But getting IEditor and IFeatureWorkspace are kind of tough to avoid.&amp;nbsp; If anyone has any guidance, I'd gladly accept all the help I can get.&amp;nbsp; I'm fairly new to Unit Testing, and trying to learn it in the wild by translating java examples across to AO is a little bit of a brain drain.&amp;nbsp; Below are a couple code examples of simple situations that I'm using to just verify that I can get these "things".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [TestMethod()]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void CheckLayoutView_ReturnsIFeatureWorkspaceType () {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MockRepository mockrepo = new MockRepository();

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IPlotDocument plotter = mockrepo.DynamicMock&amp;lt;PlotDocumentGeneratorClass&amp;gt;();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IFeatureWorkspace transworkspace = plotter.SetCurrentWorkspace();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Assert.IsInstanceOfType(transworkspace, typeof(ESRI.ArcGIS.Geodatabase.IFeatureWorkspace));
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [TestMethod()]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void GetEditor_MockingTest () {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MockRepository mockrepo = new MockRepository();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PlotDocumentGeneratorClass plotter = new PlotDocumentGeneratorClass();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UID test = mockrepo.StrictMock&amp;lt;UID&amp;gt;();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Assert.IsNotNull(test);

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [TestMethod()]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void GetWorkspace_ReturnsNotNull () {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PlotDocumentGeneratorClass plotter = new PlotDocumentGeneratorClass();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IFeatureWorkspace ws = plotter.GetWorkspace("LBADGEROW", "C:\\", false);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Assert.IsNotNull(ws);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:24:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/unittesting-and-arcobjects-10/m-p/36040#M924</guid>
      <dc:creator>LukeBadgerow</dc:creator>
      <dc:date>2021-12-10T21:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: UnitTesting and ArcObjects 10</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/unittesting-and-arcobjects-10/m-p/36041#M925</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I don't have 10.0 installed at the moment.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Where is ESRI.DADF.Core on your system?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Suggest that you run fuslogvw to see why the references assembly was not found.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How does your project reference this assembly?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Aug 2012 13:30:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/unittesting-and-arcobjects-10/m-p/36041#M925</guid>
      <dc:creator>RichardWatson</dc:creator>
      <dc:date>2012-08-20T13:30:47Z</dc:date>
    </item>
    <item>
      <title>Re: UnitTesting and ArcObjects 10</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/unittesting-and-arcobjects-10/m-p/36042#M926</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the quick response!&amp;nbsp; Here is where I'm at now:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I was also receiving a warning that I was neglecting to address (I've currently also got a separate issue where the addin cannot access our SOA upon deployment) that was suggesting that I switch the Embed Interop Types property to false on the AO packages for the [testing] project.&amp;nbsp; Once I did that I was able to at least create mock AO instances (UIDClass, IPropertySet2, IApplication).&amp;nbsp; With a little bit of refactoring I am able to pass the Mock instances of UIDClass and IApplication into the method that I'm attempting to test, but I'm currently working through setting the "esriEditor.Editor" Value to my mock UIDClass correctly&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public IEditor GetEditor (UID uid, IApplication app) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IEditor editor = null;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; editor = app.FindExtensionByCLSID(uid) as IEditor;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return editor;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [TestMethod()]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void GetEditor_MockingTest () {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MockRepository mockrepo = new MockRepository();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PlotDocumentGeneratorClass plotter = new PlotDocumentGeneratorClass();

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UID testuid = mockrepo.StrictMockWithRemoting&amp;lt;UIDClass&amp;gt;();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; testuid.Value = "esriEditor.Editor";
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IApplication testapp = mockrepo.StrictMock&amp;lt;IApplication&amp;gt;();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IEditor testeditor = plotter.GetEditor(testuid, testapp);

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Assert.IsNotNull(testeditor);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:24:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/unittesting-and-arcobjects-10/m-p/36042#M926</guid>
      <dc:creator>LukeBadgerow</dc:creator>
      <dc:date>2021-12-10T21:24:02Z</dc:date>
    </item>
    <item>
      <title>Re: UnitTesting and ArcObjects 10</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/unittesting-and-arcobjects-10/m-p/36043#M927</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;which mocking-framework do you use Luke?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So when I do AOInitialize at classinitiliaze i am rid of my problems?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Aug 2012 11:22:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/unittesting-and-arcobjects-10/m-p/36043#M927</guid>
      <dc:creator>MannusEtten</dc:creator>
      <dc:date>2012-08-24T11:22:49Z</dc:date>
    </item>
    <item>
      <title>Re: UnitTesting and ArcObjects 10</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/unittesting-and-arcobjects-10/m-p/36044#M928</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;which mocking-framework do you use Luke?&lt;BR /&gt;&lt;BR /&gt;So when I do AOInitialize at classinitiliaze i am rid of my problems?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Apologies for the long delay in responding.&amp;nbsp; Currently I'm using Rhino Mocks, but as I expand my unit/integration tests for this group of projects, I'm starting to run into a few issues (Namely with building my MSTest project on a deployment server) and am starting to contemplate switching all of that architecture up.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I haven't run AOInitialize as yet.&amp;nbsp; I have previously been attempting to keep as much AO logic from bleeding into my testing work as possible.&amp;nbsp; Considering I'm trying to test business logic, and am often disconnected from my license server, it's beneficial for me to isolate out the AO as much as possible.&amp;nbsp; I will fire up some tests with it though and get back with you.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Nov 2012 14:05:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/unittesting-and-arcobjects-10/m-p/36044#M928</guid>
      <dc:creator>LukeBadgerow</dc:creator>
      <dc:date>2012-11-09T14:05:37Z</dc:date>
    </item>
  </channel>
</rss>

