public void Should_set_discovered_property_id() { // given const string propertyId = "http://argolis.test/prop"; A.CallTo(() => _propertyPredicateIdPolicy.GetPropertyId(PropertyInfo, new Uri("http://argolis.test/Issue"))) .Returns(propertyId); // when var property = _factory.Create(PropertyInfo, ClassIds); // then property.Property.Id.Should().Be(propertyId); }
/// <summary> /// Creates a hydra <see cref="SupportedProperty" /> from a type's property /// using sensible defaults. /// </summary> public virtual SupportedProperty Create(PropertyInfo prop, IReadOnlyDictionary <Type, Uri> classIds) { IriRef?mappedType = _rangeRetrieval.GetRange(prop, classIds); var meta = _metaProvider.GetMeta(prop); string propertyId = _propertyPredicateIdPolicy.GetPropertyId(prop, classIds[prop.ReflectedType]); var property = new SupportedProperty { Title = meta.Title, Description = meta.Description, Writeable = meta.Writeable, Readable = meta.Readable, Property = { Id = propertyId, Range = mappedType ?? (IriRef)Hydra.Resource } }; return(property); }