You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/* Create test Users list */
new PersistenceSpecification<Role>(session)
.CheckProperty(u => u.Name)
.CheckList(u => u.Users, users, (role, user) => role.AddUser(user))
.VerifyTheMappings();
Sometimes this fails and sometimes it passes. From some debugging, it seems that it is retrieving the Users in a different order than which they were added. I imagine it because the generated Guid (using Guid.Comb) is altering the order on the database query. (I think it is because the guid is not sequential on the association table.) So basically, even though the list contains the same elements, since they are in a different order, fails the test because the source appears to compare elements by index position. So my question is, should I be enforcing an order on my queries or should CheckList not assume ordering on the list?
The text was updated successfully, but these errors were encountered:
I'd modify CheckList() to be indifferent about the order. OTOH, I'm sometimes forced to add ordering in situations like this to fix paging (my database server is sometimes not even consistent about the order of results on a query against the the same data).
It seems that CheckList enforces ordering on the lists that it checks. I have a many-to-many relationship between Users and Roles as follows:
My testing is as follows:
Sometimes this fails and sometimes it passes. From some debugging, it seems that it is retrieving the Users in a different order than which they were added. I imagine it because the generated Guid (using Guid.Comb) is altering the order on the database query. (I think it is because the guid is not sequential on the association table.) So basically, even though the list contains the same elements, since they are in a different order, fails the test because the source appears to compare elements by index position. So my question is, should I be enforcing an order on my queries or should CheckList not assume ordering on the list?
The text was updated successfully, but these errors were encountered: