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

Azure.Search: Assert.AreAqual not sufficient for comparing static models #10945

Closed
heaths opened this issue Mar 31, 2020 · 1 comment
Closed
Labels
Client This issue points to a problem in the data-plane of the library. Search
Milestone

Comments

@heaths
Copy link
Member

heaths commented Mar 31, 2020

While investing #10944 I found that StaticDocuments test was passing despite having the same problem that complex fields like Location were not being serialized and thus coming back null. While Assert.AreEqual works for SearchDocument, it does not for static models like Hotel.

For testing, we could probably implement IEqualityComparer<Hotel> et. al. to pass use, like:

Assert.That(docs[i], Is.EqualTo(SearchResources.TestDocuments[i]).Using(HotelComparerShared));

Or, since it's only test data, just override Equals on Hotel et. al.

This works for dynamic documents because NUnit uses a chained comparer for common types like dictionaries, so works on nested SearchDocuments.

@ghost ghost added the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Mar 31, 2020
@heaths heaths added Client This issue points to a problem in the data-plane of the library. Search labels Mar 31, 2020
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Mar 31, 2020
@heaths heaths added this to the [2020] April milestone Mar 31, 2020
@heaths
Copy link
Member Author

heaths commented Mar 31, 2020

Never mind. The existing equals override was explicitly excluding Location while we wait for a resolution to #10592, but Microsoft.Spatial.GeographyPoint will suffice for now.

@heaths heaths closed this as completed Mar 31, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Mar 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Client This issue points to a problem in the data-plane of the library. Search
Projects
None yet
Development

No branches or pull requests

1 participant