public void format_data_smoke_test() { var grid = new TargetGrid(); grid.Column(x => x.Count); grid.Column(x => x.IsCool); grid.Column(x => x.Name); var data = new GridDefTarget[] { new GridDefTarget { Count = 1, IsCool = true, Name = "Scooby" }, new GridDefTarget { Count = 2, IsCool = true, Name = "Velma" }, new GridDefTarget { Count = 3, IsCool = true, Name = "Daphne" }, }; IProjection <GridDefTarget> projection = grid.As <IGridDefinition <GridDefTarget> >().Projection.As <IProjection <GridDefTarget> >(); var dicts = data.Select(x => { var node = new DictionaryMediaNode(); projection.Write(new ProjectionContext <GridDefTarget>(new InMemoryServiceLocator(), x), node); return(node.Values); }); dicts.Select(x => x["Name"]).ShouldHaveTheSameElementsAs("Scooby", "Velma", "Daphne"); dicts.Select(x => x["Count"]).ShouldHaveTheSameElementsAs(1, 2, 3); }
protected void writeData(IValues <T> source) { var links = _links.LinksFor(source, _urls); var topNode = _document.Root; topNode.WriteLinks(links); _projection.Write(new ProjectionContext <T>(_services, source), topNode); }
public void Run <T>(IProjection <T> projection, IValues <T> values, IMediaNode node) { var context = new ProjectionContext <T>(_services, values); projection.Write(context, node); }