-
Notifications
You must be signed in to change notification settings - Fork 675
Expand file tree
/
Copy pathPackageManagerExtensionLoadingTests.cs
More file actions
97 lines (89 loc) · 3.82 KB
/
Copy pathPackageManagerExtensionLoadingTests.cs
File metadata and controls
97 lines (89 loc) · 3.82 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows.Controls;
using CoreNodeModels.Input;
using Dynamo.Configuration;
using Dynamo.Graph.Nodes;
using Dynamo.Interfaces;
using Dynamo.Models;
using Dynamo.Scheduler;
using NUnit.Framework;
namespace DynamoCoreWpfTests.PackageManager
{
class PackageManagerExtensionLoadingTests : DynamoTestUIBase
{
private string PackagesDirectory { get { return Path.Combine(GetTestDirectory(ExecutingDirectory), "pkgs"); } }
protected override void GetLibrariesToPreload(List<string> libraries)
{
libraries.Add("ProtoGeometry.dll");
libraries.Add("DesignScriptBuiltin.dll");
libraries.Add("DSCoreNodes.dll");
base.GetLibrariesToPreload(libraries);
}
protected override DynamoModel.IStartConfiguration CreateStartConfiguration(IPathResolver pathResolver)
{
return new DynamoModel.DefaultStartConfiguration()
{
PathResolver = pathResolver,
StartInTestMode = true,
GeometryFactoryPath = preloader.GeometryFactoryPath,
ProcessMode = TaskProcessMode.Synchronous,
Preferences = new PreferenceSettings() { CustomPackageFolders = new List<string>() { PackagesDirectory } }
};
}
[Test]
public void PackageManagerLoadsAndAddsExtension()
{
Assert.That(Model.ExtensionManager.Extensions.Select(x => x.Name),
Is.EquivalentTo(new List<string> { "DynamoPackageManager", "DynamoMLDataPipelineExtension", "testExtension", "DSPythonNet3Extension" }));
}
[Test]
public void PackageManagerLoadsExtensionAndItWorks()
{
dynamic sampleExtension = Model.ExtensionManager.Extensions.Where(x => x.Name == "testExtension").FirstOrDefault();
var node = new DoubleInput();
Model.CurrentWorkspace.AddAndRegisterNode(node);
//assert the extension was keeping track of the node events in the workspace.
Assert.AreEqual(1, (sampleExtension.nodes as List<NodeModel>).Count());
}
[Test]
public void PackageManagerLoadsAndAddsViewExtension()
{
Assert.That(View.viewExtensionManager.ViewExtensions.OrderBy(x => x.Name).Select(x => x.Name),
Is.EquivalentTo(
new List<string>
{
"Autodesk Assistant",
"Documentation Browser",
"Dynamo MCP View Extension",
"DynamoManipulationExtension",
"Graph Node Manager",
"Graph Status",
"LibraryUI - WebView2",
"Notifications",
"Package Details",
"PackageManagerViewExtension",
"Properties",
"Python Migration",
"Sample View Extension",
"TuneUp",
"Workspace References",
"Node Auto Complete"
}
)
);
}
[Test]
public void PackageManagerLoadsViewExtensionAndItWorks()
{
dynamic sampleExtension = View.viewExtensionManager.ViewExtensions.Where(x => x.Name == "Sample View Extension").FirstOrDefault();
var node = new DoubleInput();
Model.CurrentWorkspace.AddAndRegisterNode(node);
//assert a menu item was added with the correct header.
var mi = View.ExtensionsMenu.Items.Cast<MenuItem>().Where
(x => (string)x.Header == "Show View Extension Sample Window").FirstOrDefault();
Assert.IsNotNull(mi);
}
}
}