public void WhenDoActionThenElementIsAddedToDataModel() { ElementCreateAction action = new ElementCreateAction(_model.Object, Name, Type, _parent.Object); action.Do(); _model.Verify(x => x.AddElement(Name, Type, ParentId), Times.Once()); }
public void WhenUndoActionThenElementIsRemovedFromDataModel() { object[] args = { _model.Object, _data }; ElementCreateAction action = new ElementCreateAction(args); action.Undo(); _model.Verify(x => x.RemoveElement(ElementId), Times.Once()); }
public void GivenLoadedActionWhenGettingDataThenActionAttributesMatch() { object[] args = { _model.Object, _data }; ElementCreateAction action = new ElementCreateAction(args); Assert.AreEqual(4, action.Data.Count); Assert.AreEqual(ElementId.ToString(), _data["element"]); Assert.AreEqual(Name, _data["name"]); Assert.AreEqual(Type, _data["type"]); Assert.AreEqual(ParentId.ToString(), _data["parent"]); }
public IDsmElement ImportElement(string fullname, string name, string type, IDsmElement parent) { IDsmElement element = _dsmModel.GetElementByFullname(fullname); if (element == null) { ElementCreateAction action = new ElementCreateAction(_dsmModel, name, type, parent); element = _actionManager.Execute(action) as IDsmElement; Debug.Assert(element != null); } else { _notFoundElements.Remove(element.Id); } return(element); }
public void CreateElement(string name, string type, IDsmElement parent) { ElementCreateAction action = new ElementCreateAction(_dsmModel, name, type, parent); _actionManager.Execute(action); }