Exemplo n.º 1
0
 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"));
 }
Exemplo n.º 2
0
        internal static void MatchesMapped <TEntity>(this AttributeEntityMappingProvider provider, QIriMapping qiriMapping, Iri term, Iri graph = null)
        {
            var qiriMappings = (qiriMapping != null ? new[] { qiriMapping } : Array.Empty <QIriMapping>());

            provider.GetTerm(qiriMappings).Should().Be(term);
            provider.GetGraph(qiriMappings).Should().Be(graph);
            provider.EntityType.Should().Be(typeof(TEntity));
        }
 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);
            }
        }
Exemplo n.º 5
0
 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"));
 }
Exemplo n.º 6
0
 internal static void MatchesMapped <TEntity>(this AttributeEntityMappingProvider provider, Iri term, Iri graph = null)
 {
     provider.MatchesMapped <TEntity>(null, term, graph);
 }