Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update RecordableCommands.cs #11630

Merged
merged 2 commits into from
Apr 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/DynamoCore/Models/RecordableCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1715,6 +1715,10 @@ protected override void SerializeCore(XmlElement element)
/// <summary>
/// A command used to update the value of a property on a model object.
/// </summary>
/// <exception cref="System.InvalidOperationException">This exception is
/// thrown if the node model is not found in the workspace.</exception>
/// /// <exception cref="System.ArgumentNullException">This exception is
/// thrown if the node model or list of node models passed is null or empty.</exception>
[DataContract]
public class UpdateModelValueCommand : ModelBasedRecordableCommand
{
Expand Down
21 changes: 21 additions & 0 deletions test/DynamoCoreTests/CoreTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,27 @@ public void CanCopyAndPasteAndUndoShowLabels()
Assert.IsFalse(addNode.DisplayLabels);
}

[Test]
[Category("")]
public void UpdateModelValue_MissingNode_ThrowsException()
{
var addNode = new DSFunction(CurrentDynamoModel.LibraryServices.GetFunctionDescriptor("+"));

CurrentDynamoModel.CurrentWorkspace.AddAndRegisterNode(addNode, false);
CurrentDynamoModel.CurrentWorkspace.RemoveAndDisposeNode(addNode);

var command = new DynCmd.UpdateModelValueCommand(Guid.Empty, addNode.GUID, "Code", "");
Assert.Throws<InvalidOperationException>(() => CurrentDynamoModel.ExecuteCommand(command));
}

[Test]
[Category("")]
public void UpdateModelValue_EmptyList_ThrowsException()
{
var command = new DynCmd.UpdateModelValueCommand(Guid.Empty, new Guid[] { }, "", "");
Assert.Throws<ArgumentNullException>(() => CurrentDynamoModel.ExecuteCommand(command));
}

[Test]
[Category("UnitTests")]
public void CanCopyAndPasteAndUndoInputState()
Expand Down