예제 #1
0
        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());
        }
예제 #2
0
        public void WhenUndoActionThenElementIsRemovedFromDataModel()
        {
            object[]            args   = { _model.Object, _data };
            ElementCreateAction action = new ElementCreateAction(args);

            action.Undo();

            _model.Verify(x => x.RemoveElement(ElementId), Times.Once());
        }
예제 #3
0
        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"]);
        }
예제 #4
0
        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);
        }
예제 #5
0
        public void CreateElement(string name, string type, IDsmElement parent)
        {
            ElementCreateAction action = new ElementCreateAction(_dsmModel, name, type, parent);

            _actionManager.Execute(action);
        }