Ejemplo n.º 1
0
        public List <TableEntity> FindEntitiesByEid(List <int> eids)
        {
            var sql = _sqlQueryConstructor.FindEntitiesByEidQuery(eids);
            var nameValueCollections = _sqLiteDatabase.ExecuteReader(sql);

            return(CreateTableEntities(nameValueCollections));
        }
Ejemplo n.º 2
0
        public void FindEntitiesByEid_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()
                {
                    { "Eid", "1" }, { "DataType", "String" }, { "Value", "Test" }
                }
            };

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

            _database.FindEntitiesByEid(null);

            A.CallTo(() => _sqlQueryConstructor.FindEntitiesByEidQuery(null)).MustHaveHappened();
            A.CallTo(() => _sqLiteDatabase.ExecuteReader(sql)).MustHaveHappened();
        }