public void Serializes_Correct_Type()
        {
            // given
            var iriTemplate = new IriTemplateMapping();

            // when
            var jsonLd = this.Serializer.Serialize(iriTemplate);

            // then
            Assert.Equal(Vocab.Hydra.IriTemplateMapping, jsonLd[JsonLdKeywords.Type].ToString());
        }
Beispiel #2
0
        private IriTemplateMapping CreateMapping(PropertyInfo p)
        {
            var variable = p.GetCustomAttribute <VariableAttribute>()?.Variable;

            var iriTemplateMapping = new IriTemplateMapping
            {
                Required = p.GetCustomAttribute <RequiredAttribute>() != null,
                Variable = variable ?? p.Name
            };

            var property = this.CreateProperty(p);

            if (property != null)
            {
                iriTemplateMapping.Property = property;
            }

            return(iriTemplateMapping);
        }