/// <summary> /// Returns Json payloads based on default model /// </summary> /// <returns>An IEnumerable of Payloads </returns> public IEnumerable <EntityInstance> GenerateJsonPayloads() { List <EntityInstance> payloads = new List <EntityInstance>(); var model = TestModels.BuildDefaultAstoriaTestModel(); var sets = model.EntityContainersAcrossModels().First().Elements.OfType <IEdmEntitySet>(); // Create entity for each set in model. foreach (var set in sets) { if (!set.EntityType().IsAbstract) { EntityInstance payload = this.AddIDAndLink(this.CreateEntityInstance(set.EntityType())).WithTypeAnnotation(set.EntityType()); this.Assert.IsTrue(payload.Annotations.Count == 2, "There should only be two annotations"); payload = (EntityInstance)this.normalizer.Visit(payload); payloads.Add(payload); } } return(payloads); }
/// <summary> /// Returns Atom payloads based on default model /// </summary> /// <returns>An IEnumerable of Payloads </returns> public IEnumerable <EntityInstance> GenerateAtomPayloads() { var model = TestModels.BuildDefaultAstoriaTestModel(); var sets = model.EntityContainersAcrossModels().First().Elements.OfType <IEdmEntitySet>(); // Create entity for each set in model. foreach (var set in sets) { if (!set.EntityType().IsAbstract) { //create entity based on ElementType EntityInstance payload = this.AddIDAndLink(this.CreateEntityInstance(set.EntityType())); payload.WithDefaultAtomEntryAnnotations(); payload.WithTypeAnnotation(set.EntityType()); payload = (EntityInstance)this.normalizer.Visit(payload); this.Assert.IsTrue(payload.Annotations.Count >= 2, "There should be a minimum of two annotations"); yield return(payload); } } }