-
Notifications
You must be signed in to change notification settings - Fork 56
/
HelloDynamoZeroTouchTests.cs
63 lines (54 loc) · 2.1 KB
/
HelloDynamoZeroTouchTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using System;
using Autodesk.DesignScript.Geometry;
using Autodesk.DesignScript.Runtime;
using NUnit.Framework;
using TestServices;
namespace SampleLibraryTests
{
// --------------------------------------------------
// NOTES ON GEOMETRY TESTING:
//
// In order to use the Dynamo geometry library during
// testing, the geometry library needs to be
// initialized. If you inherit from the
// GeometricTestBase class the initialization of the
// geometry library will be handled for you.
// In order to initialize the geometry library, Dynamo
// needs to know where your base install of Dynamo is
// located. Typically, a zero touch library doesn't
// need to know anything about Dynamo. But, to
// load the goemetry library we look in paths relative
// to your core Dynamo installation to find binaries
// that are required by the geometry library. To allow
// you to build your library anywhere on your machine
// we include a TestServices.dll.config file in the
// output directory. You need to set the "value"
// attribute in that config file to the base location
// of Dynamo.
// If you are making a library that does not utilize
// Dynamo's geometry library, then you do not need to
// inherit from GeometricTestBase, and you do not need
// to supply a config file with the core Dynamo install
// location.
// Wiki => https://github.com/DynamoDS/Dynamo/wiki/Writing-Unit-Test-Libraries-for-Dynamo
[TestFixture]
[IsVisibleInDynamoLibrary(false)]
class HelloDynamoZeroTouchTests : GeometricTestBase
{
[Test]
[Category("NEEDS_GEOM_LIB")]
public void PassingTest()
{
var myObject = Point.ByCoordinates(5, 5, 5);
Assert.NotNull(myObject);
}
[Test]
[Category("NEEDS_GEOM_LIB")]
public void FailingTest()
{
var p1 = Point.ByCoordinates(0, 0, 0);
var p2 = Point.ByCoordinates(0, 0, 0);
Assert.Throws<ApplicationException>(()=>Line.ByStartPointEndPoint(p1,p2));
}
}
}