From e6787b8230a032b893daaed554e6757f81cf3c80 Mon Sep 17 00:00:00 2001 From: Chris Lucas Date: Sat, 22 Aug 2015 18:30:12 -0700 Subject: [PATCH] Added tests for Statement.setDynamic --- lib/src/occi_extension.dart | 2 -- test/statement_test.dart | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/lib/src/occi_extension.dart b/lib/src/occi_extension.dart index 5f4c673..81ec7ea 100644 --- a/lib/src/occi_extension.dart +++ b/lib/src/occi_extension.dart @@ -151,8 +151,6 @@ class Statement { setInt(index, input); } else if (input is double) { setDouble(index, input); - } else if (input is num) { - setNum(index, input); } else if (input is String) { setString(index, input); } else if (input is DateTime) { diff --git a/test/statement_test.dart b/test/statement_test.dart index 8c2de37..79590c9 100644 --- a/test/statement_test.dart +++ b/test/statement_test.dart @@ -124,6 +124,28 @@ main() { }); }); + group('setDynamic', () { + test('with String', () { + var stmt = conn.createStatement('INSERT INTO stmt_test (test_string) VALUES (:1)'); + expect(() => stmt.setDynamic(1, 'test'), returnsNormally); + }); + + test('with int', () { + var stmt = conn.createStatement('INSERT INTO stmt_test (test_int) VALUES (:1)'); + expect(() => stmt.setDynamic(1, int.parse('5')), returnsNormally); + }); + + test('with double', () { + var stmt = conn.createStatement('INSERT INTO stmt_test (test_number) VALUES (:1)'); + expect(() => stmt.setDynamic(1, double.parse('5.5')), returnsNormally); + }); + + test('with DateTime', () { + var stmt = conn.createStatement('INSERT INTO stmt_test (test_date) VALUES (:1)'); + expect(() => stmt.setDynamic(1, new DateTime.now()), returnsNormally); + }); + }); + test('Connection(username, password, connString)', () { expect(() => new oracle.Connection(username, password, connString), returnsNormally);