public void Should_create_an_instance_from_iri_attribute_with_graph_iri() { AttributeEntityMappingProvider.FromAttribute(EntityType, new ClassAttribute() { Iri = "test", Graph = "graph" }) .Should().BeOfType <AttributeEntityMappingProvider>().Which.MatchesMapped <IProduct>(new Iri("test"), new Iri("graph")); }
protected override void ScenarioSetup() { Visitor = new Mock <IMappingProviderVisitor>(MockBehavior.Strict); Visitor.Setup(instance => instance.Visit(It.IsAny <IEntityMappingProvider>())); Provider = AttributeEntityMappingProvider.FromAttribute(EntityType, new ClassAttribute() { Iri = "test" }); }
private void BuildMappings(Assembly assembly) { var types = from type in assembly.GetExportedTypes() where typeof(IEntity).IsAssignableFrom(type) select type; foreach (var type in types) { var classAttributes = type.GetTypeInfo().GetCustomAttributes <ClassAttribute>(); _entityMappingProviders.AddRange( classAttributes.Select(classAttribute => AttributeEntityMappingProvider.FromAttribute(type, classAttribute))); BuildPropertyMappings(type); } }
public void Should_create_an_instance_from_qiri_attribute_with_graph_qiri() { AttributeEntityMappingProvider.FromAttribute(EntityType, new ClassAttribute("test", "term", "test", "graph")) .Should().BeOfType <AttributeEntityMappingProvider>() .Which.MatchesMapped <IProduct>(new QIriMapping("test", new Iri("test_")), new Iri("test_term"), new Iri("test_graph")); }