public void Setup()
 {
     _typesMapping = new TestPropertyMapping(typeof(ITypedEntity), typeof(IEnumerable<EntityId>), "Types", Vocabularies.Rdf.type);
     _factory = new Mock<IEntityContextFactory>();
     _ontologyProvider = new TestOntologyProvider();
     _mappings = new Mock<IMappingsRepository>();
     _entityStore = new Mock<IEntityStore>();
     _entityStore.Setup(es => es.GetObjectsForPredicate(It.IsAny<EntityId>(), Rdf.type, It.IsAny<Uri>()))
                 .Returns(new Node[0]);
     _mappings.Setup(m => m.MappingFor<ITypedEntity>()).Returns(new EntityMapping(typeof(ITypedEntity), new ClassMapping[0], new[] { _typesMapping }));
     _mappings.Setup(m => m.MappingFor(typeof(ITypedEntity))).Returns(new EntityMapping(typeof(ITypedEntity), new ClassMapping[0], new[] { _typesMapping }));
     _store = new Mock<IEntitySource>();
     _baseUriSelector = new Mock<IBaseUriSelectionPolicy>(MockBehavior.Strict);
     var mappingContext = new MappingContext(_ontologyProvider);
     _entityContext = new EntityContext(
         _factory.Object,
         _mappings.Object,
         mappingContext,
         _entityStore.Object,
         _store.Object,
         _baseUriSelector.Object,
         new TestGraphSelector(),
         new TestCache());
 }
 private void EnsureMappingsRebuilt()
 {
     var mappingContext = new MappingContext(_actualOntologyProvider, _conventions);
     _mappingsRepository.RebuildMappings(mappingContext);
 }
        /// <summary>Creates a new instance of entity context.</summary>
        public IEntityContext CreateContext()
        {
            LogTo.Debug("Creating entity context");

            EnsureComplete();
            EnsureInitialized();
            _mappingContext = new MappingContext(_actualOntologyProvider);

            var entitySource = _entitySourceFactory();
            entitySource.MetaGraphUri = _metaGraphUri;

            return new EntityContext(
                this,
                Mappings,
                _mappingContext,
                _entityStoreFactory(),
                entitySource,
                _baseUriSelector,
                _namedGraphSelector,
                _matcher);
        }