diff --git a/src/DocumentDbTests/Indexes/full_text_index.cs b/src/DocumentDbTests/Indexes/full_text_index.cs index 3610620ce1..cc3e652996 100644 --- a/src/DocumentDbTests/Indexes/full_text_index.cs +++ b/src/DocumentDbTests/Indexes/full_text_index.cs @@ -227,7 +227,7 @@ public async Task using_full_text_query_through_query_session() #endregion - result.Count().ShouldBe(1); + result.Count.ShouldBe(1); } [PgVersionTargetedFact(MinimumVersion = "10.0")] diff --git a/src/DocumentDbTests/Reading/BatchedQuerying/batched_querying_acceptance_Tests.cs b/src/DocumentDbTests/Reading/BatchedQuerying/batched_querying_acceptance_Tests.cs index 8f30530e09..5b6a45b20f 100644 --- a/src/DocumentDbTests/Reading/BatchedQuerying/batched_querying_acceptance_Tests.cs +++ b/src/DocumentDbTests/Reading/BatchedQuerying/batched_querying_acceptance_Tests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; @@ -369,7 +369,7 @@ public async Task can_find_multiple_docs_by_id() var list = await task; - list.Count().ShouldBe(2); + list.Count.ShouldBe(2); list.Any(x => x.Id == target1.Id).ShouldBeTrue(); list.Any(x => x.Id == target3.Id).ShouldBeTrue(); } @@ -403,7 +403,7 @@ public async Task can_find_multiple_docs_by_id_2() var list = await task; - list.Count().ShouldBe(2); + list.Count.ShouldBe(2); list.Any(x => x.Id == target1.Id).ShouldBeTrue(); list.Any(x => x.Id == target3.Id).ShouldBeTrue(); } diff --git a/src/DocumentDbTests/Reading/Json/streaming_json_results.cs b/src/DocumentDbTests/Reading/Json/streaming_json_results.cs index b23440d78b..ca1726135a 100644 --- a/src/DocumentDbTests/Reading/Json/streaming_json_results.cs +++ b/src/DocumentDbTests/Reading/Json/streaming_json_results.cs @@ -631,7 +631,7 @@ public async Task streaming_compiled_query_list_to_JSON() var customers = theStore.Options.Serializer().FromJson(stream); customers.Length.ShouldBe(2); - customerJson.Count().ShouldBe(148); // magic number that just happens to be the length of the JSON string returned + customerJson.Length.ShouldBe(148); // magic number that just happens to be the length of the JSON string returned } diff --git a/src/DocumentDbTests/SessionMechanics/DocumentSession_change_set_tracking_Tests.cs b/src/DocumentDbTests/SessionMechanics/DocumentSession_change_set_tracking_Tests.cs index 82c0074db2..2acd4abbda 100644 --- a/src/DocumentDbTests/SessionMechanics/DocumentSession_change_set_tracking_Tests.cs +++ b/src/DocumentDbTests/SessionMechanics/DocumentSession_change_set_tracking_Tests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using System.Threading.Tasks; using Marten.Linq.SqlGeneration; @@ -58,7 +58,7 @@ public async Task categorize_changes_inserts_and_deletions() theSession.Store(new Target()); await theSession.SaveChangesAsync(); - logger.Commits.Count().ShouldBe(2); + logger.Commits.Count.ShouldBe(2); logger.LastCommit.Updated.Count().ShouldBe(1); } diff --git a/src/DocumentDbTests/Writing/Identity/using_int_identity.cs b/src/DocumentDbTests/Writing/Identity/using_int_identity.cs index bd2f462912..0c0d3d22b8 100644 --- a/src/DocumentDbTests/Writing/Identity/using_int_identity.cs +++ b/src/DocumentDbTests/Writing/Identity/using_int_identity.cs @@ -1,4 +1,4 @@ -using System.Linq; +using System.Linq; using System.Threading.Tasks; using Marten.Testing.Documents; using Marten.Testing.Harness; @@ -71,7 +71,7 @@ public async Task load_by_array_of_ids() await theSession.SaveChangesAsync(); using var session = theStore.QuerySession(); - (await session.LoadManyAsync(4, 5, 6)).Count().ShouldBe(3); + (await session.LoadManyAsync(4, 5, 6)).Count.ShouldBe(3); } public using_int_identity(DefaultStoreFixture fixture) : base(fixture) diff --git a/src/DocumentDbTests/Writing/Identity/using_long_identity.cs b/src/DocumentDbTests/Writing/Identity/using_long_identity.cs index c870ea1321..dbd1d77988 100644 --- a/src/DocumentDbTests/Writing/Identity/using_long_identity.cs +++ b/src/DocumentDbTests/Writing/Identity/using_long_identity.cs @@ -1,4 +1,4 @@ -using System.Linq; +using System.Linq; using System.Threading.Tasks; using Marten.Testing.Documents; using Marten.Testing.Harness; @@ -71,7 +71,7 @@ public async Task load_by_array_of_ids() await theSession.SaveChangesAsync(); using var session = theStore.QuerySession(); - (await session.LoadManyAsync(4, 5, 6)).Count().ShouldBe(3); + (await session.LoadManyAsync(4, 5, 6)).Count.ShouldBe(3); } public using_long_identity(DefaultStoreFixture fixture) : base(fixture) diff --git a/src/DocumentDbTests/Writing/Identity/using_string_identity.cs b/src/DocumentDbTests/Writing/Identity/using_string_identity.cs index 0fefddf226..691e07f94d 100644 --- a/src/DocumentDbTests/Writing/Identity/using_string_identity.cs +++ b/src/DocumentDbTests/Writing/Identity/using_string_identity.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using System.Threading.Tasks; using Marten.Testing.Documents; @@ -95,7 +95,7 @@ public async Task load_by_array_of_ids() await theSession.SaveChangesAsync(); using var session = theStore.QuerySession(); - (await session.LoadManyAsync("A", "B", "E")).Count().ShouldBe(3); + (await session.LoadManyAsync("A", "B", "E")).Count.ShouldBe(3); } public using_string_identity(DefaultStoreFixture fixture) : base(fixture) diff --git a/src/DocumentDbTests/Writing/document_inserts.cs b/src/DocumentDbTests/Writing/document_inserts.cs index d62d19aac5..b4ac23d2b3 100644 --- a/src/DocumentDbTests/Writing/document_inserts.cs +++ b/src/DocumentDbTests/Writing/document_inserts.cs @@ -60,7 +60,7 @@ public async Task can_insert_records() using (var query = theStore.QuerySession()) { - query.Query().ToList().Count().ShouldBe(1); + query.Query().ToList().Count.ShouldBe(1); } } diff --git a/src/DocumentDbTests/Writing/storing_documents.cs b/src/DocumentDbTests/Writing/storing_documents.cs index eba85d53de..71728452d3 100644 --- a/src/DocumentDbTests/Writing/storing_documents.cs +++ b/src/DocumentDbTests/Writing/storing_documents.cs @@ -219,7 +219,7 @@ public async Task load_by_id_array(DocumentTracking tracking) using var querySession = theStore.QuerySession(); var users = await querySession.LoadManyAsync(user2.Id, user3.Id, user4.Id); - users.Count().ShouldBe(3); + users.Count.ShouldBe(3); } [Theory] @@ -252,7 +252,7 @@ public async Task load_by_id_array_async(DocumentTracking tracking) await using var querySession = store.QuerySession(); var users = await querySession.LoadManyAsync(user2.Id, user3.Id, user4.Id); - users.Count().ShouldBe(3); + users.Count.ShouldBe(3); #endregion } diff --git a/src/EventSourcingTests/QuickAppend/quick_append_event_capture_and_fetching_the_stream.cs b/src/EventSourcingTests/QuickAppend/quick_append_event_capture_and_fetching_the_stream.cs index 1884f76974..908add182f 100644 --- a/src/EventSourcingTests/QuickAppend/quick_append_event_capture_and_fetching_the_stream.cs +++ b/src/EventSourcingTests/QuickAppend/quick_append_event_capture_and_fetching_the_stream.cs @@ -58,7 +58,7 @@ await When.CalledForEachAsync(tenants, async (tenantId, _) => var streamEvents = await session.Events.FetchStreamAsync(id); - streamEvents.Count().ShouldBe(2); + streamEvents.Count.ShouldBe(2); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -87,7 +87,7 @@ public Task capture_events_to_a_new_stream_and_fetch_the_events_back_async(Tenan var streamEvents = await session.Events.FetchStreamAsync(id); - streamEvents.Count().ShouldBe(2); + streamEvents.Count.ShouldBe(2); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -117,7 +117,7 @@ public Task capture_events_to_a_new_stream_and_fetch_the_events_back_async_with_ var streamEvents = await session.Events.QueryAllRawEvents() .Where(x => x.StreamId == id).OrderBy(x => x.Version).ToListAsync(); - streamEvents.Count().ShouldBe(2); + streamEvents.Count.ShouldBe(2); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -147,7 +147,7 @@ public void capture_events_to_a_new_stream_and_fetch_the_events_back_sync_with_l var streamEvents = session.Events.QueryAllRawEvents() .Where(x => x.StreamId == id).OrderBy(x => x.Version).ToList(); - streamEvents.Count().ShouldBe(2); + streamEvents.Count.ShouldBe(2); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -280,7 +280,7 @@ await When.CalledForEachAsync(tenants, async (tenantId, index) => var streamEvents = await session.Events.FetchStreamAsync(id); - streamEvents.Count().ShouldBe(2); + streamEvents.Count.ShouldBe(2); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -311,7 +311,7 @@ await When.CalledForEachAsync(tenants, async (tenantId, index) => var streamEvents = await session.Events.FetchStreamAsync(id); - streamEvents.Count().ShouldBe(2); + streamEvents.Count.ShouldBe(2); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -351,7 +351,7 @@ await When.CalledForEachAsync(tenants, async (tenantId, index) => var streamEvents = await session.Events.FetchStreamAsync(id); - streamEvents.Count().ShouldBe(3); + streamEvents.Count.ShouldBe(3); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -384,7 +384,7 @@ await When.CalledForEachAsync(tenants, async (tenantId, index) => var streamEvents = await session.Events.FetchStreamAsync(id); - streamEvents.Count().ShouldBe(2); + streamEvents.Count.ShouldBe(2); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -414,7 +414,7 @@ await When.CalledForEachAsync(tenants, async (tenantId, index) => var streamEvents = await session.Events.FetchStreamAsync(id); - streamEvents.Count().ShouldBe(2); + streamEvents.Count.ShouldBe(2); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -447,7 +447,7 @@ await When.CalledForEachAsync(tenants, async (tenantId, index) => var streamEvents = await session.Events.FetchStreamAsync(id); - streamEvents.Count().ShouldBe(2); + streamEvents.Count.ShouldBe(2); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -486,7 +486,7 @@ await When.CalledForEachAsync(tenants, async (tenantId, index) => var streamEvents = await session.Events.FetchStreamAsync(id); - streamEvents.Count().ShouldBe(3); + streamEvents.Count.ShouldBe(3); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); diff --git a/src/EventSourcingTests/QuickAppend/quick_append_event_capture_and_fetching_the_stream_with_string_identifiers.cs b/src/EventSourcingTests/QuickAppend/quick_append_event_capture_and_fetching_the_stream_with_string_identifiers.cs index 50a8c8b4a9..608aa45efc 100644 --- a/src/EventSourcingTests/QuickAppend/quick_append_event_capture_and_fetching_the_stream_with_string_identifiers.cs +++ b/src/EventSourcingTests/QuickAppend/quick_append_event_capture_and_fetching_the_stream_with_string_identifiers.cs @@ -32,7 +32,7 @@ public async Task capture_events_to_a_new_stream_and_fetch_the_events_back() var streamEvents = await theSession.Events.FetchStreamAsync(id); - streamEvents.Count().ShouldBe(2); + streamEvents.Count.ShouldBe(2); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -57,7 +57,7 @@ public async Task capture_events_to_a_new_stream_and_fetch_the_events_back_async var streamEvents = await theSession.Events.FetchStreamAsync(id); - streamEvents.Count().ShouldBe(2); + streamEvents.Count.ShouldBe(2); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -83,7 +83,7 @@ public async Task capture_events_to_a_new_stream_and_fetch_the_events_back_async var streamEvents = await theSession.Events.QueryAllRawEvents() .Where(x => x.StreamKey == id).OrderBy(x => x.Version).ToListAsync(); - streamEvents.Count().ShouldBe(2); + streamEvents.Count.ShouldBe(2); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -109,7 +109,7 @@ public async Task capture_events_to_a_new_stream_and_fetch_the_events_back_sync_ var streamEvents = theSession.Events.QueryAllRawEvents() .Where(x => x.StreamKey == id).OrderBy(x => x.Version).ToList(); - streamEvents.Count().ShouldBe(2); + streamEvents.Count.ShouldBe(2); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -289,7 +289,7 @@ public async Task capture_events_to_a_new_stream_and_fetch_the_events_back_with_ var streamEvents = await session.Events.FetchStreamAsync(id); - streamEvents.Count().ShouldBe(2); + streamEvents.Count.ShouldBe(2); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -311,7 +311,7 @@ public async Task capture_events_to_a_non_existing_stream_and_fetch_the_events_b var streamEvents = await session.Events.FetchStreamAsync(id); - streamEvents.Count().ShouldBe(2); + streamEvents.Count.ShouldBe(2); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -342,7 +342,7 @@ public async Task capture_events_to_an_existing_stream_and_fetch_the_events_back var streamEvents = await session.Events.FetchStreamAsync(id); - streamEvents.Count().ShouldBe(3); + streamEvents.Count.ShouldBe(3); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -365,7 +365,7 @@ public async Task capture_events_to_a_new_stream_and_fetch_the_events_back_in_an var streamEvents = await session.Events.FetchStreamAsync(id); - streamEvents.Count().ShouldBe(2); + streamEvents.Count.ShouldBe(2); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -388,7 +388,7 @@ public async Task capture_events_to_a_non_existing_stream_and_fetch_the_events_b var streamEvents = await session.Events.FetchStreamAsync(id); - streamEvents.Count().ShouldBe(2); + streamEvents.Count.ShouldBe(2); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -418,7 +418,7 @@ public async Task capture_events_to_an_existing_stream_and_fetch_the_events_back var streamEvents = await session.Events.FetchStreamAsync(id); - streamEvents.Count().ShouldBe(3); + streamEvents.Count.ShouldBe(3); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); diff --git a/src/EventSourcingTests/end_to_end_event_capture_and_fetching_the_stream.cs b/src/EventSourcingTests/end_to_end_event_capture_and_fetching_the_stream.cs index 4621732499..745d6ac72f 100644 --- a/src/EventSourcingTests/end_to_end_event_capture_and_fetching_the_stream.cs +++ b/src/EventSourcingTests/end_to_end_event_capture_and_fetching_the_stream.cs @@ -61,7 +61,7 @@ await When.CalledForEachAsync(tenants, async (tenantId, _) => var streamEvents = await session.Events.FetchStreamAsync(id); - streamEvents.Count().ShouldBe(2); + streamEvents.Count.ShouldBe(2); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -94,7 +94,7 @@ public Task capture_events_to_a_new_stream_and_fetch_the_events_back_async(Tenan var streamEvents = await session.Events.FetchStreamAsync(id); - streamEvents.Count().ShouldBe(2); + streamEvents.Count.ShouldBe(2); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -128,7 +128,7 @@ public Task capture_events_to_a_new_stream_and_fetch_the_events_back_async_with_ var streamEvents = await session.Events.QueryAllRawEvents() .Where(x => x.StreamId == id).OrderBy(x => x.Version).ToListAsync(); - streamEvents.Count().ShouldBe(2); + streamEvents.Count.ShouldBe(2); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -162,7 +162,7 @@ await When.CalledForEachAsync(tenants, async (tenantId, _) => var streamEvents = session.Events.QueryAllRawEvents() .Where(x => x.StreamId == id).OrderBy(x => x.Version).ToList(); - streamEvents.Count().ShouldBe(2); + streamEvents.Count.ShouldBe(2); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -299,7 +299,7 @@ await When.CalledForEachAsync(tenants, async (tenantId, index) => var streamEvents = await session.Events.FetchStreamAsync(id); - streamEvents.Count().ShouldBe(2); + streamEvents.Count.ShouldBe(2); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -330,7 +330,7 @@ public void capture_events_to_a_non_existing_stream_and_fetch_the_events_back(Te var streamEvents = await session.Events.FetchStreamAsync(id); - streamEvents.Count().ShouldBe(2); + streamEvents.Count.ShouldBe(2); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -370,7 +370,7 @@ await When.CalledForEachAsync(tenants, async (tenantId, index) => var streamEvents = await session.Events.FetchStreamAsync(id); - streamEvents.Count().ShouldBe(3); + streamEvents.Count.ShouldBe(3); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -403,7 +403,7 @@ await When.CalledForEachAsync(tenants, async (tenantId, index) => var streamEvents = await session.Events.FetchStreamAsync(id); - streamEvents.Count().ShouldBe(2); + streamEvents.Count.ShouldBe(2); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -433,7 +433,7 @@ await When.CalledForEachAsync(tenants, async (tenantId, index) => var streamEvents = await session.Events.FetchStreamAsync(id); - streamEvents.Count().ShouldBe(2); + streamEvents.Count.ShouldBe(2); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -466,7 +466,7 @@ await When.CalledForEachAsync(tenants, async (tenantId, index) => var streamEvents = await session.Events.FetchStreamAsync(id); - streamEvents.Count().ShouldBe(2); + streamEvents.Count.ShouldBe(2); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -509,7 +509,7 @@ await When.CalledForEachAsync(tenants, async (tenantId, index) => var streamEvents = await session.Events.FetchStreamAsync(id); - streamEvents.Count().ShouldBe(3); + streamEvents.Count.ShouldBe(3); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); diff --git a/src/EventSourcingTests/end_to_end_event_capture_and_fetching_the_stream_with_string_identifiers.cs b/src/EventSourcingTests/end_to_end_event_capture_and_fetching_the_stream_with_string_identifiers.cs index 7746580e9c..a9a3fb5adc 100644 --- a/src/EventSourcingTests/end_to_end_event_capture_and_fetching_the_stream_with_string_identifiers.cs +++ b/src/EventSourcingTests/end_to_end_event_capture_and_fetching_the_stream_with_string_identifiers.cs @@ -36,7 +36,7 @@ public async Task capture_events_to_a_new_stream_and_fetch_the_events_back() var streamEvents = await theSession.Events.FetchStreamAsync(id); - streamEvents.Count().ShouldBe(2); + streamEvents.Count.ShouldBe(2); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -61,7 +61,7 @@ public async Task capture_events_to_a_new_stream_and_fetch_the_events_back_async var streamEvents = await theSession.Events.FetchStreamAsync(id); - streamEvents.Count().ShouldBe(2); + streamEvents.Count.ShouldBe(2); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -87,7 +87,7 @@ public async Task capture_events_to_a_new_stream_and_fetch_the_events_back_async var streamEvents = await theSession.Events.QueryAllRawEvents() .Where(x => x.StreamKey == id).OrderBy(x => x.Version).ToListAsync(); - streamEvents.Count().ShouldBe(2); + streamEvents.Count.ShouldBe(2); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -113,7 +113,7 @@ public async Task capture_events_to_a_new_stream_and_fetch_the_events_back_sync_ var streamEvents = theSession.Events.QueryAllRawEvents() .Where(x => x.StreamKey == id).OrderBy(x => x.Version).ToList(); - streamEvents.Count().ShouldBe(2); + streamEvents.Count.ShouldBe(2); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -219,7 +219,7 @@ public async Task capture_events_to_a_new_stream_and_fetch_the_events_back_with_ var streamEvents = await session.Events.FetchStreamAsync(id); - streamEvents.Count().ShouldBe(2); + streamEvents.Count.ShouldBe(2); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -241,7 +241,7 @@ public async Task capture_events_to_a_non_existing_stream_and_fetch_the_events_b var streamEvents = await session.Events.FetchStreamAsync(id); - streamEvents.Count().ShouldBe(2); + streamEvents.Count.ShouldBe(2); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -272,7 +272,7 @@ public async Task capture_events_to_an_existing_stream_and_fetch_the_events_back var streamEvents = await session.Events.FetchStreamAsync(id); - streamEvents.Count().ShouldBe(3); + streamEvents.Count.ShouldBe(3); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -295,7 +295,7 @@ public async Task capture_events_to_a_new_stream_and_fetch_the_events_back_in_an var streamEvents = await session.Events.FetchStreamAsync(id); - streamEvents.Count().ShouldBe(2); + streamEvents.Count.ShouldBe(2); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -318,7 +318,7 @@ public async Task capture_events_to_a_non_existing_stream_and_fetch_the_events_b var streamEvents = await session.Events.FetchStreamAsync(id); - streamEvents.Count().ShouldBe(2); + streamEvents.Count.ShouldBe(2); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); @@ -348,7 +348,7 @@ public async Task capture_events_to_an_existing_stream_and_fetch_the_events_back var streamEvents = await session.Events.FetchStreamAsync(id); - streamEvents.Count().ShouldBe(3); + streamEvents.Count.ShouldBe(3); streamEvents.ElementAt(0).Data.ShouldBeOfType(); streamEvents.ElementAt(0).Version.ShouldBe(1); streamEvents.ElementAt(1).Data.ShouldBeOfType(); diff --git a/src/LinqTests/Acceptance/query_with_inheritance.cs b/src/LinqTests/Acceptance/query_with_inheritance.cs index 55073eb6cf..0f9d846cee 100644 --- a/src/LinqTests/Acceptance/query_with_inheritance.cs +++ b/src/LinqTests/Acceptance/query_with_inheritance.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using System.Threading.Tasks; using JasperFx; @@ -128,7 +128,7 @@ public async Task get_all_subclasses_of_an_interface_and_instantiate_them() await theSession.SaveChangesAsync(); var list = theSession.Query().ToList(); - list.Count().ShouldBe(3); + list.Count.ShouldBe(3); list.Count(s => s.Ability == "Invent").ShouldBe(1); } @@ -144,7 +144,7 @@ public async Task get_all_subclasses_of_an_interface_and_instantiate_them_async( await theSession.SaveChangesAsync(); var list = await theSession.Query().ToListAsync(); - list.Count().ShouldBe(3); + list.Count.ShouldBe(3); list.Count(s => s.Ability == "Invent").ShouldBe(1); } diff --git a/src/LinqTests/Acceptance/select_many.cs b/src/LinqTests/Acceptance/select_many.cs index 4698ed5670..0cfe51befa 100644 --- a/src/LinqTests/Acceptance/select_many.cs +++ b/src/LinqTests/Acceptance/select_many.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -39,7 +39,7 @@ public async Task can_do_simple_select_many_against_simple_array() var names = query.Query().SelectMany(x => x.Tags).ToList(); names - .Count().ShouldBe(9); + .Count.ShouldBe(9); } } #endregion @@ -117,7 +117,7 @@ public async Task can_do_simple_select_many_against_generic_list() var names = query.Query().SelectMany(x => x.Tags).ToList(); names - .Count().ShouldBe(9); + .Count.ShouldBe(9); } } @@ -249,7 +249,7 @@ public async Task select_many_against_integer_array() var names = query.Query().SelectMany(x => x.Tags).ToList(); names - .Count().ShouldBe(9); + .Count.ShouldBe(9); } } @@ -274,7 +274,7 @@ public async Task select_many_against_integer_array_async() var names = query.Query().SelectMany(x => x.Tags).ToList(); names - .Count().ShouldBe(9); + .Count.ShouldBe(9); } } diff --git a/src/LinqTests/Compiled/compiled_queries.cs b/src/LinqTests/Compiled/compiled_queries.cs index 7630d9dd27..1c9bbde11a 100644 --- a/src/LinqTests/Compiled/compiled_queries.cs +++ b/src/LinqTests/Compiled/compiled_queries.cs @@ -255,7 +255,7 @@ public async Task to_json_many() stream.Position = 0; var users = theStore.Options.Serializer().FromJson(stream); - users.Count().ShouldBe(2); + users.Length.ShouldBe(2); users.ElementAt(0).UserName.ShouldBe("jdm"); users.ElementAt(1).UserName.ShouldBe("shadetreedev"); } @@ -270,7 +270,7 @@ public async Task stream_json_many() stream.Position = 0; var users = theStore.Options.Serializer().FromJson(stream); - users.Count().ShouldBe(2); + users.Length.ShouldBe(2); users.ElementAt(0).UserName.ShouldBe("jdm"); users.ElementAt(1).UserName.ShouldBe("shadetreedev"); } diff --git a/src/LinqTests/Operators/is_subset_of_operator.cs b/src/LinqTests/Operators/is_subset_of_operator.cs index cedd58463a..94b5247e85 100644 --- a/src/LinqTests/Operators/is_subset_of_operator.cs +++ b/src/LinqTests/Operators/is_subset_of_operator.cs @@ -70,7 +70,7 @@ public void Can_query_by_array() .Select(x => x.Id); // than - found.Count().ShouldBe(2); + found.Length.ShouldBe(2); found.OrderBy(x => x.Id).Select(x => x.Id).ShouldHaveTheSameElementsAs(expected); } @@ -108,7 +108,7 @@ public void Can_query_by_hashset() .Select(x => x.Id); // than - found.Count().ShouldBe(2); + found.Length.ShouldBe(2); found.OrderBy(x => x.Id).Select(x => x.Id).ShouldHaveTheSameElementsAs(expected); } } diff --git a/src/LinqTests/Operators/is_super_set_of_operator.cs b/src/LinqTests/Operators/is_super_set_of_operator.cs index 08677222cb..1208621aa9 100644 --- a/src/LinqTests/Operators/is_super_set_of_operator.cs +++ b/src/LinqTests/Operators/is_super_set_of_operator.cs @@ -62,7 +62,7 @@ public void Can_query_by_array() .Select(x => x.Id); // than - found.Count().ShouldBe(3); + found.Length.ShouldBe(3); found.OrderBy(x => x.Id).Select(x => x.Id).ShouldHaveTheSameElementsAs(expected); } @@ -85,7 +85,7 @@ public void Can_query_by_hashset() .Select(x => x.Id); // than - found.Count().ShouldBe(3); + found.Length.ShouldBe(3); found.OrderBy(x => x.Id).Select(x => x.Id).ShouldHaveTheSameElementsAs(expected); } diff --git a/src/Marten/Events/TestSupport/ProjectionScenario.EventOperations.cs b/src/Marten/Events/TestSupport/ProjectionScenario.EventOperations.cs index dc24a8aab8..e5d5312ce9 100644 --- a/src/Marten/Events/TestSupport/ProjectionScenario.EventOperations.cs +++ b/src/Marten/Events/TestSupport/ProjectionScenario.EventOperations.cs @@ -29,7 +29,7 @@ public StreamAction Append(Guid stream, IEnumerable events) public StreamAction Append(Guid stream, params object[] events) { var step = action(e => e.Append(stream, events)); - if (events.Count() > 3) + if (events.Length > 3) { step.Description = $"Append({stream}, events)"; } @@ -74,7 +74,7 @@ public StreamAction Append(string stream, params object[] events) public StreamAction Append(Guid stream, long expectedVersion, params object[] events) { var step = action(e => e.Append(stream, expectedVersion, events)); - if (events.Count() > 3) + if (events.Length > 3) { step.Description = $"Append({stream}, {expectedVersion}, events)"; } @@ -106,7 +106,7 @@ public StreamAction Append(string stream, long expectedVersion, IEnumerable e.Append(stream, expectedVersion, events)); - if (events.Count() > 3) + if (events.Length > 3) { step.Description = $"Append(\"{stream}\", {expectedVersion}, events)"; } @@ -122,7 +122,7 @@ public StreamAction Append(string stream, long expectedVersion, params object[] public StreamAction StartStream(Guid id, params object[] events) where TAggregate : class { var step = action(e => e.StartStream(id, events)); - if (events.Count() > 3) + if (events.Length > 3) { step.Description = $"StartStream<{typeof(TAggregate).FullNameInCode()}>({id}, events)"; } @@ -154,7 +154,7 @@ public StreamAction StartStream(Type aggregateType, Guid id, IEnumerable public StreamAction StartStream(Type aggregateType, Guid id, params object[] events) { var step = action(e => e.StartStream(aggregateType, id, events)); - if (events.Count() > 3) + if (events.Length > 3) { step.Description = $"StartStream({aggregateType.FullNameInCode()}>({id}, events)"; } @@ -187,7 +187,7 @@ public StreamAction StartStream(string streamKey, IEnumerable(string streamKey, params object[] events) where TAggregate : class { var step = action(e => e.StartStream(streamKey, events)); - if (events.Count() > 3) + if (events.Length > 3) { step.Description = $"StartStream<{typeof(TAggregate).FullNameInCode()}>(\"{streamKey}\", events)"; } @@ -219,7 +219,7 @@ public StreamAction StartStream(Type aggregateType, string streamKey, IEnumerabl public StreamAction StartStream(Type aggregateType, string streamKey, params object[] events) { var step = action(e => e.StartStream(aggregateType, streamKey, events)); - if (events.Count() > 3) + if (events.Length > 3) { step.Description = $"StartStream({aggregateType.FullNameInCode()}>(\"{streamKey}\", events)"; } @@ -250,7 +250,7 @@ public StreamAction StartStream(Guid id, IEnumerable events) public StreamAction StartStream(Guid id, params object[] events) { var step = action(e => e.StartStream(id, events)); - if (events.Count() > 3) + if (events.Length > 3) { step.Description = $"StartStream({id}, events)"; } @@ -280,7 +280,7 @@ public StreamAction StartStream(string streamKey, IEnumerable events) public StreamAction StartStream(string streamKey, params object[] events) { var step = action(e => e.StartStream(streamKey, events)); - if (events.Count() > 3) + if (events.Length > 3) { step.Description = $"StartStream(\"{streamKey}\", events)"; } @@ -313,7 +313,7 @@ public StreamAction StartStream(params object[] events) where TAggre { var streamId = Guid.NewGuid(); var step = action(e => e.StartStream(streamId, events)); - if (events.Count() > 3) + if (events.Length > 3) { step.Description = $"StartStream<{typeof(TAggregate).FullNameInCode()}>(events)"; } @@ -347,7 +347,7 @@ public StreamAction StartStream(Type aggregateType, params object[] events) { var streamId = Guid.NewGuid(); var step = action(e => e.StartStream(aggregateType, streamId, events)); - if (events.Count() > 3) + if (events.Length > 3) { step.Description = $"StartStream({aggregateType.FullNameInCode()}>(events)"; } @@ -380,7 +380,7 @@ public StreamAction StartStream(params object[] events) { var streamId = Guid.NewGuid(); var step = action(e => e.StartStream(streamId, events)); - if (events.Count() > 3) + if (events.Length > 3) { step.Description = "StartStream(events)"; } diff --git a/src/Marten/Internal/CompiledQueries/CompiledQueryPlan.cs b/src/Marten/Internal/CompiledQueries/CompiledQueryPlan.cs index 0265dc123e..af41e6b521 100644 --- a/src/Marten/Internal/CompiledQueries/CompiledQueryPlan.cs +++ b/src/Marten/Internal/CompiledQueries/CompiledQueryPlan.cs @@ -298,7 +298,7 @@ public ICompiledQuery CreateQueryTemplate(ICompiledQuery public object TryCreateUniqueTemplate(Type type) { - var constructor = type.GetConstructors().MaxBy(x => x.GetParameters().Count()); + var constructor = type.GetConstructors().MaxBy(x => x.GetParameters().Length); if (constructor == null) diff --git a/src/Marten/Linq/Members/ChildCollectionMember.cs b/src/Marten/Linq/Members/ChildCollectionMember.cs index c2b86467d9..28327760b6 100644 --- a/src/Marten/Linq/Members/ChildCollectionMember.cs +++ b/src/Marten/Linq/Members/ChildCollectionMember.cs @@ -223,7 +223,7 @@ public void Register(ISqlFragment fragment) public void Compile(MethodCallExpression methodCallExpression) { - if (Wheres.Count() == 1) + if (Wheres.Count == 1) { switch (Wheres.Single()) { diff --git a/src/Marten/Pagination/PagedList.cs b/src/Marten/Pagination/PagedList.cs index 7785de9e09..780990854e 100644 --- a/src/Marten/Pagination/PagedList.cs +++ b/src/Marten/Pagination/PagedList.cs @@ -32,7 +32,7 @@ private PagedList() /// /// Return the number of records in the paged query result /// - public long Count => _items.Count(); + public long Count => _items.Count; /// /// Generic Enumerator