public AmendmentSurrogate Visit(ResetPropertyAmendment amendment) { return(new ResetPropertyAmendmentSurrogate { ComponentPath = amendment.ComponentPath.ToComponentPathString(), PropertyName = amendment.PropertyName }); }
public AmendmentResource Visit(ResetPropertyAmendment amendment, int index) { return(new ResetPropertyAmendmentResource { Id = index, ComponentPath = amendment.ComponentPath.ToComponentPathString(), PropertyName = amendment.PropertyName, Links = this.BuildLinks(amendment, index) }); }
public void SetUp() { this.Template.Insert(0, new Atom("the atom", new[] { new Property("property name", "property type", new FixedPropertyValue("fixed value")) })); var propertiespecification = new PropertySpecification("property name", "property type", "default value"); this.ComponentSpecification.Stub(s => s.Properties).Return(new[] { propertiespecification }); var amendment = new ResetPropertyAmendment(new[] { 0 }, "property name"); this.Visitor.Visit(amendment); }
public void SetUp() { this.Template.Insert(0, new Atom("the atom", new [] { new Property("property name", "property type", new FixedPropertyValue("fixed value")) })); var propertiespecification = new PropertySpecification("property name", "property type", string.Empty); this.ComponentSpecification.Stub(s => s.Properties).Return(new[] { propertiespecification }); var amendment = new ResetPropertyAmendment(new[] { 0 }, "property name"); this.Visitor.Visit(amendment); }
public void Visit(ResetPropertyAmendment amendment) { var component = this.componentCollection.FindComponentWithProperties(amendment.ComponentPath); var specification = this.specificationLibrary.Lookup(component.Name); var propertySpecification = specification.Properties.Find(amendment.PropertyName); if (!string.IsNullOrEmpty(propertySpecification.DefaultValue)) { var property = component.FindOrCreateProperty(propertySpecification); property.Value = new FixedPropertyValue(propertySpecification.DefaultValue); } else { var property = component.Properties.Find(amendment.PropertyName); if (property != null) { component.RemoveProperty(property); } } }