Example #1
0
        public void AssertEntity(EntityId entityId, IEnumerable <IEntityQuad> entityTriples)
        {
            if (_assertedEntities.Contains(entityId))
            {
                return;
            }

            var entityQuads = entityTriples as IEntityQuad[] ?? entityTriples.ToArray();

            _entityQuads.Add(entityId, entityQuads);
            if (_trackChanges)
            {
                _initialQuads.Add(entityId, entityQuads);
            }

            _assertedEntities.Add(entityId);
            foreach (var entityQuad in entityQuads.Where(entityQuad => entityQuad.Object.IsBlank))
            {
                IncrementRefCount(entityQuad.Object);
            }
        }
        public void Adding_quad_with_blank_subject_should_add_to_root_entity_triples()
        {
            // given
            EntityId root    = "urn:root:entity";
            var      blankId = new BlankId("test", root);

            // when
            _quads.Add(new EntityQuad(blankId, CreateTriple()));

            // then
            _quads[root].Should().HaveCount(1);
        }