diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3748c0a..d1e6f1f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,3 +60,26 @@ jobs: Write-Error "$path was not found!" } } + - name: Get DynamoRuntime from s3 + run: | + curl -o DynamoRuntime.zip https://dyn-builds-data.s3-us-west-2.amazonaws.com/DynamoCoreRuntime_3.1.0.4081_20240212T2057.zip + ls + - name: Extract DynamoRuntime + run: | + 7z x DynamoRuntime.zip -o${{ github.workspace }}\DynamoSamples\src\SampleLibraryTests\bin\Release\DynamoRuntime + + - name: Run test with the dotnet CLI + run: | + dotnet test ${{ github.workspace }}\DynamoSamples\src\SampleLibraryTests -p:Configuration=Release --filter "TestCategory!=Failure&TestCategory!=NEEDS_GEOM_LIB" --logger "trx;LogFileName=results.trx" --results-directory ${{ github.workspace }}\DynamoSamples\TestResults + - name: Upload build artifact + uses: actions/upload-artifact@v3.1.3 + with: + name: DynamoSamples + path: ${{ github.workspace }}\DynamoSamples\dynamo_package + retention-days: 7 + - name: Upload test artifact + uses: actions/upload-artifact@v3.1.3 + with: + name: TestResults + path: ${{ github.workspace }}\DynamoSamples\TestResults + retention-days: 1 \ No newline at end of file diff --git a/src/Config/CS.props b/src/Config/CS.props index 07ee8e9..cc62aa7 100644 --- a/src/Config/CS.props +++ b/src/Config/CS.props @@ -3,7 +3,6 @@ Debug AnyCPU x64 - net8.0 512 false false diff --git a/src/Directory.Build.props b/src/Directory.Build.props new file mode 100644 index 0000000..daf5058 --- /dev/null +++ b/src/Directory.Build.props @@ -0,0 +1,10 @@ + + + + $(MSBuildThisFileDirectory)\ + + diff --git a/src/SampleExtension/SampleExtension.csproj b/src/SampleExtension/SampleExtension.csproj index fb4c133..249af7b 100644 --- a/src/SampleExtension/SampleExtension.csproj +++ b/src/SampleExtension/SampleExtension.csproj @@ -6,6 +6,7 @@ Debug SampleExtension SampleExtension + net8.0 true @@ -16,6 +17,6 @@ - + \ No newline at end of file diff --git a/src/SampleIntegration/SampleIntegration.csproj b/src/SampleIntegration/SampleIntegration.csproj index e8d5ac6..9c549c7 100644 --- a/src/SampleIntegration/SampleIntegration.csproj +++ b/src/SampleIntegration/SampleIntegration.csproj @@ -5,6 +5,7 @@ SampleIntegration SampleIntegration + net8.0 diff --git a/src/SampleLibraryTests/HelloDynamoSystemTest.dyn b/src/SampleLibraryTests/HelloDynamoSystemTest.dyn index 555ce32..11bd319 100644 --- a/src/SampleLibraryTests/HelloDynamoSystemTest.dyn +++ b/src/SampleLibraryTests/HelloDynamoSystemTest.dyn @@ -1,18 +1,235 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file +{ + "Uuid": "3c9d0464-8643-5ffe-96e5-ab1769818209", + "IsCustomNode": false, + "Description": "", + "Name": "HelloDynamoSystemTest", + "ElementResolver": { + "ResolutionMap": {} + }, + "Inputs": [], + "Outputs": [], + "Nodes": [ + { + "ConcreteType": "CoreNodeModels.Watch, CoreNodeModels", + "WatchWidth": 35.0, + "WatchHeight": 38.0, + "Id": "2c4cdf29f078497c86b8fed323f4b77d", + "NodeType": "ExtensionNode", + "Inputs": [ + { + "Id": "a249fef4a4ce43ed9fa47a4ace364c8c", + "Name": "", + "Description": "Node to show output from", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Outputs": [ + { + "Id": "6bb8cd0394254f268082f176f97a233a", + "Name": "", + "Description": "Node output", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled", + "Description": "Visualizes a node's output" + }, + { + "ConcreteType": "Dynamo.Graph.Nodes.ZeroTouch.DSFunction, DynamoCore", + "Id": "4964a3edb14b46dd8e614d64fad42128", + "NodeType": "FunctionNode", + "Inputs": [ + { + "Id": "2e564722e153444292ce3cf2fd1ea4df", + "Name": "x", + "Description": "Integer value, double value or string\n\nvar[]..[]", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + }, + { + "Id": "c878418229554a8081a2add69a669b4c", + "Name": "y", + "Description": "Integer value, double value or string\n\nvar[]..[]", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Outputs": [ + { + "Id": "f648d8c8b1b7407eb51174f21f2d4908", + "Name": "var", + "Description": "The sum of two input numbers, or the concatenation of two strings", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "FunctionSignature": "+@var[]..[],var[]..[]", + "Replication": "Auto", + "Description": "Returns addition of x and y\n\n+ (x: var[]..[], y: var[]..[]): var[]..[]" + }, + { + "ConcreteType": "CoreNodeModels.Input.DoubleInput, CoreNodeModels", + "NumberType": "Double", + "Id": "77af56fb6e37432485e008870d79cb40", + "NodeType": "NumberInputNode", + "Inputs": [], + "Outputs": [ + { + "Id": "982234929f014a7dacf16d38836763a1", + "Name": "", + "Description": "Double", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled", + "Description": "Creates a number", + "InputValue": 21.0 + }, + { + "ConcreteType": "CoreNodeModels.Input.DoubleInput, CoreNodeModels", + "NumberType": "Double", + "Id": "a603bf1480404297bea85441d71645ed", + "NodeType": "NumberInputNode", + "Inputs": [], + "Outputs": [ + { + "Id": "e57dc497431840b98db808aca08d846b", + "Name": "", + "Description": "Double", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled", + "Description": "Creates a number", + "InputValue": 21.0 + } + ], + "Connectors": [ + { + "Start": "f648d8c8b1b7407eb51174f21f2d4908", + "End": "a249fef4a4ce43ed9fa47a4ace364c8c", + "Id": "b47128bfe4304b74a01f7b8db90d2c34", + "IsHidden": "False" + }, + { + "Start": "982234929f014a7dacf16d38836763a1", + "End": "2e564722e153444292ce3cf2fd1ea4df", + "Id": "73b3eba3b10e4b1f86c836c5164e01e9", + "IsHidden": "False" + }, + { + "Start": "e57dc497431840b98db808aca08d846b", + "End": "c878418229554a8081a2add69a669b4c", + "Id": "0ebc660b634b4281814460827fd4fa78", + "IsHidden": "False" + } + ], + "Dependencies": [], + "NodeLibraryDependencies": [], + "EnableLegacyPolyCurveBehavior": null, + "Thumbnail": null, + "GraphDocumentationURL": null, + "ExtensionWorkspaceData": [ + { + "ExtensionGuid": "28992e1d-abb9-417f-8b1b-05e053bee670", + "Name": "Properties", + "Version": "3.1", + "Data": {} + } + ], + "Author": "None provided", + "Linting": { + "activeLinter": "None", + "activeLinterId": "7b75fb44-43fd-4631-a878-29f4d5d8399a", + "warningCount": 0, + "errorCount": 0 + }, + "Bindings": [], + "View": { + "Dynamo": { + "ScaleFactor": 1.0, + "HasRunWithoutCrash": true, + "IsVisibleInDynamoLibrary": true, + "Version": "3.1.0.3755", + "RunType": "Manual", + "RunPeriod": "1000" + }, + "Camera": { + "Name": "_Background Preview", + "EyeX": -17.0, + "EyeY": 24.0, + "EyeZ": 50.0, + "LookX": 12.0, + "LookY": -13.0, + "LookZ": -58.0, + "UpX": 0.0, + "UpY": 1.0, + "UpZ": 0.0 + }, + "ConnectorPins": [], + "NodeViews": [ + { + "Id": "2c4cdf29f078497c86b8fed323f4b77d", + "Name": "Watch", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 613.408069206988, + "Y": 243.832684826672 + }, + { + "Id": "4964a3edb14b46dd8e614d64fad42128", + "Name": "+", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 404.715400784895, + "Y": 238.891755796865 + }, + { + "Id": "77af56fb6e37432485e008870d79cb40", + "Name": "Number", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 159.40168436709547, + "Y": 106.14571181066069 + }, + { + "Id": "a603bf1480404297bea85441d71645ed", + "Name": "Number", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 157.2343691937667, + "Y": 282.8144436335819 + } + ], + "Annotations": [], + "X": 146.89726815586, + "Y": 9.96610837046791, + "Zoom": 1.05281788169755 + } +} \ No newline at end of file diff --git a/src/SampleLibraryTests/HelloDynamoZeroTouchTests.cs b/src/SampleLibraryTests/HelloDynamoZeroTouchTests.cs index 3332288..9fcbd12 100644 --- a/src/SampleLibraryTests/HelloDynamoZeroTouchTests.cs +++ b/src/SampleLibraryTests/HelloDynamoZeroTouchTests.cs @@ -44,6 +44,7 @@ namespace SampleLibraryTests class HelloDynamoZeroTouchTests : GeometricTestBase { [Test] + [Category("NEEDS_GEOM_LIB")] public void PassingTest() { var myObject = Point.ByCoordinates(5, 5, 5); @@ -51,6 +52,7 @@ public void PassingTest() } [Test] + [Category("NEEDS_GEOM_LIB")] public void FailingTest() { var p1 = Point.ByCoordinates(0, 0, 0); diff --git a/src/SampleLibraryTests/Properties/AssemblyInfo.cs b/src/SampleLibraryTests/Properties/AssemblyInfo.cs index 4a4e84a..2ff505a 100644 --- a/src/SampleLibraryTests/Properties/AssemblyInfo.cs +++ b/src/SampleLibraryTests/Properties/AssemblyInfo.cs @@ -1,9 +1,14 @@ -using System.Reflection; -using System.Runtime.CompilerServices; +using NUnit.Framework; +using System.Reflection; using System.Runtime.InteropServices; +using System.Threading; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("SampleLibraryTests")] [assembly: Guid("c3d8c6fc-62ad-4272-91a9-492be76577e5")] + +// The RequiresThread(ApartmentState.STA) attribute is required by +// NUNit to run all tests, that use the UI, on the same thread. +[assembly: RequiresThread(ApartmentState.STA)] \ No newline at end of file diff --git a/src/SampleLibraryTests/RectangleUnitsExample.dyn b/src/SampleLibraryTests/RectangleUnitsExample.dyn new file mode 100644 index 0000000..3952197 --- /dev/null +++ b/src/SampleLibraryTests/RectangleUnitsExample.dyn @@ -0,0 +1,616 @@ +{ + "Uuid": "3ac347e0-9d70-4b12-b979-f0727b83d645", + "IsCustomNode": false, + "Description": "", + "Name": "RectangleUnitsExample", + "ElementResolver": { + "ResolutionMap": {} + }, + "Inputs": [], + "Outputs": [], + "Nodes": [ + { + "ConcreteType": "Dynamo.Graph.Nodes.ZeroTouch.DSFunction, DynamoCore", + "Id": "1468a989f8d8470d8a1891ffe2a63c04", + "NodeType": "FunctionNode", + "Inputs": [ + { + "Id": "523c2c6971f34847968b5910114b17c5", + "Name": "width", + "Description": "double", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + }, + { + "Id": "342cfe4682354c68bbf2b6111463608c", + "Name": "length", + "Description": "double", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Outputs": [ + { + "Id": "c6fe1be34aa94c2c90c94a6eb687068f", + "Name": "RectangleExample", + "Description": "RectangleExample", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "FunctionSignature": "SampleZeroTouchUnits.RectangleExample.RectangleExample@double,double", + "Replication": "Auto", + "Description": "RectangleExample.RectangleExample (width: double, length: double): RectangleExample" + }, + { + "ConcreteType": "CoreNodeModels.Input.DoubleInput, CoreNodeModels", + "NumberType": "Double", + "Id": "ed3d204c241345fba0b32a7aa03ee3c9", + "NodeType": "NumberInputNode", + "Inputs": [], + "Outputs": [ + { + "Id": "d38f49da7d684924a77eeb9cc49833f9", + "Name": "", + "Description": "Double", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled", + "Description": "Creates a number", + "InputValue": 10.0 + }, + { + "ConcreteType": "CoreNodeModels.Input.DoubleInput, CoreNodeModels", + "NumberType": "Double", + "Id": "c9ac861739704856bbe0adaa53c14bbf", + "NodeType": "NumberInputNode", + "Inputs": [], + "Outputs": [ + { + "Id": "f374de24406041318a14a9a45588b464", + "Name": "", + "Description": "Double", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled", + "Description": "Creates a number", + "InputValue": 5.0 + }, + { + "ConcreteType": "Dynamo.Graph.Nodes.ZeroTouch.DSFunction, DynamoCore", + "Id": "c71a8875053e4e11b8caa8c89f7d2f5b", + "NodeType": "FunctionNode", + "Inputs": [ + { + "Id": "01e1ca45e9d949b39fb78704b084485c", + "Name": "rectangleExample", + "Description": "SampleZeroTouchUnits.RectangleExample", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + }, + { + "Id": "6f8baaafc728429f8816c0ca7f109688", + "Name": "targetUnit", + "Description": "Unit", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Outputs": [ + { + "Id": "660c8e52a9724e9eb3826e45b364304a", + "Name": "double", + "Description": "double", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "FunctionSignature": "SampleZeroTouchUnits.RectangleExample.GetLength@DynamoUnits.Unit", + "Replication": "Auto", + "Description": "RectangleExample.GetLength (targetUnit: Unit): double" + }, + { + "ConcreteType": "Dynamo.Graph.Nodes.ZeroTouch.DSFunction, DynamoCore", + "Id": "225fd1f75d68410f8a3b41f589105447", + "NodeType": "FunctionNode", + "Inputs": [ + { + "Id": "a39eac5d78a045fdbbeb5ea85a7704ca", + "Name": "rectangleExample", + "Description": "SampleZeroTouchUnits.RectangleExample", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + }, + { + "Id": "0cb47f72df45457bad4583e55b88824b", + "Name": "targetUnit", + "Description": "Unit", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Outputs": [ + { + "Id": "7cae6a8028f24be48c1313ef8d3135b6", + "Name": "double", + "Description": "double", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "FunctionSignature": "SampleZeroTouchUnits.RectangleExample.GetWidth@DynamoUnits.Unit", + "Replication": "Auto", + "Description": "RectangleExample.GetWidth (targetUnit: Unit): double" + }, + { + "ConcreteType": "Dynamo.Graph.Nodes.ZeroTouch.DSFunction, DynamoCore", + "Id": "aa5a7e113ff94999922b1e4d14295c4d", + "NodeType": "FunctionNode", + "Inputs": [ + { + "Id": "d4d1e255723246a6b3d87c073d1c2f5e", + "Name": "rectangleExample", + "Description": "SampleZeroTouchUnits.RectangleExample", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + }, + { + "Id": "e9cdb2478e374180b9b721f30c1066ec", + "Name": "targetUnit", + "Description": "Unit", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Outputs": [ + { + "Id": "2bcd40f1919841f7b19d3279db495ec1", + "Name": "string", + "Description": "string", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "FunctionSignature": "SampleZeroTouchUnits.RectangleExample.GetArea@DynamoUnits.Unit", + "Replication": "Auto", + "Description": "RectangleExample.GetArea (targetUnit: Unit): string" + }, + { + "ConcreteType": "UnitsUI.Units, UnitsNodeModels", + "SelectedIndex": 25, + "SelectedString": "Centimeters", + "Id": "e4c3a5250ea4473d99bb4e046319a6bf", + "NodeType": "ExtensionNode", + "Inputs": [], + "Outputs": [ + { + "Id": "b247c85016d648ed96695930382df729", + "Name": "Unit", + "Description": "The selected Unit", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled", + "Description": "Select a Unit type" + }, + { + "ConcreteType": "UnitsUI.Units, UnitsNodeModels", + "SelectedIndex": 199, + "SelectedString": "Meters", + "Id": "f795ea681a5f496ba73ec083e8ddff00", + "NodeType": "ExtensionNode", + "Inputs": [], + "Outputs": [ + { + "Id": "a4bcecb84c4b4c42b58c8887e48441b8", + "Name": "Unit", + "Description": "The selected Unit", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled", + "Description": "Select a Unit type" + }, + { + "ConcreteType": "UnitsUI.Units, UnitsNodeModels", + "SelectedIndex": 295, + "SelectedString": "Square feet", + "Id": "69941e465d0a447482ff87f7d208fdc8", + "NodeType": "ExtensionNode", + "Inputs": [], + "Outputs": [ + { + "Id": "6fd7cb28a036466295fa375667bed5a4", + "Name": "Unit", + "Description": "The selected Unit", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled", + "Description": "Select a Unit type" + }, + { + "ConcreteType": "CoreNodeModels.Watch, CoreNodeModels", + "WatchWidth": 42.0, + "WatchHeight": 38.0, + "Id": "15b2e81d84df4a17ae348ee982ab87d9", + "NodeType": "ExtensionNode", + "Inputs": [ + { + "Id": "8958560939ac47f28472e3d20917fe1d", + "Name": "", + "Description": "Node to show output from", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Outputs": [ + { + "Id": "fd6fa7d1a0f84b53bc403b0bc71a0c47", + "Name": "", + "Description": "Node output", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled", + "Description": "Visualizes a node's output" + }, + { + "ConcreteType": "CoreNodeModels.Watch, CoreNodeModels", + "WatchWidth": 28.0, + "WatchHeight": 38.0, + "Id": "77e2a5bb3d464c5694f444ea1e064deb", + "NodeType": "ExtensionNode", + "Inputs": [ + { + "Id": "a4b19c323ae04f139046bf61232ffb65", + "Name": "", + "Description": "Node to show output from", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Outputs": [ + { + "Id": "1c4ff92ffdaa42d3b31484717ae29926", + "Name": "", + "Description": "Node output", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled", + "Description": "Visualizes a node's output" + }, + { + "ConcreteType": "CoreNodeModels.Watch, CoreNodeModels", + "WatchWidth": 170.0, + "WatchHeight": 38.0, + "Id": "bbb9d9f6be8e498e8b9cb8cae214c921", + "NodeType": "ExtensionNode", + "Inputs": [ + { + "Id": "69d539c959d04a4faaccd014bde7ca31", + "Name": "", + "Description": "Node to show output from", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Outputs": [ + { + "Id": "b6add764bf564344a4f3fa93f3108a8f", + "Name": "", + "Description": "Node output", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled", + "Description": "Visualizes a node's output" + } + ], + "Connectors": [ + { + "Start": "c6fe1be34aa94c2c90c94a6eb687068f", + "End": "01e1ca45e9d949b39fb78704b084485c", + "Id": "40f11139baf94cc7b0a741c070987e25", + "IsHidden": "False" + }, + { + "Start": "c6fe1be34aa94c2c90c94a6eb687068f", + "End": "a39eac5d78a045fdbbeb5ea85a7704ca", + "Id": "0638b5e3dec84aef90079122f4dd20f1", + "IsHidden": "False" + }, + { + "Start": "c6fe1be34aa94c2c90c94a6eb687068f", + "End": "d4d1e255723246a6b3d87c073d1c2f5e", + "Id": "7cbc02d5c04140fd9fa2addf9a620e84", + "IsHidden": "False" + }, + { + "Start": "d38f49da7d684924a77eeb9cc49833f9", + "End": "523c2c6971f34847968b5910114b17c5", + "Id": "797a725db51c426782fd50dce6cfaada", + "IsHidden": "False" + }, + { + "Start": "f374de24406041318a14a9a45588b464", + "End": "342cfe4682354c68bbf2b6111463608c", + "Id": "6da49122485442aa8a9d605741434d4e", + "IsHidden": "False" + }, + { + "Start": "660c8e52a9724e9eb3826e45b364304a", + "End": "8958560939ac47f28472e3d20917fe1d", + "Id": "9bd621413636438dba36c0e7c2deeea2", + "IsHidden": "False" + }, + { + "Start": "7cae6a8028f24be48c1313ef8d3135b6", + "End": "a4b19c323ae04f139046bf61232ffb65", + "Id": "1d162031b0fe4401afcf5c3b69cdbf11", + "IsHidden": "False" + }, + { + "Start": "2bcd40f1919841f7b19d3279db495ec1", + "End": "69d539c959d04a4faaccd014bde7ca31", + "Id": "2a220a5a2a68450c894a8963931783a9", + "IsHidden": "False" + }, + { + "Start": "b247c85016d648ed96695930382df729", + "End": "6f8baaafc728429f8816c0ca7f109688", + "Id": "b94c50890dcb42b78188ace645d66178", + "IsHidden": "False" + }, + { + "Start": "a4bcecb84c4b4c42b58c8887e48441b8", + "End": "0cb47f72df45457bad4583e55b88824b", + "Id": "2bdf345697d6455da45a27029ed58d75", + "IsHidden": "False" + }, + { + "Start": "6fd7cb28a036466295fa375667bed5a4", + "End": "e9cdb2478e374180b9b721f30c1066ec", + "Id": "de3724ee2ce04af0b9b9e512327fe096", + "IsHidden": "False" + } + ], + "Dependencies": [], + "NodeLibraryDependencies": [ + { + "Name": "SampleZeroTouchUnits.dll", + "ReferenceType": "ZeroTouch", + "Nodes": [ + "1468a989f8d8470d8a1891ffe2a63c04", + "c71a8875053e4e11b8caa8c89f7d2f5b", + "225fd1f75d68410f8a3b41f589105447", + "aa5a7e113ff94999922b1e4d14295c4d" + ] + } + ], + "EnableLegacyPolyCurveBehavior": null, + "Thumbnail": "", + "GraphDocumentationURL": null, + "ExtensionWorkspaceData": [ + { + "ExtensionGuid": "28992e1d-abb9-417f-8b1b-05e053bee670", + "Name": "Properties", + "Version": "3.1", + "Data": {} + } + ], + "Author": "", + "Linting": { + "activeLinter": "None", + "activeLinterId": "7b75fb44-43fd-4631-a878-29f4d5d8399a", + "warningCount": 0, + "errorCount": 0 + }, + "Bindings": [], + "View": { + "Dynamo": { + "ScaleFactor": 1.0, + "HasRunWithoutCrash": true, + "IsVisibleInDynamoLibrary": true, + "Version": "3.1.0.3411", + "RunType": "Automatic", + "RunPeriod": "1000" + }, + "Camera": { + "Name": "_Background Preview", + "EyeX": -17.0, + "EyeY": 24.0, + "EyeZ": 50.0, + "LookX": 12.0, + "LookY": -13.0, + "LookZ": -58.0, + "UpX": 0.0, + "UpY": 1.0, + "UpZ": 0.0 + }, + "ConnectorPins": [], + "NodeViews": [ + { + "Id": "1468a989f8d8470d8a1891ffe2a63c04", + "Name": "RectangleExample.RectangleExample", + "IsSetAsInput": false, + "IsSetAsOutput": true, + "Excluded": false, + "ShowGeometry": true, + "X": 561.5, + "Y": 33.5 + }, + { + "Id": "ed3d204c241345fba0b32a7aa03ee3c9", + "Name": "Number", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 339.11603418889285, + "Y": 35.62147890968433 + }, + { + "Id": "c9ac861739704856bbe0adaa53c14bbf", + "Name": "Number", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 350.15809208781684, + "Y": 163.6425078591463 + }, + { + "Id": "c71a8875053e4e11b8caa8c89f7d2f5b", + "Name": "RectangleExample.GetLength", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 1053.5, + "Y": 33.5 + }, + { + "Id": "225fd1f75d68410f8a3b41f589105447", + "Name": "RectangleExample.GetWidth", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 1052.5, + "Y": 192.5 + }, + { + "Id": "aa5a7e113ff94999922b1e4d14295c4d", + "Name": "RectangleExample.GetArea", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 1063.5, + "Y": 377.5 + }, + { + "Id": "e4c3a5250ea4473d99bb4e046319a6bf", + "Name": "Units", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 626.0, + "Y": 250.0 + }, + { + "Id": "f795ea681a5f496ba73ec083e8ddff00", + "Name": "Units", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 625.0, + "Y": 383.0 + }, + { + "Id": "69941e465d0a447482ff87f7d208fdc8", + "Name": "Units", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 623.0, + "Y": 519.0 + }, + { + "Id": "15b2e81d84df4a17ae348ee982ab87d9", + "Name": "Watch", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 1431.4173995248607, + "Y": 8.41299750528276 + }, + { + "Id": "77e2a5bb3d464c5694f444ea1e064deb", + "Name": "Watch", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 1429.1072443762355, + "Y": 189.94506627386255 + }, + { + "Id": "bbb9d9f6be8e498e8b9cb8cae214c921", + "Name": "Watch", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 1421.8472359898235, + "Y": 374.27115097662556 + } + ], + "Annotations": [], + "X": -42.2040696713932, + "Y": 53.81309391588489, + "Zoom": 0.5974870948157864 + } +} \ No newline at end of file diff --git a/src/SampleLibraryTests/SampleLibraryTests.csproj b/src/SampleLibraryTests/SampleLibraryTests.csproj index b4c12e0..f4928c8 100644 --- a/src/SampleLibraryTests/SampleLibraryTests.csproj +++ b/src/SampleLibraryTests/SampleLibraryTests.csproj @@ -12,10 +12,17 @@ - PreserveNewest + PreserveNewest + + + PreserveNewest + + + Always - + + \ No newline at end of file diff --git a/src/SampleLibraryTests/TestServices.dll.config b/src/SampleLibraryTests/TestServices.dll.config new file mode 100644 index 0000000..fb4d682 --- /dev/null +++ b/src/SampleLibraryTests/TestServices.dll.config @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/SampleLibraryTests/ZeroTouchUnitsSystemTests.cs b/src/SampleLibraryTests/ZeroTouchUnitsSystemTests.cs new file mode 100644 index 0000000..1e56dd7 --- /dev/null +++ b/src/SampleLibraryTests/ZeroTouchUnitsSystemTests.cs @@ -0,0 +1,80 @@ +using System.Collections.Generic; +using SystemTestServices; + +using Autodesk.DesignScript.Runtime; +using Dynamo.Graph.Nodes.ZeroTouch; +using Dynamo.Tests; + +using NUnit.Framework; + +namespace SampleLibraryTests +{ + /// + /// ZeroTouchUnitsSystemTests is a test fixture that contains + /// system tests for Dynamo using Units APIs. System tests test the entire + /// Dynamo system including the UI. They do this by starting + /// a session of Dynamo, then opening .dyn files, executing them + /// and comparing the values returned from Dynamo with those + /// stored on our test class. + /// + /// IMPORTANT! + /// System tests have dependencies on Dynamo core dlls. In + /// order for these tests to work, your test dll needs to be + /// located in the Dynamo core directory. The project currently assumes + /// that Dynamo is built in a directory adjacent to the DynamoSamples + /// repository, so a relative path is set to the debug build folder for Dynamo. + /// If your setup is different, then you will need to explicitly set the output path + /// to your Dynamo installation directory. + /// + [TestFixture] + + public class ZeroTouchUnitsSystemTests : SystemTestBase + { + protected override void GetLibrariesToPreload(List libraries) + { + libraries.Add("FunctionObject.ds"); + libraries.Add("BuiltIn.ds"); + libraries.Add("DSCoreNodes.dll"); + libraries.Add("VMDataBridge.dll"); + libraries.Add("DynamoConversions.dll"); + libraries.Add("DynamoUnits.dll"); + libraries.Add("DesignScriptBuiltin.dll"); + libraries.Add("..\\..\\..\\..\\dynamo_package\\Dynamo Samples\\bin\\SampleZeroTouchUnits.dll"); + base.GetLibrariesToPreload(libraries); + } + + // The RequiresSTA attribute is required by + // NUNit to run tests that use the UI. + [Test, Apartment(System.Threading.ApartmentState.STA)] + public void HelloRectangleUnitsTest() + { + // RectangleUnitsExample.dyn is a test .dyn file which + // should be copied to the output directory, so it's available + // for testing. You can also change this path to anywhere you + // would like to get your test file from, but it has to be + // a relative path from the dynamo core directory (the working directory). + + OpenAndRunDynamoDefinition(@".\RectangleUnitsExample.dyn"); + + // Ensure that the graph opened without any "dummy nodes". + // Dummy nodes would appear if your graph had a node that + // could not be found in the library. + + AssertNoDummyNodes(); + + // Get the nodes from the workspace. + var out1 = Model.CurrentWorkspace.NodeFromWorkspace("{15b2e81d-84df-4a17-ae34-8ee982ab87d9}") as CoreNodeModels.Watch; + var out2 = Model.CurrentWorkspace.NodeFromWorkspace("{77e2a5bb-3d46-4c56-94f4-44ea1e064deb}") as CoreNodeModels.Watch; + var out3 = Model.CurrentWorkspace.NodeFromWorkspace("{bbb9d9f6-be8e-498e-8b9c-b8cae214c921}") as CoreNodeModels.Watch; + Assert.NotNull(out1); + Assert.NotNull(out2); + Assert.NotNull(out3); + + // Ensure that the value of that node after evaluation is + // the value that we are looking for. + Assert.AreEqual(out1.CachedValue, 500); + Assert.AreEqual(out2.CachedValue, 5); + Assert.AreEqual(out3.CachedValue, "538.195520835486ft^2"); + } + } +} diff --git a/src/SampleLibraryUI/SampleLibraryUI.csproj b/src/SampleLibraryUI/SampleLibraryUI.csproj index 229eba6..348d7cb 100644 --- a/src/SampleLibraryUI/SampleLibraryUI.csproj +++ b/src/SampleLibraryUI/SampleLibraryUI.csproj @@ -24,9 +24,9 @@ - - - + + + diff --git a/src/SampleLibraryZeroTouch/SampleLibraryZeroTouch.csproj b/src/SampleLibraryZeroTouch/SampleLibraryZeroTouch.csproj index f18e7c4..5053700 100644 --- a/src/SampleLibraryZeroTouch/SampleLibraryZeroTouch.csproj +++ b/src/SampleLibraryZeroTouch/SampleLibraryZeroTouch.csproj @@ -6,15 +6,16 @@ Properties SampleLibraryZeroTouch SampleLibraryZeroTouch + net8.0 true bin\$(Configuration)\SampleLibraryZeroTouch.XML - - - + + + diff --git a/src/SampleLinter/SampleLinter.csproj b/src/SampleLinter/SampleLinter.csproj index bb592fc..3f14971 100644 --- a/src/SampleLinter/SampleLinter.csproj +++ b/src/SampleLinter/SampleLinter.csproj @@ -8,15 +8,16 @@ Copyright © 2023 2.0.1.0 2.0.1.0 + net8.0 true bin\$(Configuration)\ - - - + + + diff --git a/src/SampleViewExtension/SampleViewExtension.csproj b/src/SampleViewExtension/SampleViewExtension.csproj index a2b6881..ab6982a 100644 --- a/src/SampleViewExtension/SampleViewExtension.csproj +++ b/src/SampleViewExtension/SampleViewExtension.csproj @@ -10,9 +10,9 @@ true - - - + + + diff --git a/src/SampleZeroTouchUnits/RectangleExample.cs b/src/SampleZeroTouchUnits/RectangleExample.cs index a7be5fb..288ae02 100644 --- a/src/SampleZeroTouchUnits/RectangleExample.cs +++ b/src/SampleZeroTouchUnits/RectangleExample.cs @@ -13,7 +13,7 @@ namespace SampleZeroTouchUnits /// public class RectangleExample { - const string meters = "autodesk.unit.unit:meters"; + const string meters = "autodesk.unit.unit:meters"; const string meters2 = "autodesk.unit.unit:squareMeters"; /// @@ -31,10 +31,10 @@ public class RectangleExample private Unit AreaUnit; /// - /// + /// Creates an instance of RectangleExample with all units defaulted to metric /// - /// - /// + /// The width of RectangleExample, defaulted to meters + /// The length of RectangleExample, defaulted to meters public RectangleExample(double width, double length) { Length = length; @@ -45,12 +45,12 @@ public RectangleExample(double width, double length) } /// - /// + /// Creates an instance of RectangleExample with customizable untis /// - /// - /// - /// - /// + /// The width of RectangleExample + /// The length of RectangleExample + /// The unit for width + /// The unit for length public RectangleExample(double width, double length, Unit widthUnit, Unit lengthUnit) { Width = width; @@ -63,9 +63,9 @@ public RectangleExample(double width, double length, Unit widthUnit, Unit length } /// - /// + /// Get the length converted to a target unit. /// - /// + /// The target unit. Defaults to null /// /// public double GetLength(Unit targetUnit = null) @@ -83,9 +83,9 @@ public double GetLength(Unit targetUnit = null) } /// - /// + /// Get the width converted to a target unit. /// - /// + /// The target unit. Defaults to null /// /// public double GetWidth(Unit targetUnit) @@ -112,10 +112,10 @@ string GetFirstSymbolText(Unit unit) } /// - /// + /// Get the area of the rectangle. Computed as width * length /// - /// - /// + /// The target unit for the area value, defaults to null + /// A string containing the area value and unit symbol. Ex. "100ft^2" /// public string GetArea(Unit targetUnit = null) { diff --git a/src/SampleZeroTouchUnits/SampleZeroTouchUnits.csproj b/src/SampleZeroTouchUnits/SampleZeroTouchUnits.csproj index b739b86..b318676 100644 --- a/src/SampleZeroTouchUnits/SampleZeroTouchUnits.csproj +++ b/src/SampleZeroTouchUnits/SampleZeroTouchUnits.csproj @@ -6,15 +6,16 @@ Properties SampleZeroTouchUnits SampleZeroTouchUnits + net8.0 true bin\$(Configuration)\SampleZeroTouchUnits.XML - - - + + +