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

#369 Cleanup ToList in tests #418

Merged
merged 2 commits into from
Mar 4, 2016

Conversation

AndyDentFree
Copy link
Contributor

also fixes #361 Add LINQ Count(Expression)

remove ToList and use straight All<...>()>Count()

  • ObjectIntegrationTests.cs
    • SimpleTest
    • CreateObjectTest

remove ToList and use All<...>.Where(...).Count()
SimpelLINQtests.cs

  • CreateList

replace All<...>.Where(...).Count() with All<...>.Count(...)
SimpleLINQtests.cs

  • CountFoundItems
  • CountWithNot

replace realm.All<...>().Where( ...).ToList().First() with .All<...>().First(...)

  • RelationshipTests.cs
    • TimHasATopDog
    • TimHasTwoIterableDogs
    • TimHasTwoIterableDogsListed
    • TimsIterableDogsThrowExceptions
    • TimRetiredHisTopDog
    • TimAddsADogLater
    • DaniHasNoTopDog

replace realm.All<...>().Where( ...).ToList().First() with .All<...>().Single(...)

  • RelationshipTests.cs
    • TimAddsADogByInsert
    • TimLosesHisDogsByOrder
    • TimLosesHisDogsInOneClear
    • TimLosesBilbo
    • TestExceptionsFromTimsDogsOutOfRange

replace realm.All<...>().Where( ...).ToList()[0] with .All<...>().First(...)

  • ObjectIntegrationTests.cs
    • ReadAndWriteEqualityTest

replace realm.All<...>().Where( ...).ToList().First() with .All<...>().Where(...).First()

  • RelationshipTests.cs
    • DaniHasNoTopDog
    • TestExceptionsFromEmptyListOutOfRange

replace realm.All<...>().Where( ...).ToList().First() with .All<...>().Where(...).First()

  • RelationshipTests.cs
    • DaniHasNoDogs
    • TestExceptionsFromIteratingEmptyList

replace realm.All<...>().Where( ...).ToList().Count with .All<...>().Count(...)

  • TestManagingStandaloneThreeLevelRelationship
  • TestCircularRelationshipsFromStandaloneTwoStage

RealmResultsVisitor.cs

  • RecurseToWhereOrRunLambda added
  • VisitMethodCall
    • handle Count, Single and First with no lambda argument, using RecurseToWhereOrRunLambda

TODO
NonAutomaticPropertiesShouldBeIgnored
_realm.All().ToList().Single() to straight
_realm.All().Single()

#361 Add LINQ Count(Expression)

remove ToList and use straight All<...>()>Count()
- ObjectIntegrationTests.cs
  - SimpleTest
  - CreateObjectTest

remove ToList and use All<...>.Where(...).Count()
SimpelLINQtests.cs
- CreateList

replace  All<...>.Where(...).Count() with All<...>.Count(...)
SimpleLINQtests.cs
- CountFoundItems
- CountWithNot

replace realm.All<...>().Where( ...).ToList().First() with .All<...>().First(...)
- RelationshipTests.cs
  - TimHasATopDog
  - TimHasTwoIterableDogs
  - TimHasTwoIterableDogsListed
  - TimsIterableDogsThrowExceptions
  - TimRetiredHisTopDog
  - TimAddsADogLater
  - DaniHasNoTopDog

replace realm.All<...>().Where( ...).ToList().First() with .All<...>().Single(...)
- RelationshipTests.cs
  - TimAddsADogByInsert
  - TimLosesHisDogsByOrder
  - TimLosesHisDogsInOneClear
  - TimLosesBilbo
  - TestExceptionsFromTimsDogsOutOfRange

replace realm.All<...>().Where( ...).ToList()[0] with .All<...>().First(...)
- ObjectIntegrationTests.cs
  - ReadAndWriteEqualityTest

replace realm.All<...>().Where( ...).ToList().First() with .All<...>().Where(...).First()
- RelationshipTests.cs
  - DaniHasNoTopDog
  - TestExceptionsFromEmptyListOutOfRange

replace realm.All<...>().Where( ...).ToList().First() with .All<...>().Where(...).First()
- RelationshipTests.cs
  - DaniHasNoDogs
  - TestExceptionsFromIteratingEmptyList

replace realm.All<...>().Where( ...).ToList().Count with .All<...>().Count(...)
- TestManagingStandaloneThreeLevelRelationship
- TestCircularRelationshipsFromStandaloneTwoStage

RealmResultsVisitor.cs
- RecurseToWhereOrRunLambda added
- VisitMethodCall
  - handle Count, Single and First with no lambda argument, using RecurseToWhereOrRunLambda

TODO
NonAutomaticPropertiesShouldBeIgnored
_realm.All<Person>().ToList().Single() to straight
_realm.All<Person>().Single()
Added documentation
@AndyDentFree AndyDentFree added this to the rc milestone Mar 4, 2016
@kristiandupont
Copy link
Contributor

👍

AndyDentFree added a commit that referenced this pull request Mar 4, 2016
@AndyDentFree AndyDentFree merged commit 616f90e into master Mar 4, 2016
@AndyDentFree AndyDentFree deleted the ad/feature/linq/cleanup-ToList-#369 branch March 14, 2016 13:06
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add LINQ Count(expression)
2 participants