public void SimpleTest() { var input = new Collection <Instruction> { X.StartObject <Item>(), X.StartMember <Item>(i => i.Template), X.StartObject <Template>(), X.StartMember <Template>(i => i.Content), X.StartObject <Grid>(), X.EndObject(), X.EndMember(), X.EndObject(), X.EndMember(), X.EndObject(), }; var mapping = new DeferredLoaderMapping(); var assembler = new DummyDeferredLoader(); mapping.Map <Template>(t => t.Content, assembler); var topDownValueContext = new TopDownValueContext(); var objectAssembler = new ObjectAssembler(RuntimeTypeSource, new ValueContext(RuntimeTypeSource, topDownValueContext)); var sut = new TemplateHostingObjectAssembler(objectAssembler, mapping); foreach (var instruction in input) { sut.Process(instruction); } var actualNodes = sut.NodeList; var expectedInstructions = new List <Instruction> { X.StartObject <Grid>(), X.EndObject(), }.AsReadOnly(); Assert.Equal(expectedInstructions, actualNodes); Assert.NotNull(((Item)sut.Result).Template.Content); }
public void SimpleTest() { var input = new Collection<Instruction> { X.StartObject<Item>(), X.StartMember<Item>(i => i.Template), X.StartObject<Template>(), X.StartMember<Template>(i => i.Content), X.StartObject<Grid>(), X.EndObject(), X.EndMember(), X.EndObject(), X.EndMember(), X.EndObject(), }; var mapping = new DeferredLoaderMapping(); var assembler = new DummyDeferredLoader(); mapping.Map<Template>(t => t.Content, assembler); var topDownValueContext = new TopDownValueContext(); var objectAssembler = new ObjectAssembler(RuntimeTypeSource, new ValueContext(RuntimeTypeSource, topDownValueContext)); var sut = new TemplateHostingObjectAssembler(objectAssembler, mapping); foreach (var instruction in input) { sut.Process(instruction); } var actualNodes = sut.NodeList; var expectedInstructions = new List<Instruction> { X.StartObject<Grid>(), X.EndObject(), }.AsReadOnly(); Assert.Equal(expectedInstructions, actualNodes); Assert.NotNull(((Item) sut.Result).Template.Content); }
public void SimpleTest() { var input = new Collection <XamlInstruction> { X.StartObject <Item>(), X.StartMember <Item>(i => i.Template), X.StartObject <Template>(), X.StartMember <Template>(i => i.Content), X.StartObject <Grid>(), X.EndObject(), X.EndMember(), X.EndObject(), X.EndMember(), X.EndObject(), }; var mapping = new DeferredLoaderMapping(); var assembler = new DummyDeferredLoader(); mapping.Map <Template>(t => t.Content, assembler); var sut = new TemplateHostingObjectAssembler(new ObjectAssembler(WiringContext, new TopDownValueContext()), mapping); foreach (var instruction in input) { sut.Process(instruction); } var actualNodes = sut.NodeList; var expectedInstructions = new Collection <XamlInstruction> { X.StartObject <Grid>(), X.EndObject(), }; CollectionAssert.AreEqual(expectedInstructions, actualNodes); Assert.IsNotNull(((Item)sut.Result).Template.Content); }
public void SimpleTest() { var input = new Collection<XamlInstruction> { X.StartObject<Item>(), X.StartMember<Item>(i => i.Template), X.StartObject<Template>(), X.StartMember<Template>(i => i.Content), X.StartObject<Grid>(), X.EndObject(), X.EndMember(), X.EndObject(), X.EndMember(), X.EndObject(), }; var mapping = new DeferredLoaderMapping(); var assembler = new DummyDeferredLoader(); mapping.Map<Template>(t => t.Content, assembler); var sut = new TemplateHostingObjectAssembler(new ObjectAssembler(WiringContext, new TopDownValueContext()), mapping); foreach (var instruction in input) { sut.Process(instruction); } var actualNodes = sut.NodeList; var expectedInstructions = new Collection<XamlInstruction> { X.StartObject<Grid>(), X.EndObject(), }; CollectionAssert.AreEqual(expectedInstructions, actualNodes); Assert.IsNotNull(((Item) sut.Result).Template.Content); }
public void SimpleTest() { var input = new Collection<XamlNode> { x.StartObject<Item>(), x.StartMember<Item>(i => i.Template), x.StartObject<Template>(), x.StartMember<Template>(i => i.Content), x.StartObject<Grid>(), x.EndObject(), x.EndMember(), x.EndObject(), x.EndMember(), x.EndObject(), }; var sut = new TemplateHostingObjectAssembler(new SuperObjectAssembler(WiringContext, new TopDownMemberValueContext())); var assembler = new DummyDeferredLoader(); sut.AddDeferredLoader<Template>(t => t.Content, assembler); foreach (var xamlNode in input) { sut.Process(xamlNode); } var actualNodes = sut.NodeList; var expectedNodes = new Collection<XamlNode> { x.StartObject<Grid>(), x.EndObject(), }; CollectionAssert.AreEqual(expectedNodes, actualNodes); Assert.IsNotNull(((Item) sut.Result).Template.Content); }
public void Process(XamlInstruction node) { _objectAssembler.Process(node); }
public void Process(Instruction node) { objectAssembler.Process(node); }
public void Process(Instruction instruction) { objectAssembler.Process(instruction); }