public void AddModelToGroupCommand_Constructors() { //Arrange var guid1 = Guid.NewGuid(); var guid2 = Guid.NewGuid(); var guid3 = Guid.NewGuid(); IEnumerable <Guid> groupModelGuid = new[] { guid3 }; XmlDocument xmlDocument = new XmlDocument(); var xmlElement = xmlDocument.CreateElement("ModelGroupElement"); //Act var command1 = new AddModelToGroupCommand(guid1.ToString()); var command2 = new AddModelToGroupCommand(guid2); var command3 = new AddModelToGroupCommand(groupModelGuid); AddModelToGroupCommand.DeserializeCore(xmlElement); command1.Serialize(xmlDocument); command1.Execute(CurrentDynamoModel); //Assert //Verify that the guid in the commands created are right Assert.IsNotNull(command1); Assert.IsNotNull(command2); Assert.IsNotNull(command3); }
void AddToGroupImpl(AddModelToGroupCommand command) { if (command.ModelGuid == Guid.Empty) { return; } var modelsToGroup = command.ModelGuids.Select(guid => CurrentWorkspace.GetModelInternal(guid)).ToList(); AddToGroup(modelsToGroup); }
void AddToGroupImpl(AddModelToGroupCommand command) { var modelsToUngroup = new List <ModelBase>(); if (command.ModelGuid != Guid.Empty) { modelsToUngroup.Add(CurrentWorkspace.GetModelInternal(command.ModelGuid)); } AddToGroup(modelsToUngroup); }
public void UngroupGrouplImplTest() { //Arrange var guid1 = Guid.Empty; var command1 = new AddModelToGroupCommand(guid1); var command2 = new UngroupModelCommand(guid1); //Act //Internally this will execute the AddToGroupImpl method command1.Execute(CurrentDynamoModel); //Internally this will execute the UngroupModelImpl method command2.Execute(CurrentDynamoModel); //Assert //Verify that the command was created successfully and that the guids match Assert.IsNotNull(command1); Assert.AreEqual(command1.ModelGuid, guid1); Assert.IsNotNull(command2); Assert.AreEqual(command2.ModelGuid, guid1); }
private void AddToGroupImpl(AddModelToGroupCommand command) { if (command.ModelGuid == Guid.Empty) { return; } var modelsToGroup = command.ModelGuids.Select(guid => CurrentWorkspace.GetModelInternal(guid)).ToList(); if (modelsToGroup.OfType <NodeModel>().Any()) { var nodeModels = modelsToGroup.OfType <NodeModel>(); var pinnedNotes = CurrentWorkspace.Notes .Where(x => x.PinnedNode != null && nodeModels.Contains(x.PinnedNode)); if (pinnedNotes.Any()) { modelsToGroup.AddRange(pinnedNotes); } } AddToGroup(modelsToGroup); }
void AddToGroupImpl(AddModelToGroupCommand command) { if (command.ModelGuid == Guid.Empty) return; var modelsToGroup = command.ModelGuids.Select(guid => CurrentWorkspace.GetModelInternal(guid)).ToList(); AddToGroup(modelsToGroup); }