-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
Solution of Compute - Include - Unit test #105
base: main
Are you sure you want to change the base?
Conversation
` Expected: <DelegateDecompiler.EntityFramework.Tests.EfItems.EfParent> But was: <DelegateDecompiler.EntityFramework.Tests.EfItems.EfParent>` I ran into possibly a bug in the test harness. CheckerAndLogger.CompareAndLogList() is telling me that two of the object match and therefore the Assertion AreEqual fails, huh? Can someone else (i.e. @hazzik @JonPSmith @mayorovp) confirm that this is correct? |
Hi @txavier, I'm not sure what test is failing, but looking at the |
Hi @JonPSmith, On my machine the test in the file Test01Include.cs/TestInclude() throws an exception on line 25 of CheckerAndLogger.cs/CompareAndLogList<>(). The failure message reads: But was: <DelegateDecompiler.EntityFramework.Tests.EfItems.EfParent>` So either this is a bug or the failure message is unclear. |
Hi @txavier, I do remember that NUnit's CollectionAssert isn't that friendly on its error messages. Have you run the test in debug mode with a break before the test? You could then check the two collections manually and see if they are the same. Also, as the test is to check the |
Yep, @JonPSmith upon manual checking on a breakpoint the two collections are the same. |
Hi @txavier, OK, I found some time this weekend and had a look. Basically you can't use NUnit's collection assert in the way you are using it, as the collection.AreEqual for classes compares instances, not the data inside the instances (see this SO answer for how it works). You will see that in my tests I select the primary key of the entity so that the NUnit collection assert, called by So - I would suggest you changing your test to the code below. It only checks the first Parent, but I think that is fine. env.CompareAndLogList(linq.First().Children.Select(k => k.EfChildId).ToList(), dd.First().Children.Select(k => k.EfChildId).ToList()); PS. One small point. You should change the namespace of your test to |
I had to squash commits as it was producing some strange history |
This is #53 created by @mayorovp. This pull request, though, also supplies a rewritten unit test for your review.