Skip to content

Commit

Permalink
Update GraphNodeManagerViewExtensionTests.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
pinzart90 committed Feb 15, 2024
1 parent f20c50d commit e032d19
Showing 1 changed file with 15 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ namespace DynamoCoreWpfTests
{
public class GraphNodeManagerViewExtensionTests : DynamoTestUIBase
{
protected override void GetLibrariesToPreload(List<string> libraries)
{
libraries.Add("VMDataBridge.dll");
libraries.Add("DesignScriptBuiltin.dll");
libraries.Add("DSCoreNodes.dll");
base.GetLibrariesToPreload(libraries);
}


private string PackagesDirectory { get { return Path.Combine(GetTestDirectory(this.ExecutingDirectory), "pkgs"); } }

protected override DynamoModel.IStartConfiguration CreateStartConfiguration(IPathResolver pathResolver)
Expand Down Expand Up @@ -59,7 +68,6 @@ private void LoadExtension(GraphNodeManagerViewExtension v)
[Test]
public void ViewExtensionOpenTest()
{
RaiseLoadedEvent(this.View);
var extensionManager = View.viewExtensionManager;
var viewExtension = extensionManager.ViewExtensions
.FirstOrDefault(x => x as GraphNodeManagerViewExtension != null)
Expand All @@ -82,7 +90,6 @@ public void ViewExtensionOpenTest()
[Test]
public void CorrectNumberNodeItemsTest()
{
RaiseLoadedEvent(this.View);
var extensionManager = View.viewExtensionManager;
var viewExt = extensionManager.ViewExtensions
.FirstOrDefault(x => x as GraphNodeManagerViewExtension != null)
Expand All @@ -102,7 +109,6 @@ public void CorrectNumberNodeItemsTest()
Open(@"pkgs\Dynamo Samples\extra\ZoomNodeColorStates.dyn");

hwm = this.ViewModel.CurrentSpace as HomeWorkspaceModel;
Utility.DispatcherUtil.DoEvents();

int loadedGraphNodes = hwm.Nodes.Count();
int loadedExtensionNodes = dataGridItems.Count;
Expand All @@ -121,13 +127,13 @@ public void CorrectNumberNodeItemsTest()
Assert.AreEqual(loadedGraphNodes, loadedExtensionNodes);
Assert.AreEqual(deleteGraphNodes, deleteExtensionNodes);
}

/// <summary>
/// Test if using the IsFrozen filter yields correct results
/// </summary>
[Test]
public void FilterFrozenItemsTest()
{
RaiseLoadedEvent(this.View);
var extensionManager = View.viewExtensionManager;
var viewExt = extensionManager.ViewExtensions
.FirstOrDefault(x => x as GraphNodeManagerViewExtension != null)
Expand All @@ -136,8 +142,7 @@ public void FilterFrozenItemsTest()
// Arrange
LoadExtension(viewExt);

Open(@"pkgs\Dynamo Samples\extra\ZoomNodeColorStates.dyn");
Utility.DispatcherUtil.DoEvents();
OpenAndRun(@"pkgs\Dynamo Samples\extra\ZoomNodeColorStates.dyn");

// Get number of frozen Nodes in the graph
var hwm = this.ViewModel.CurrentSpace as HomeWorkspaceModel;
Expand Down Expand Up @@ -174,28 +179,23 @@ public void FilterFrozenItemsTest()
[Test]
public void ContainsEmptyListOrNullTest()
{
RaiseLoadedEvent(this.View);
var extensionManager = View.viewExtensionManager;
var viewExt = extensionManager.ViewExtensions
.FirstOrDefault(x => x as GraphNodeManagerViewExtension != null)
as GraphNodeManagerViewExtension;

var hwm = this.ViewModel.CurrentSpace as HomeWorkspaceModel;

// Arrange
LoadExtension(viewExt);

var hwm = this.ViewModel.CurrentSpace as HomeWorkspaceModel;

var view = viewExt.ManagerView;

Open(@"pkgs\Dynamo Samples\extra\GraphNodeManagerTestGraph_NullsEmptyLists.dyn");
OpenAndRun(@"pkgs\Dynamo Samples\extra\GraphNodeManagerTestGraph_NullsEmptyLists.dyn");

hwm = this.ViewModel.CurrentSpace as HomeWorkspaceModel;
hwm.Run();
var images = WpfUtilities.ChildrenOfType<Image>(view.NodesInfoDataGrid);

Utility.DispatcherUtil.DoEvents();

var images = WpfUtilities.ChildrenOfType<Image>(view.NodesInfoDataGrid);

int nullNodesImageCount = GetImageCount(images, "Null");
int emptyListNodesImageCount = GetImageCount(images, "EmptyList");

Expand All @@ -214,7 +214,6 @@ public void ContainsEmptyListOrNullTest()
[Test]
public void ViewExtensionOpensWithDynamoWhenRememberedTest()
{
RaiseLoadedEvent(this.View);
ViewModel.PreferenceSettings.EnablePersistExtensions = true;

//assert that option is enabled
Expand Down Expand Up @@ -247,7 +246,6 @@ public void ViewExtensionOpensWithDynamoWhenRememberedTest()
[Test]
public void ViewExtensionDoesNotOpensWithDynamoWhenClosedTest()
{
RaiseLoadedEvent(this.View);
ViewModel.PreferenceSettings.EnablePersistExtensions = true;

//assert that option is enabled
Expand Down Expand Up @@ -284,7 +282,6 @@ public void ViewExtensionDoesNotOpensWithDynamoWhenClosedTest()
[Test]
public void ViewExtensionDoesNotOpenWhenNotRememberedTest()
{
RaiseLoadedEvent(this.View);
ViewModel.PreferenceSettings.EnablePersistExtensions = false;

//assert that option is disabled
Expand Down

0 comments on commit e032d19

Please sign in to comment.