Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MySQL tests #774

Merged
merged 3 commits into from
May 12, 2017
Merged

Fix MySQL tests #774

merged 3 commits into from
May 12, 2017

Conversation

bgrainger
Copy link
Contributor

The MySQLTests were being run against TestBase.connection, which is a SQLConnection, not the local variable conn, which is the MySqlConnection.

Once this was fixed, two tests started failing because #295 (InvalidCastException is thrown when AllowZeroDateTime=True is present in the MySQL connection string) is still open.

Finally, I added a minor optimisation to not lazily-create TestBase.connection in TestBase.Dispose; this is primarily useful for the MySQLTests that don't ever need to open a SQLConnection to run.

This avoids creating a SQLConnection simply to Dispose it.
'connection' is a protected variable in the TestBase class that is a
SQL Server connection, not a MySQL connection.
As per issue DapperLib#295, setting "AllowZeroDateTime=True" in the connection
string causes an InvalidCastException in SqlMapper.
@NickCraver
Copy link
Member

Well, damn. I wish you made this 3 days ago before I started the netstandard2.0 branch :) Thanks for the fixes! I'll get them merged over into the 2.0 stuff as well (broken for other reasons).

@NickCraver NickCraver merged commit a46354a into DapperLib:master May 12, 2017
@bgrainger
Copy link
Contributor Author

Well, if you had tweeted this three days ago, I might have started earlier 😜: https://twitter.com/Nick_Craver/status/862862874619805696

I author MySqlConnector so your tweet had got me thinking I should start support for netstandard2.0 and tackle items such as mysql-net/MySqlConnector#182.

But first I had to see if Dapper's MySQL tests could even run against the current version of my library, which is when the yak shaving began...

@NickCraver
Copy link
Member

=P fair enough, thanks for all the work and testing here, it's much appreciated!

@bgrainger bgrainger deleted the fix-mysql-tests branch May 12, 2017 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants