6

I need to run unit tests against ArcMap extension which closely coupled with specific edit workspace and map state. When I try to initialize ArcMap 10 application with code like this:

ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Desktop);
IDocument pdoc = new MxDocumentClass();
_application = pdoc.Parent;

I receive error:

The runtime application type must be specified before license initialization

Is there any workaround or better way for unit testing?

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked May 1, 2012 at 13:49
2
  • Just curious, are you using a unit testing framework and if so which one? Are you mocking ArcObjects? Commented May 1, 2012 at 22:05
  • 1
    Using standard VS2010 testing framework. I'm not mocking AO, using ArcMap automation & PGDB. Later in my project, I plan to fascade AO with custom abstract API based on OGC Simple Feature. Then it will be more realistic to use mocking. Commented May 1, 2012 at 22:50

1 Answer 1

7

Adding this line fixes the issue

ESRI.ArcGIS.RuntimeManager.BindLicense(ESRI.ArcGIS.ProductCode.Desktop);
answered May 1, 2012 at 14:46

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.