Skip to content

Commit

Permalink
QD-0 Fix test cases (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
Web-Engine authored Jun 14, 2024
1 parent 4bb9794 commit 4cd0608
Show file tree
Hide file tree
Showing 24 changed files with 117 additions and 56 deletions.
2 changes: 1 addition & 1 deletion Qsi.Tests/Vendor/MySql/Driver/MySqlRepositoryProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ from information_schema.COLUMNS
column.IsNullable = reader.GetString(1) == "YES";

column.Default = isAutoIncrement
? "<AUTO_INCREMENT>"
? "AUTO_INCREMENT"
: reader.IsDBNull(2)
? null
: reader.GetString(2);
Expand Down
2 changes: 1 addition & 1 deletion Qsi.Tests/Vendor/MySql/MySqlTest.Data.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public partial class MySqlTest

new("INSERT INTO actor SELECT 1, 'MORRIS', 'BABO', null"),

new("INSERT INTO actor (actor_id, last_name) SELECT city_id, city FROM city LIMIT 2"),
new("INSERT INTO actor (actor_id, first_name, last_name) SELECT city_id, city, city FROM city LIMIT 2"),

new("UPDATE actor SET first_name = 'MORRIS', last_name = 'BABO' WHERE actor_id = 1"),

Expand Down
8 changes: 4 additions & 4 deletions Qsi.Tests/Vendor/MySql/MySqlTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,13 @@ public async Task<string[]> Test_SELECT_ColumnNames(string sql)
}

[TestCase("INSERT INTO actor VALUES (1, 2, 3, 4), (5, 6, 7, 8)", new string[0], 1)]
[TestCase("INSERT INTO actor (actor_id) VALUES (1)", new string[0], 1)]
[TestCase("INSERT INTO actor (actor_id, last_name) SELECT city_id, city FROM city", new[] { "SELECT city_id, city FROM city" }, 1)]
[TestCase("INSERT INTO actor (first_name, last_name) VALUES ('a', 'b')", new string[0], 1)]
[TestCase("INSERT INTO actor (actor_id, first_name, last_name) SELECT city_id, city, city FROM city", new[] { "SELECT city_id, city, city FROM city" }, 1)]
[TestCase("INSERT INTO actor SELECT * FROM actor LIMIT 0", new[] { "SELECT * FROM actor LIMIT 0" }, 1)]
[TestCase("INSERT INTO actor SELECT * FROM actor LIMIT 1", new[] { "SELECT * FROM actor LIMIT 1" }, 1)]
[TestCase("INSERT INTO actor SELECT * FROM actor LIMIT 2", new[] { "SELECT * FROM actor LIMIT 2" }, 1)]
[TestCase("INSERT INTO actor SET actor_id = 1", new string[0], 1)]
[TestCase("INSERT INTO actor SET actor.actor_id = 1", new string[0], 1)]
[TestCase("INSERT INTO actor SET first_name = 'a', last_name = 'b'", new string[0], 1)]
[TestCase("INSERT INTO actor SET actor.first_name = 'a', actor.last_name = 'b'", new string[0], 1)]
[TestCase("INSERT INTO actor VALUES (1, 2, 3, 4) ON DUPLICATE KEY UPDATE last_update = now()", new string[0], 1)]
public async Task Test_INSERT(string sql, string[] expectedSqls, int expectedResultCount)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

+-------------------------------------------------+
| qsi_unit_tests.actor - INSERT |
+----------+------------+-----------+-------------+
| actor_id | first_name | last_name | last_update |
+----------+------------+-----------+-------------+
| default | MORRIS | BABO | default |
+-------------------------------------------------+
+-------------------------------------------------------------+
| qsi_unit_tests.actor - INSERT |
+----------------+------------+-----------+-------------------+
| actor_id | first_name | last_name | last_update |
+----------------+------------+-----------+-------------------+
| AUTO_INCREMENT | MORRIS | BABO | CURRENT_TIMESTAMP |
+-------------------------------------------------------------+
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

