public static IComponentWithProperties FindComponentWithProperties(this IComponentCollection componentCollection, IEnumerable <int> path) { var candidate = new ComponentFindingComponentVisitor().Find(componentCollection, path); if (!(candidate is IComponentWithProperties)) { throw new KolaException("Component with properties not found"); } return(candidate as IComponentWithProperties); }
public void SetUp() { var components = new IComponent[] { new Atom("atom 0"), new Container("container 1", components: new[] { new Atom("atom 1.0") }), new Widget("widget 2", areas: new[] { new Area("area 1", new[] { new Atom("atom 2.0.0") }), }) }; var template = new Template(Enumerable.Empty <string>(), components); var visitor = new ComponentFindingComponentVisitor(); this.found = visitor.Find(template, new[] { 2, 0, 0 }); }
public void SetUp() { var components = new IComponent[] { new Atom("atom 0"), new Container("container 1", components: new[] { new Atom("atom 1.0") }), new Widget("widget 2", areas: new[] { new Area("area 1", new[] { new Atom("atom 2.0.0") }), }) }; var template = new Template(Enumerable.Empty<string>(), components); var visitor = new ComponentFindingComponentVisitor(); this.found = visitor.Find(template, new[] { 1 }); }