public void UnknownAnnotatableTargetReturnsDefaultUpdateRestrictionsValues() { // Arrange UpdateRestrictions update = new UpdateRestrictions(); EdmEntityType entityType = new EdmEntityType("NS", "Entity"); // Act bool result = update.Load(EdmCoreModel.Instance, entityType); // Assert Assert.False(result); Assert.True(update.IsUpdatable); Assert.Null(update.Updatable); Assert.Null(update.NonUpdatableNavigationProperties); }
public void TargetOnEntitySetReturnsCorrectUpdateRestrictionsValue(EdmVocabularyAnnotationSerializationLocation location) { // Arrange const string template = @" <Annotations Target=""NS.Default/Calendars""> {0} </Annotations>"; IEdmModel model = GetEdmModel(template, location); Assert.NotNull(model); // guard IEdmEntitySet calendars = model.EntityContainer.FindEntitySet("Calendars"); Assert.NotNull(calendars); // guard // Act UpdateRestrictions update = new UpdateRestrictions(); bool result = update.Load(model, calendars); // Assert Assert.True(result); VerifyUpdateRestrictions(update); }
public void TargetOnEntityTypeReturnsCorrectUpdateRestrictionsValue(EdmVocabularyAnnotationSerializationLocation location) { // Arrange const string template = @" <Annotations Target=""NS.Calendar""> {0} </Annotations>"; IEdmModel model = GetEdmModel(template, location); Assert.NotNull(model); // guard IEdmEntityType calendar = model.SchemaElements.OfType <IEdmEntityType>().First(c => c.Name == "Calendar"); Assert.NotNull(calendar); // guard // Act UpdateRestrictions update = new UpdateRestrictions(); bool result = update.Load(model, calendar); // Assert Assert.True(result); VerifyUpdateRestrictions(update); }