+-------------------------------------------------+
| qsi_unit_tests.actor - INSERT |
+----------+------------+-----------+-------------+
| actor_id | first_name | last_name | last_update |
+----------+------------+-----------+-------------+
| default | MORRIS | BABO | default |
+-------------------------------------------------+
+-------------------------------------------------------------+
| qsi_unit_tests.actor - INSERT |
+----------------+------------+-----------+-------------------+
| actor_id | first_name | last_name | last_update |
+----------------+------------+-----------+-------------------+
| AUTO_INCREMENT | MORRIS | BABO | CURRENT_TIMESTAMP |
+-------------------------------------------------------------+
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

+------------------------------------------------------------------------+
| qsi_unit_tests.actor - INSERT |
+----------+--------------------+--------------------+-------------------+
| actor_id | first_name | last_name | last_update |
+----------+--------------------+--------------------+-------------------+
| 1 | A Corua (La Corua) | A Corua (La Corua) | CURRENT_TIMESTAMP |
| 2 | Abha | Abha | CURRENT_TIMESTAMP |
+------------------------------------------------------------------------+

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

+-------------------------------------------------+
| qsi_unit_tests.actor - INSERT |
+----------+------------+-----------+-------------+
| actor_id | first_name | last_name | last_update |
+----------+------------+-----------+-------------+
| default | MORRIS | BABO | default |
+-------------------------------------------------+
+-------------------------------------------------------------+
| qsi_unit_tests.actor - INSERT |
+----------------+------------+-----------+-------------------+
| actor_id | first_name | last_name | last_update |
+----------------+------------+-----------+-------------------+
| AUTO_INCREMENT | MORRIS | BABO | CURRENT_TIMESTAMP |
+-------------------------------------------------------------+
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

