What exactly?
Good Question. Thank you, you made me think about it a lot more because I didn't have an instant "good answer".
You could use the Test runner in that app to run a set of tests inside AutoCAD that needed AutoCAD objects. These test would be a different set of test than you would run in something like NUnit against your code that has no external dependencies. The more I think about this the more I think it is a bad idea, mostly because it is too different from the normal, accepted way of doing things.
Can MSVS use the Gallio platform also? Did you try it?
Older versions of ReSharper had a test runners for Gallio. That's not a big deal, really, I don't mind using other Test Runners. NUnit's test runner can run a batch of tests so I can build all the different versions of an app and then run all the tests at once in NUnit. Gallio's Test runners look good, from what I have seen.
I looked at Gallio's source code but I have not tried it yet. My concern is that
development has stopped on it. I could update it myself as it is on Github at
https://github.com/Gallio/mbunit-v3/commits/master but that looks like it would be a lot of work in the future. Gallio is very big and complex and could easily turn out being more work to maintain than my projects I am supposed to be working on. Test frameworks like NUnit and XUnit are still very active and popular. Popular frameworks have a lot more support, code samples, documentation (Gallio's documentation is gone, only on the Web Archive).
I am currently considering using
http://nsubstitute.github.io/ to use fake AutoCAD objects. NSubstitute builds fake objects from Interfaces, It is possible to build Interfaces for AutoCAD managed objects by decompiling AutoCAD's managed wrapper DLLs (I used
Dotpeek) then use ReSharper to extract an Interface from the classes you want to fake (Resharper also extracts Interface members from the class's dependencies so you get a lot of members). It would probably be easier to just make the Interfaces yourself if they were simple.
I know that testing code with external dependencies is considered bad by unit-testing purists but I would also like to test the expected behaviour of those objects. Creating something like a fake DBText would allow me to set its properties and then test that my code is using those properties as I expect. Using fakes would also allow me to ignore any other behaviour I am not interested in testing...and probably save me from a lot of acad.exe crashes.
For those of you who got nervous when I mentioned decompiling AutoCAD DLLs, there is a precedent for this:
http://adndevblog.typepad.com/autocad/2012/08/a-rich-source-of-autocad-net-sample-code.html and also at
http://through-the-interface.typepad.com/through_the_interface/2010/02/debugging-into-autocads-net-api-layer-using-reflector-part-1.html - I'm not reverse-engineering AutoCAD, merely deconstructing it to test things. Well, that's my story.
@Andrey - I tried to keep my language clear here because I know your first language is not English, please let me know if anything is not clear to you. I would like to hear your thoughts on this.