Beispiel #1
0
        public List <TableEntity> FindAllEntities()
        {
            var sql = _sqlQueryConstructor.FindAllEntitiesQuery();
            var nameValueCollections = _sqLiteDatabase.ExecuteReader(sql);

            return(CreateTableEntities(nameValueCollections));
        }
Beispiel #2
0
        public void FindAllEntities_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.FindAllEntitiesQuery()).Returns(sql);
            A.CallTo(() => _sqLiteDatabase.ExecuteReader(sql)).Returns(nameValueData);

            _database.FindAllEntities();

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