Ejemplo n.º 1
0
        public void BuildIdLink(bool followsConventions, object metadataLevel, bool linkEmitted)
        {
            _entitySet.HasIdLink(new SelfLinkBuilder <string>((context) => "http://selflink", followsConventions));
            EntitySetLinkBuilderAnnotation linkBuilder = new EntitySetLinkBuilderAnnotation(_entitySet);

            string generatedIdLink = linkBuilder.BuildIdLink(new EntityInstanceContext(), (ODataMetadataLevel)metadataLevel);

            if (linkEmitted)
            {
                Assert.Equal("http://selflink", generatedIdLink);
            }
            else
            {
                Assert.Null(generatedIdLink);
            }
        }
        public void HasIdLink(Func <EntityInstanceContext <TEntityType>, string> idLinkFactory, bool followsConventions)
        {
            if (idLinkFactory == null)
            {
                throw Error.ArgumentNull("idLinkFactory");
            }

            _configuration.HasIdLink(new SelfLinkBuilder <string>((entity) => idLinkFactory(UpCastEntityInstanceContext(entity)), followsConventions));
        }
        public void HasIdLink(Func <EntityInstanceContext <TEntityType>, string> idLinkFactory)
        {
            if (idLinkFactory == null)
            {
                throw Error.ArgumentNull("idLinkFactory");
            }

            _configuration.HasIdLink((entity) => idLinkFactory(UpCastEntityInstanceContext(entity)));
        }
Ejemplo n.º 4
0
        public void HasIdLink_RoundTrips()
        {
            // Arrange
            SelfLinkBuilder <string> idLinkBuilder = new SelfLinkBuilder <string>((ctxt) => null, followsConventions: true);

            // Act
            _entityset.HasIdLink(idLinkBuilder);

            // Assert
            Assert.Equal(idLinkBuilder, _entityset.GetIdLink());
        }