Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

Commit

Permalink
Added tests for Statement.setDynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
cjlucas committed Aug 23, 2015
1 parent f5c5605 commit e6787b8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
2 changes: 0 additions & 2 deletions lib/src/occi_extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
22 changes: 22 additions & 0 deletions test/statement_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e6787b8

Please sign in to comment.