-
Notifications
You must be signed in to change notification settings - Fork 165
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
RNET-1133: Fixed equality comparison for collections in mixed #3573
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,27 +90,14 @@ public void List_WhenRetrieved_WorksWithAllTypes([Values(true, false)] bool isMa | |
} | ||
|
||
[Test] | ||
public void List_InRealmValue_NotEqualToAnything([Values(true, false)] bool isManaged) | ||
public void List_InRealmValue_Equality([Values(true, false)] bool isManaged) | ||
{ | ||
var innerList = ListGenerator(1); | ||
var innerDict = DictGenerator(1); | ||
|
||
var originalList = new List<RealmValue> | ||
{ | ||
RealmValue.Null, | ||
1, | ||
true, | ||
"string", | ||
new byte[] { 0, 1, 2 }, | ||
new DateTimeOffset(1234, 5, 6, 7, 8, 9, TimeSpan.Zero), | ||
1f, | ||
2d, | ||
3m, | ||
new ObjectId("5f63e882536de46d71877979"), | ||
Guid.Parse("3809d6d9-7618-4b3d-8044-2aa35fd02f31"), | ||
new InternalObject { IntProperty = 10, StringProperty = "brown" }, | ||
innerList, | ||
innerDict, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why the loss of cases? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I could have kept the full list, but in the end it shouldn't make a difference on the test and I thought it would make the test easier to read. I didn't really need to 😁 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay.. gut reaction was just that the coverage was diminished, and would those tests now have failed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's understandable, I'll put those back so it's easier to follow |
||
"string" | ||
}; | ||
|
||
RealmValue rv = originalList; | ||
|
@@ -120,8 +107,11 @@ public void List_InRealmValue_NotEqualToAnything([Values(true, false)] bool isMa | |
rv = PersistAndFind(rv).RealmValueProperty; | ||
} | ||
|
||
Assert.That(rv == originalList, Is.False); | ||
Assert.That(rv.Equals(originalList), Is.False); | ||
#pragma warning disable CS1718 // Comparison made to same variable | ||
Assert.That(rv == rv, Is.True); | ||
#pragma warning restore CS1718 // Comparison made to same variable | ||
Assert.That(rv == originalList, isManaged ? Is.False : Is.True); | ||
rorbech marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Assert.That(rv.Equals(originalList), isManaged ? Is.False : Is.True); | ||
} | ||
|
||
[Test] | ||
|
@@ -577,16 +567,11 @@ public void Dictionary_WhenRetrieved_WorksWithAllTypes([Values(true, false)] boo | |
} | ||
|
||
[Test] | ||
public void Dictionary_InRealmValue_NotEqualToAnything([Values(true, false)] bool isManaged) | ||
public void Dictionary_InRealmValue_Equality([Values(true, false)] bool isManaged) | ||
{ | ||
var innerList = ListGenerator(1); | ||
var innerDict = DictGenerator(1); | ||
|
||
var originalDict = new Dictionary<string, RealmValue> | ||
{ | ||
{ "c", new InternalObject { IntProperty = 10, StringProperty = "brown" } }, | ||
{ "d", innerList }, | ||
{ "e", innerDict }, | ||
}; | ||
|
||
RealmValue rv = originalDict; | ||
|
@@ -596,8 +581,11 @@ public void Dictionary_InRealmValue_NotEqualToAnything([Values(true, false)] boo | |
rv = PersistAndFind(rv).RealmValueProperty; | ||
} | ||
|
||
Assert.That(rv == originalDict, Is.False); | ||
Assert.That(rv.Equals(originalDict), Is.False); | ||
#pragma warning disable CS1718 // Comparison made to same variable | ||
Assert.That(rv == rv, Is.True); | ||
#pragma warning restore CS1718 // Comparison made to same variable | ||
Assert.That(rv == originalDict, isManaged ? Is.False : Is.True); | ||
Assert.That(rv.Equals(originalDict), isManaged ? Is.False : Is.True); | ||
} | ||
|
||
[Test] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