I’m working on unit tests for Rhin/GH development and would like to know if there is any way to generate Rhino geometry data inside grasshopper and export them to a Unit Test environment (such as xUnit). I though on converting Rhino data to a .json file and import the data to the unit test project, not sure if it has a better way.
Any solution/idea is highly appreciated.
Thanks in advance,
what I usually do using xUnit is I use Assert.True with Rhino’s GeometryEquals method, that compares two different geometries (expected and actual).
Sometimes what I do is I serialize the geometry object and compare these two strings together with Assert.Equal.
Also sometimes it turns out that it is hard to unit test some specific geometry efficiently when you don’t see it in code. That’s when unit testing inside Grasshopper can be much better. I did one plugin some time ago for it: Brontosaurus | Food4Rhino
Using this plugin you can for example take the geometry, turn it to a mesh, internalize this mesh, and use its vertices (points) as Expected, while taking the actual vertices as Actual. For geometry purposes I find it the most handy way.
Oh boy, definitively will look at this, thanks a lot!