public AmendmentSurrogate Visit(DuplicateComponentAmendment amendment) { return(new DuplicateComponentAmendmentSurrogate { ComponentPath = amendment.ComponentPath.ToComponentPathString(), }); }
public AmendmentResource Visit(DuplicateComponentAmendment amendment, int index) { return(new DuplicateComponentAmendmentResource { Id = index, ComponentPath = amendment.ComponentPath.ToComponentPathString(), Links = this.BuildLinks(amendment, index) }); }
public void Visit(DuplicateComponentAmendment amendment) { var component = this.componentCollection.FindComponent(amendment.ComponentPath); var parent = this.componentCollection.FindCollection(amendment.ComponentPath.TakeAllButLast()); var clone = component.Clone(); var index = amendment.ComponentPath.Last() + 1; parent.Insert(index, clone); }
public void SetUp() { this.ComponentSpecification.Stub(s => s.Create()).Return(new Atom("new atom")); this.Template.Insert(0, new Widget("widget 1", new[] { new Area("area") })); var duplicateAmendment = new DuplicateComponentAmendment(new[] { 0 }); var addComponentAmendment = new AddComponentAmendment(new[] { 1, 0, 0 }, "new atom"); this.Visitor.Visit(duplicateAmendment); this.Visitor.Visit(addComponentAmendment); }
public void SetUp() { this.parent = new Container("parent"); this.Template.Insert(0, this.parent); // add the container to be duplicated var container = new Container( "container", new[] { new Property("container property", "container property type", new FixedPropertyValue("container property value")) }); var atom = new Atom( "atom", new[] { new Property("atom property", "atom property type", new FixedPropertyValue("atom property value")) }); container.Insert(0, atom); this.parent.Insert(0, container); var amendment = new DuplicateComponentAmendment(new[] { 0, 0 }); this.Visitor.Visit(amendment); }