Unit Test GeometricTestBase Failing when geometry is created

zerotouch

#1

I am trying to implement unit tests using the geometry library, following all steps as indicated in https://github.com/DynamoDS/Dynamo/wiki/Writing-Unit-Test-Libraries-for-Dynamo.
The TestService.dll library gets loaded appropriately, but tests fail throwing an exception if any geometry object is created during the test:

Result StackTrace:	
at Autodesk.DesignScript.Geometry.HostFactory.get_Factory()
at Autodesk.DesignScript.Geometry.Point.ByCoordinates(Double x, Double y, Double z)
at Tests.HelloWorldTests.FailingTest() in C:\Users\****\HelloWorldTest.cs:line 27
Result Message:	System.NotImplementedException : Exception has been thrown by the target of an invocation.

Has anyone had this issue before? Any hints on how to solve it?

Thanks!
Alvaro


#2

@erfajo


#3

hi @alvpickmans,

Have you tried to see some of the tests in the Dynamo and DynamoRevit project at github: https://github.com/DynamoDS/Dynamo/tree/master/test

I have learned a lot from having those two projects downloaded to my local computer so I can traverse them from inside Visual Studio


#4

Hi @erfajo, I am quite familiar with the projects including DynamoSample, where there is a simple implementation of unit testing with GeometricBaseTest (it is actually almost the same code as the one I posted).

I agree with you that it is very helpful to have them locally and inspect them, but from the stacktrace error it seems that it has something to do with the geometry library.

It might have something to do with my Dynamo install, version 1.3.0.875, but I was just wondering if someone has had a similar issue and/or any reason why this might be happening.


#5

I think 1.3.0.875 is the issue hereā€¦ maybe @Michael_Kirschner2 can assist


#6

@alvpickmans what does your testServices.dll.config file look like? That sample might be a bit out of date I would try 222 - 224 for library version.


#7

also - I have not tested this in a while but I might be useful as an alternative testing method:


#8

@Michael_Kirschner2 I have tried with 220 to 222 with the same result:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="DynamoBasePath" value="C:\Program Files\Dynamo\Dynamo Core\1.3"/>
    <add key="RequestedLibraryVersion" value="Version222"/>
  </appSettings>
</configuration>

It seems to be loading properly, but throwing an exception only when starting HostFactory.
I will try to test on a different version of Dynamo and/or build it and try again.