Пример #1
0
        public void CanExec()
        {
            var descripton = _testDb.GenerateRandomString();
            var sql        = "INSERT INTO test_values (description) VALUES (@description);";
            var param      = new DbParams("description", descripton);

            var rowsAffected = _db.Exec(sql, param);

            Assert.Equal(1, rowsAffected);
        }
Пример #2
0
        public TestDb()
        {
            var connFact = new TestDbConnectionFactory();
            var db       = new DbFixture <TestDbConnectionFactory>(connFact);

            using var fs = File.OpenRead("schema.sql");
            using var sr = new StreamReader(fs);
            var sql = sr.ReadToEnd();

            db.Exec(sql);

            Db = db;
        }