-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1699 from glopesdev/issue-1586
Ensure retrieval of closest subject definition
- Loading branch information
Showing
9 changed files
with
104 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
Bonsai.Editor.Tests/NestedSubscribeSubjectWithClosestRedefinition.bonsai
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<WorkflowBuilder Version="2.8.1" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:rx="clr-namespace:Bonsai.Reactive;assembly=Bonsai.Core" | ||
xmlns="https://bonsai-rx.org/2018/workflow"> | ||
<Workflow> | ||
<Nodes> | ||
<Expression xsi:type="Combinator"> | ||
<Combinator xsi:type="IntProperty"> | ||
<Value>8</Value> | ||
</Combinator> | ||
</Expression> | ||
<Expression xsi:type="rx:PublishSubject"> | ||
<Name>Values</Name> | ||
</Expression> | ||
<Expression xsi:type="SubscribeSubject"> | ||
<Name>Values</Name> | ||
</Expression> | ||
<Expression xsi:type="rx:Defer"> | ||
<Workflow> | ||
<Nodes> | ||
<Expression xsi:type="WorkflowInput"> | ||
<Name>Source1</Name> | ||
</Expression> | ||
<Expression xsi:type="Multiply"> | ||
<Operand xsi:type="IntProperty"> | ||
<Value>2</Value> | ||
</Operand> | ||
</Expression> | ||
<Expression xsi:type="rx:PublishSubject"> | ||
<Name>Values</Name> | ||
</Expression> | ||
<Expression xsi:type="Combinator"> | ||
<Combinator xsi:type="rx:Timer"> | ||
<rx:DueTime>PT0S</rx:DueTime> | ||
<rx:Period>PT0S</rx:Period> | ||
</Combinator> | ||
</Expression> | ||
<Expression xsi:type="rx:SelectMany"> | ||
<Workflow> | ||
<Nodes> | ||
<Expression xsi:type="WorkflowInput"> | ||
<Name>Source1</Name> | ||
</Expression> | ||
<Expression xsi:type="SubscribeSubject"> | ||
<Name>Values</Name> | ||
</Expression> | ||
<Expression xsi:type="WorkflowOutput" /> | ||
</Nodes> | ||
<Edges> | ||
<Edge From="1" To="2" Label="Source1" /> | ||
</Edges> | ||
</Workflow> | ||
</Expression> | ||
<Expression xsi:type="WorkflowOutput" /> | ||
</Nodes> | ||
<Edges> | ||
<Edge From="0" To="1" Label="Source1" /> | ||
<Edge From="1" To="2" Label="Source1" /> | ||
<Edge From="3" To="4" Label="Source1" /> | ||
<Edge From="4" To="5" Label="Source1" /> | ||
</Edges> | ||
</Workflow> | ||
</Expression> | ||
</Nodes> | ||
<Edges> | ||
<Edge From="0" To="1" Label="Source1" /> | ||
<Edge From="2" To="3" Label="Source1" /> | ||
</Edges> | ||
</Workflow> | ||
</WorkflowBuilder> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Bonsai.Editor.GraphModel; | ||
using Bonsai.Reactive; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace Bonsai.Editor.Tests | ||
{ | ||
public partial class WorkflowEditorTests | ||
{ | ||
[TestMethod] | ||
public void GetSubjectDefinition_NestedSubscribeSubject_ReturnsClosestDefinition() | ||
{ | ||
var workflowBuilder = LoadEmbeddedWorkflow("NestedSubscribeSubjectWithClosestRedefinition.bonsai"); | ||
var deferBuilder = workflowBuilder.Workflow.FindExpressionBuilder<Defer>(); | ||
Assert.IsNotNull(deferBuilder); | ||
var selectManyBuilder = deferBuilder.Workflow.FindExpressionBuilder<SelectMany>(); | ||
Assert.IsNotNull(selectManyBuilder); | ||
var definition = workflowBuilder.GetSubjectDefinition(selectManyBuilder.Workflow, "Values"); | ||
Assert.IsNotNull(definition); | ||
Assert.AreSame(deferBuilder.Workflow, definition.Root.Key); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters