Hi, Since unit testing has switched to SQLite, it seems to be case sensitive VS non case sensitive with EntityFramework.
Eg. var adminUser = _context.Users.FirstOrDefault(u => u.TenantId == _tenantId && u.UserName == AbpUserBase.AdminUserName);
This returns the admin user when application runs normally but doesn't return when in test via SQLite. Changing it to lowercase "admin" works. var adminUser = _context.Users.FirstOrDefault(u => u.TenantId == _tenantId && u.UserName == "admin");
Is there a setting I can change to ensure consistency between SQLite and EF?
Thanks, Matt
3 Answer(s)
-
0
Hi,
I couldn't understand why this happened because value of "AbpUserBase.AdminUserName" is also lower case. Can you check it in your tests ?
Then we can take a look at case sensitivity problem.
Thanks.
-
0
You are correct, my test I accidentally actually used StaticRoleNames.Host.Admin which has a capital. So my test was wrong.
But that does still highlight the fact that SQLite is acting differently to EF with SQL Server in terms of Case Sensitivity?
-
0
Hi,
Yes, you are right. But we want to use a lighter way in unit tests.
So, maybe you can solve case sensetivity problem like explained in this issue <a class="postlink" href="https://github.com/aspnet/EntityFramework/issues/8033">https://github.com/aspnet/EntityFramework/issues/8033</a>.
If you have ideas about unit tests, we will be very happ to hear and consider.
Thanks.