Example #1
0
        public void simpleInsertAndSelectTest( IDatabase db, string connectionString = null, Func<IDatabase> newDb = null )
        {
            try
            {
            setupConfig( db );
            if( connectionString == null )
                connectionString = _cfg.ConnectionString;
            _db.setup( connectionString, _ti );
            using( var token = _db.token() )
            using( _db.transaction( token ) )
            {
                ulong id = _db.insert( token, "test", _testData );
                if( newDb != null )
                {
                    _db = newDb();
                    _db.setup( connectionString, _ti );
                }
                var selected = _db.select( token, "test",
                    new Dictionary<string, object>()
                    {
                        { "id", id }
                    }
                );

                Assert.AreEqual( 1, selected.Count );
                _testData["id"] = id;
                Assert.AreEqual( _testData, selected.Values.First() );
            }
            }
            finally
            {
            shutdown();
            }
        }