Exemple #1
0
        public List <Triple> FindTriplesAffectedBySubjectEid(int subjectEid)
        {
            var sql = _sqlQueryConstructor.FindTriplesAffectedBySubjectQuery(subjectEid);
            var nameValueCollections = _sqLiteDatabase.ExecuteReader(sql);

            return(CreateTriples(nameValueCollections));
        }
Exemple #2
0
        public void FindPredicatesAffectedBySubject_GetsSqlAndExecutesAsQuery()
        {
            const string sql  = "sql";
            const string path = @"C:\Temp\MYDATABASE.db";

            A.CallTo(() => _databaseBuilder.Build(path)).Returns(_sqLiteDatabase);
            _database.Connect(path);
            var nameValueData = new List <NameValueCollection>
            {
                new NameValueCollection()
                {
                    { "Subject", "1" }, { "Relationship", "0" }, { "Object", "2" }
                }
            };

            A.CallTo(() => _sqlQueryConstructor.FindTriplesAffectedBySubjectQuery(A <int> .Ignored)).Returns(sql);
            A.CallTo(() => _sqLiteDatabase.ExecuteReader(sql)).Returns(nameValueData);

            _database.FindTriplesAffectedBySubjectEid(1);

            A.CallTo(() => _sqlQueryConstructor.FindTriplesAffectedBySubjectQuery(1)).MustHaveHappened();
            A.CallTo(() => _sqLiteDatabase.ExecuteReader(sql)).MustHaveHappened();
        }