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); }
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" }, }; var dicts = grid.As <IGridDefinition <GridDefTarget> >().FormatData(data); dicts.Select(x => x["Name"]).ShouldHaveTheSameElementsAs("Scooby", "Velma", "Daphne"); dicts.Select(x => x["Count"]).ShouldHaveTheSameElementsAs(1, 2, 3); }