public void it_can_create_an_entity() { var builder = _template.ToEntity(_person); Assert.IsInstanceOf <EntityBuilder>(builder); var entity = builder.Build(); Assert.That(entity.Properties["id"], Is.EqualTo(_person.Id)); Assert.That(entity.Properties["name"], Is.EqualTo(_person.Name)); Assert.That(entity.Properties["date.of.birth"], Is.EqualTo(_person.DateOfBirth)); }
public void Test() { var items = new List <Person> { new Person(Guid.NewGuid(), "", DateTime.UtcNow), new Person(Guid.NewGuid(), "", DateTime.UtcNow), new Person(Guid.NewGuid(), "", DateTime.UtcNow) }; var template = new PersonEntityTemplate(); var entity = template .ToEntity(items.First()) .WithClass("person") .WithClass("collection") .WithProperty("count", items.Count); foreach (var item in items) { entity.WithSubEntity(template.ToRepresentation(item).WithRel("item")); } entity.Build(); }