+-------------------------------------------------+
| qsi_unit_tests.actor - INSERT |
+----------+------------+-----------+-------------+
| actor_id | first_name | last_name | last_update |
+----------+------------+-----------+-------------+
| default | MORRIS | BABO | default |
+-------------------------------------------------+
+-------------------------------------------------------------+
| qsi_unit_tests.actor - INSERT |
+----------------+------------+-----------+-------------------+
| actor_id | first_name | last_name | last_update |
+----------------+------------+-----------+-------------------+
| AUTO_INCREMENT | MORRIS | BABO | CURRENT_TIMESTAMP |
+-------------------------------------------------------------+
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
Parent: $tbl_17,
Name: actor_id,
IsVisible: true,
Default: AUTO_INCREMENT,
RefId: $col_18
},
{
Expand All @@ -43,6 +44,7 @@
Parent: $tbl_17,
Name: last_update,
IsVisible: true,
Default: CURRENT_TIMESTAMP,
RefId: $col_21
}
],
Expand Down Expand Up @@ -121,6 +123,7 @@
Parent: $tbl_8,
Name: actor_id,
IsVisible: true,
Default: AUTO_INCREMENT,
RefId: $col_5
},
{
Expand All @@ -139,6 +142,7 @@
Parent: $tbl_8,
Name: last_update,
IsVisible: true,
Default: CURRENT_TIMESTAMP,
RefId: $col_16
}
],
Expand All @@ -162,4 +166,4 @@
],
RefId: $tbl_9
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
Parent: $tbl_13,
Name: city_id,
IsVisible: true,
Default: AUTO_INCREMENT,
RefId: $col_15
},
{
Expand All @@ -71,6 +72,7 @@
Parent: $tbl_13,
Name: last_update,
IsVisible: true,
Default: CURRENT_TIMESTAMP,
RefId: $col_21
}
],
Expand Down Expand Up @@ -103,6 +105,7 @@
Parent: $tbl_6,
Name: actor_id,
IsVisible: true,
Default: AUTO_INCREMENT,
RefId: $col_4
},
{
Expand All @@ -121,6 +124,7 @@
Parent: $tbl_6,
Name: last_update,
IsVisible: true,
Default: CURRENT_TIMESTAMP,
RefId: $col_11
}
],
Expand Down Expand Up @@ -162,4 +166,4 @@
],
RefId: $tbl_8
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
Parent: $tbl_12,
Name: city_id,
IsVisible: true,
Default: AUTO_INCREMENT,
RefId: $col_13
},
{
Expand All @@ -25,6 +26,7 @@
Parent: $tbl_12,
Name: last_update,
IsVisible: true,
Default: CURRENT_TIMESTAMP,
RefId: $col_16
}
],
Expand Down Expand Up @@ -57,6 +59,7 @@
Parent: $tbl_6,
Name: actor_id,
IsVisible: true,
Default: AUTO_INCREMENT,
RefId: $col_4
},
{
Expand All @@ -75,6 +78,7 @@
Parent: $tbl_6,
Name: last_update,
IsVisible: true,
Default: CURRENT_TIMESTAMP,
RefId: $col_11
}
],
Expand Down Expand Up @@ -116,4 +120,4 @@
],
RefId: $tbl_8
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
Parent: $tbl_11,
Name: actor_id,
IsVisible: true,
Default: AUTO_INCREMENT,
RefId: $col_72
},
{
Expand All @@ -71,6 +72,7 @@
Parent: $tbl_11,
Name: last_update,
IsVisible: true,
Default: CURRENT_TIMESTAMP,
RefId: $col_75
}
],
Expand Down Expand Up @@ -133,6 +135,7 @@
Parent: $tbl_13,
Name: last_update,
IsVisible: true,
Default: CURRENT_TIMESTAMP,
RefId: $col_78
}
],
Expand All @@ -146,6 +149,7 @@
Parent: $tbl_133,
Name: film_id,
IsVisible: true,
Default: AUTO_INCREMENT,
RefId: $col_135
},
{
Expand Down Expand Up @@ -182,12 +186,14 @@
Parent: $tbl_133,
Name: rental_duration,
IsVisible: true,
Default: 3,
RefId: $col_145
},
{
Parent: $tbl_133,
Name: rental_rate,
IsVisible: true,
Default: 4.99,
RefId: $col_147
},
{
Expand All @@ -200,12 +206,14 @@
Parent: $tbl_133,
Name: replacement_cost,
IsVisible: true,
Default: 19.99,
RefId: $col_151
},
{
Parent: $tbl_133,
Name: rating,
IsVisible: true,
Default: G,
RefId: $col_153
},
{
Expand All @@ -218,6 +226,7 @@
Parent: $tbl_133,
Name: last_update,
IsVisible: true,
Default: CURRENT_TIMESTAMP,
RefId: $col_157
}
],
Expand Down Expand Up @@ -280,6 +289,7 @@
Parent: $tbl_15,
Name: last_update,
IsVisible: true,
Default: CURRENT_TIMESTAMP,
RefId: $col_81
}
],
Expand Down Expand Up @@ -379,6 +389,7 @@
Parent: $tbl_162,
Name: last_update,
IsVisible: true,
Default: CURRENT_TIMESTAMP,
RefId: $col_165
}
],
Expand All @@ -404,6 +415,7 @@
Parent: $tbl_166,
Name: last_update,
IsVisible: true,
Default: CURRENT_TIMESTAMP,
RefId: $col_169
}
],
Expand All @@ -417,6 +429,7 @@
Parent: $tbl_17,
Name: category_id,
IsVisible: true,
Default: AUTO_INCREMENT,
RefId: $col_82
},
{
Expand All @@ -429,6 +442,7 @@
Parent: $tbl_17,
Name: last_update,
IsVisible: true,
Default: CURRENT_TIMESTAMP,
RefId: $col_84
}
],
Expand Down Expand Up @@ -460,6 +474,7 @@
Parent: $tbl_19,
Name: actor_id,
IsVisible: true,
Default: AUTO_INCREMENT,
RefId: $col_3
},
{
Expand All @@ -478,6 +493,7 @@
Parent: $tbl_19,
Name: last_update,
IsVisible: true,
Default: CURRENT_TIMESTAMP,
RefId: $col_87
}
],
Expand Down Expand Up @@ -516,6 +532,7 @@
$col_21
],
IsVisible: true,
Default: 0,
RefId: $col_20
},
{
Expand Down
Loading

0 comments on commit 4cd0608

Please sign in to comment.