public void BuildEditLink_WhenEditLinkIsNotSameAsIdLink(bool followsConventions, object metadataLevel, bool linkEmitted) { _entitySet.HasEditLink(new SelfLinkBuilder <Uri>((context) => new Uri("http://editlink/"), followsConventions)); EntitySetLinkBuilderAnnotation linkBuilder = new EntitySetLinkBuilderAnnotation(_entitySet); Uri generatedEditLink = linkBuilder.BuildEditLink(new EntityInstanceContext(), (ODataMetadataLevel)metadataLevel, "http://selflink"); if (linkEmitted) { Assert.Equal("http://editlink/", generatedEditLink.AbsoluteUri); } else { Assert.Null(generatedEditLink); } }
public void HasEditLink(Func <EntityInstanceContext <TEntityType>, Uri> editLinkFactory, bool followsConventions) { if (editLinkFactory == null) { throw Error.ArgumentNull("editLinkFactory"); } _configuration.HasEditLink(new SelfLinkBuilder <Uri>((entity) => editLinkFactory(UpCastEntityInstanceContext(entity)), followsConventions)); }
public void HasEditLink(Func <EntityInstanceContext <TEntityType>, Uri> editLinkFactory) { if (editLinkFactory == null) { throw Error.ArgumentNull("editLinkFactory"); } _configuration.HasEditLink((entity) => editLinkFactory(UpCastEntityInstanceContext(entity))); }
public void HasEditLink_RoundTrips() { // Arrange SelfLinkBuilder <Uri> editLinkBuilder = new SelfLinkBuilder <Uri>((ctxt) => null, followsConventions: true); // Act _entityset.HasEditLink(editLinkBuilder); // Assert Assert.Equal(editLinkBuilder, _entityset.GetEditLink()); }