Creating geometric unit tests

geometry

#1

Hello,

I am trying to follow the steps here to create geometric unit tests. I have a few problems:

  1. If the test fixture class inherits GeometricTestBase, NUnit does not recognise the test and therefore cannot run it.
  2. If it does not, NUnit recognises it but the code throws exceptions. Firstly it does not detect LibG.Interface, but after it is added to the reference, it shows the following.

System.NotImplementedException : The type initializer for ‘Autodesk.DesignScript.Geometry.ProtoGeometryConfigurationManager’ threw an exception.

My code is very simple.

using Autodesk.DesignScript.Geometry;
using NUnit.Framework;
using TestServices;

namespace TestCSharp
{
    [TestFixture]
    public class Program : GeometricTestBase
    {
        [Test]
        public void TestPoint()
        {
            Point p = Point.ByCoordinates(1, 1, 1);
        }
    }
}

I use Visual Studio 2017 on Windows 10, and the project uses the following packages.

  • CommonServiceLocator.1.3
  • DynamoVisualProgramming.Core.1.3.0
  • DynamoVisualProgramming.DynamoServices.1.3.0
  • DynamoVisualProgramming.Tests.1.3.0
  • DynamoVisualProgramming.ZeroTouchLibrary.1.3.0
  • NUnit.3.8.1
  • Prism.5.0.0
  • Prism.Composition.5.0.0
  • Prism.Interactivity.5.0.0
  • Prism.Mvvm.1.1.1
  • Prism.PubSubEvents.1.1.2

I understand that in Dynamo source code the geometric tests also inherit the GeometricTestBase class but so far I haven’t successfully built it.

I would be glad to receive any help to solve this problem, or see old posts related to this issue (unfortunately I haven’t found any).

Many thanks,
John


#2

Sorry for bumping, but will be glad to receive a hint or two.

Thanks,
John


#3

Hi all,

After a few months I revisited this issue and seems like I got some progress.

I installed an the old NUnit version 2.6.3 as well as the old runner (2.6.3) and adapter (2.1.1) and the test showed up in the test explorer.

A new problem that I encountered was the missing DLLs. Although I have specified “Version221” in TestServices.dll.config, the process still seems to request for a “libg_0” folder. Perhaps this thread is related. As written inside, I simply created this folder and copied the necessary DLLs. Having said this, I still received the following error:

Message: SetUp : System.IO.FileNotFoundException : Could not load file or assembly ‘LibG.Managed, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’ or one of its dependencies. The system cannot find the file specified.

although LibG.Managed.dll and, after using a dependency checker, its dependencies are already inside this folder.

I wonder if anyone can help me to solve this problem please?

Many thanks,
John