diff --git a/src/LinqTests/Acceptance/Support/LinqTestContext.cs b/src/LinqTests/Acceptance/Support/LinqTestContext.cs index d11c956503..7246dfeadf 100644 --- a/src/LinqTests/Acceptance/Support/LinqTestContext.cs +++ b/src/LinqTests/Acceptance/Support/LinqTestContext.cs @@ -65,7 +65,7 @@ protected static void selectInOrder(Func, IQueryable> s testCases.Add(comparison); } - private static readonly string[] _methodNames = new string[] { "@where", nameof(ordered), nameof(unordered), nameof(selectInOrder), "select" }; + private static readonly string[] _methodNames = ["@where", nameof(ordered), nameof(unordered), nameof(selectInOrder), "select"]; private static readonly string[] _descriptions; protected static string[] readDescriptions() diff --git a/src/LinqTests/Acceptance/child_collection_queries.cs b/src/LinqTests/Acceptance/child_collection_queries.cs index 530189dbe9..92bfcb513a 100644 --- a/src/LinqTests/Acceptance/child_collection_queries.cs +++ b/src/LinqTests/Acceptance/child_collection_queries.cs @@ -114,7 +114,7 @@ protected async Task withData() EmptyNumberArray.NumberArray = Array.Empty(); HasNumberArray = targets[1]; - HasNumberArray.NumberArray = new[] { 1, 2, 3 }; + HasNumberArray.NumberArray = [1, 2, 3]; NullNumberArray = targets[2]; NullNumberArray.NumberArray = null; diff --git a/src/LinqTests/Acceptance/custom_identity_members.cs b/src/LinqTests/Acceptance/custom_identity_members.cs index 60654d3812..07ae4fd254 100644 --- a/src/LinqTests/Acceptance/custom_identity_members.cs +++ b/src/LinqTests/Acceptance/custom_identity_members.cs @@ -1,4 +1,4 @@ -using System.Linq; +using System.Linq; using System.Threading.Tasks; using Marten; using Marten.Testing.Harness; @@ -8,8 +8,8 @@ namespace LinqTests.Acceptance; public class custom_identity_members : OneOffConfigurationsContext { - private static readonly string[] listIds = {"qwe", "zxc"}; - private static readonly string[] listSystemIds = {"123", "456"}; + private static readonly string[] listIds = ["qwe", "zxc"]; + private static readonly string[] listSystemIds = ["123", "456"]; [Fact] public async Task get_by_id_member_property() diff --git a/src/LinqTests/Acceptance/select_clause_usage.cs b/src/LinqTests/Acceptance/select_clause_usage.cs index 061c1784ba..6a26113109 100644 --- a/src/LinqTests/Acceptance/select_clause_usage.cs +++ b/src/LinqTests/Acceptance/select_clause_usage.cs @@ -47,10 +47,10 @@ public async Task use_select_in_query_for_one_field_and_first() [Fact] public async Task use_select_in_query_for_first_in_collection() { - theSession.Store(new User { FirstName = "Hank", Roles = new []{"a", "b", "c"}}); - theSession.Store(new User { FirstName = "Bill", Roles = new []{"d", "b", "c"} }); - theSession.Store(new User { FirstName = "Sam", Roles = new []{"e", "b", "c"} }); - theSession.Store(new User { FirstName = "Tom", Roles = new []{"f", "b", "c"} }); + theSession.Store(new User { FirstName = "Hank", Roles = ["a", "b", "c"]}); + theSession.Store(new User { FirstName = "Bill", Roles = ["d", "b", "c"] }); + theSession.Store(new User { FirstName = "Sam", Roles = ["e", "b", "c"] }); + theSession.Store(new User { FirstName = "Tom", Roles = ["f", "b", "c"] }); await theSession.SaveChangesAsync(); diff --git a/src/LinqTests/Acceptance/select_many.cs b/src/LinqTests/Acceptance/select_many.cs index 0cfe51befa..812e56c557 100644 --- a/src/LinqTests/Acceptance/select_many.cs +++ b/src/LinqTests/Acceptance/select_many.cs @@ -21,9 +21,9 @@ public class select_many : IntegrationContext [Fact] public async Task can_do_simple_select_many_against_simple_array() { - var product1 = new Product {Tags = new[] {"a", "b", "c"}}; - var product2 = new Product {Tags = new[] {"b", "c", "d"}}; - var product3 = new Product {Tags = new[] {"d", "e", "f"}}; + var product1 = new Product {Tags = ["a", "b", "c"]}; + var product2 = new Product {Tags = ["b", "c", "d"]}; + var product3 = new Product {Tags = ["d", "e", "f"]}; using (var session = theStore.LightweightSession()) { @@ -124,9 +124,9 @@ public async Task can_do_simple_select_many_against_generic_list() [Fact] public async Task select_many_against_complex_type_with_count() { - var product1 = new Product {Tags = new[] {"a", "b", "c"}}; - var product2 = new Product {Tags = new[] {"b", "c", "d"}}; - var product3 = new Product {Tags = new[] {"d", "e", "f"}}; + var product1 = new Product {Tags = ["a", "b", "c"]}; + var product2 = new Product {Tags = ["b", "c", "d"]}; + var product3 = new Product {Tags = ["d", "e", "f"]}; using (var session = theStore.LightweightSession()) { @@ -144,9 +144,9 @@ public async Task select_many_against_complex_type_with_count() [Fact] public async Task select_many_with_count_when_none_match_does_not_throw() { - var product1 = new Product { Tags = new[] { "a", "b", "c" } }; - var product2 = new Product { Tags = new[] { "b", "c", "d" } }; - var product3 = new Product { Tags = new[] { "d", "e", "f" } }; + var product1 = new Product { Tags = ["a", "b", "c"] }; + var product2 = new Product { Tags = ["b", "c", "d"] }; + var product3 = new Product { Tags = ["d", "e", "f"] }; using (var session = theStore.LightweightSession()) { @@ -167,9 +167,9 @@ public async Task select_many_with_count_when_none_match_does_not_throw() [Fact] public async Task select_many_against_complex_type_with_count_async() { - var product1 = new Product {Tags = new[] {"a", "b", "c"}}; - var product2 = new Product {Tags = new[] {"b", "c", "d"}}; - var product3 = new Product {Tags = new[] {"d", "e", "f"}}; + var product1 = new Product {Tags = ["a", "b", "c"]}; + var product2 = new Product {Tags = ["b", "c", "d"]}; + var product3 = new Product {Tags = ["d", "e", "f"]}; await using (var session = theStore.LightweightSession()) { @@ -187,9 +187,9 @@ public async Task select_many_against_complex_type_with_count_async() [Fact] public async Task select_many_with_count_when_none_match_does_not_throw_async() { - var product1 = new Product { Tags = new[] { "a", "b", "c" } }; - var product2 = new Product { Tags = new[] { "b", "c", "d" } }; - var product3 = new Product { Tags = new[] { "d", "e", "f" } }; + var product1 = new Product { Tags = ["a", "b", "c"] }; + var product2 = new Product { Tags = ["b", "c", "d"] }; + var product3 = new Product { Tags = ["d", "e", "f"] }; await using (var session = theStore.LightweightSession()) { @@ -231,9 +231,9 @@ public async Task select_many_against_complex_type_without_transformation() [Fact] public async Task select_many_against_integer_array() { - var product1 = new ProductWithNumbers {Tags = new[] {1, 2, 3}}; - var product2 = new ProductWithNumbers {Tags = new[] {2, 3, 4}}; - var product3 = new ProductWithNumbers {Tags = new[] {3, 4, 5}}; + var product1 = new ProductWithNumbers {Tags = [1, 2, 3]}; + var product2 = new ProductWithNumbers {Tags = [2, 3, 4]}; + var product3 = new ProductWithNumbers {Tags = [3, 4, 5]}; using (var session = theStore.LightweightSession()) { @@ -256,9 +256,9 @@ public async Task select_many_against_integer_array() [Fact] public async Task select_many_against_integer_array_async() { - var product1 = new ProductWithNumbers {Tags = new[] {1, 2, 3}}; - var product2 = new ProductWithNumbers {Tags = new[] {2, 3, 4}}; - var product3 = new ProductWithNumbers {Tags = new[] {3, 4, 5}}; + var product1 = new ProductWithNumbers {Tags = [1, 2, 3]}; + var product2 = new ProductWithNumbers {Tags = [2, 3, 4]}; + var product3 = new ProductWithNumbers {Tags = [3, 4, 5]}; await using (var session = theStore.LightweightSession()) { @@ -281,9 +281,9 @@ public async Task select_many_against_integer_array_async() [Fact] public async Task select_many_with_any() { - var product1 = new Product {Tags = new[] {"a", "b", "c"}}; - var product2 = new Product {Tags = new[] {"b", "c", "d"}}; - var product3 = new Product {Tags = new[] {"d", "e", "f"}}; + var product1 = new Product {Tags = ["a", "b", "c"]}; + var product2 = new Product {Tags = ["b", "c", "d"]}; + var product3 = new Product {Tags = ["d", "e", "f"]}; using (var session = theStore.LightweightSession()) { @@ -312,9 +312,9 @@ public async Task select_many_with_any_async() { await theStore.Advanced.Clean.DeleteDocumentsByTypeAsync(typeof(Target)); - var product1 = new Product {Tags = new[] {"a", "b", "c"}}; - var product2 = new Product {Tags = new[] {"b", "c", "d"}}; - var product3 = new Product {Tags = new[] {"d", "e", "f"}}; + var product1 = new Product {Tags = ["a", "b", "c"]}; + var product2 = new Product {Tags = ["b", "c", "d"]}; + var product3 = new Product {Tags = ["d", "e", "f"]}; await using (var session = theStore.LightweightSession()) { diff --git a/src/LinqTests/Bugs/Bug_1875_duplicated_array_field_test.cs b/src/LinqTests/Bugs/Bug_1875_duplicated_array_field_test.cs index 8c35022006..870f8ca747 100644 --- a/src/LinqTests/Bugs/Bug_1875_duplicated_array_field_test.cs +++ b/src/LinqTests/Bugs/Bug_1875_duplicated_array_field_test.cs @@ -21,7 +21,7 @@ public async Task query_on_duplicated_number_array_field_test() { session.Store(new Target { - NumberArray = new []{ 1, 2 } + NumberArray = [1, 2] }); await session.SaveChangesAsync(); @@ -42,7 +42,7 @@ public async Task query_on_duplicated_guid_array_field_test() _.Schema.For().Duplicate(t => t.GuidArray, "uuid[]"); }); - var target = new Target {GuidArray = new Guid[] {Guid.NewGuid(), Guid.NewGuid()}}; + var target = new Target {GuidArray = [Guid.NewGuid(), Guid.NewGuid()]}; using (var session = theStore.LightweightSession()) { diff --git a/src/LinqTests/Bugs/Bug_1884_multi_tenancy_and_Any_query.cs b/src/LinqTests/Bugs/Bug_1884_multi_tenancy_and_Any_query.cs index 24e9f40242..876d9474bb 100644 --- a/src/LinqTests/Bugs/Bug_1884_multi_tenancy_and_Any_query.cs +++ b/src/LinqTests/Bugs/Bug_1884_multi_tenancy_and_Any_query.cs @@ -32,7 +32,7 @@ public async Task any_filter_honors_tenancy() // Write some User documents to tenant "tenant1" await using (var session = store.LightweightSession("tenant1")) { - session.Store(new User { Id = "u1", UserName = "Bill", Roles = new[] { "admin" } }); + session.Store(new User { Id = "u1", UserName = "Bill", Roles = ["admin"] }); session.Store(new User { Id = "u2", UserName = "Lindsey", Roles = [] }); await session.SaveChangesAsync(); } @@ -41,7 +41,7 @@ public async Task any_filter_honors_tenancy() await using (var session = store.LightweightSession("tenant2")) { session.Store(new User { Id = "u1", UserName = "Frank", Roles = [] }); - session.Store(new User { Id = "u2", UserName = "Jill", Roles = new[] { "admin", "user" } }); + session.Store(new User { Id = "u2", UserName = "Jill", Roles = ["admin", "user"] }); await session.SaveChangesAsync(); } @@ -67,7 +67,7 @@ public async Task will_isolate_tenants_when_using_any_and_tenants_use_unique_ids // Write some User documents to tenant "tenant1" using (var session = theStore.LightweightSession("tenant1")) { - session.Store(new User { Id = "u1", UserName = "Bill", Roles = new[] { "admin" } }); + session.Store(new User { Id = "u1", UserName = "Bill", Roles = ["admin"] }); session.Store(new User { Id = "u2", UserName = "Lindsey", Roles = [] }); await session.SaveChangesAsync(); } @@ -78,7 +78,7 @@ public async Task will_isolate_tenants_when_using_any_and_tenants_use_unique_ids using (var session = theStore.LightweightSession("tenant2")) { session.Store(new User { Id = "u3", UserName = "Frank", Roles = [] }); - session.Store(new User { Id = "u4", UserName = "Jill", Roles = new[] { "admin", "user" } }); + session.Store(new User { Id = "u4", UserName = "Jill", Roles = ["admin", "user"] }); await session.SaveChangesAsync(); } @@ -114,7 +114,7 @@ public async Task can_query_with_AnyTenant() // Write some User documents to tenant "tenant1" using (var session = theStore.LightweightSession("tenant1")) { - session.Store(new User { Id = "u1", UserName = "Bill", Roles = new[] { "admin" } }); + session.Store(new User { Id = "u1", UserName = "Bill", Roles = ["admin"] }); session.Store(new User { Id = "u2", UserName = "Lindsey", Roles = [] }); await session.SaveChangesAsync(); } @@ -125,7 +125,7 @@ public async Task can_query_with_AnyTenant() using (var session = theStore.LightweightSession("tenant2")) { session.Store(new User { Id = "u3", UserName = "Frank", Roles = [] }); - session.Store(new User { Id = "u4", UserName = "Jill", Roles = new[] { "admin", "user" } }); + session.Store(new User { Id = "u4", UserName = "Jill", Roles = ["admin", "user"] }); await session.SaveChangesAsync(); } diff --git a/src/LinqTests/Bugs/Bug_2563_sub_collection_queries_and_OR.cs b/src/LinqTests/Bugs/Bug_2563_sub_collection_queries_and_OR.cs index 2b4a8aa183..94beab79f8 100644 --- a/src/LinqTests/Bugs/Bug_2563_sub_collection_queries_and_OR.cs +++ b/src/LinqTests/Bugs/Bug_2563_sub_collection_queries_and_OR.cs @@ -22,12 +22,12 @@ public async Task get_distinct_number() theStore.Options.Schema.For() .Duplicate(x => x.UserIds); - theSession.Store(new Bug2563Target {Id = 1, IsPublic = false, UserIds = new [] { 1, 2, 3, 4, 5, 6 }}); + theSession.Store(new Bug2563Target {Id = 1, IsPublic = false, UserIds = [1, 2, 3, 4, 5, 6]}); theSession.Store(new Bug2563Target {Id = 2, IsPublic = false, UserIds = [] }); - theSession.Store(new Bug2563Target {Id = 3, IsPublic = true, UserIds = new [] { 1, 2, 3 }}); - theSession.Store(new Bug2563Target {Id = 4, IsPublic = true, UserIds = new [] { 1, 2, 6 }}); - theSession.Store(new Bug2563Target {Id = 5, IsPublic = false, UserIds = new [] { 4, 5, 6 }}); - theSession.Store(new Bug2563Target {Id = 6, IsPublic = true, UserIds = new [] { 10 }}); + theSession.Store(new Bug2563Target {Id = 3, IsPublic = true, UserIds = [1, 2, 3]}); + theSession.Store(new Bug2563Target {Id = 4, IsPublic = true, UserIds = [1, 2, 6]}); + theSession.Store(new Bug2563Target {Id = 5, IsPublic = false, UserIds = [4, 5, 6]}); + theSession.Store(new Bug2563Target {Id = 6, IsPublic = true, UserIds = [10]}); await theSession.SaveChangesAsync(); theSession.Logger = new TestOutputMartenLogger(_output); diff --git a/src/LinqTests/Bugs/Bug_2618_Include_with_AnyTenant.cs b/src/LinqTests/Bugs/Bug_2618_Include_with_AnyTenant.cs index a8c216bd05..da941b8c91 100644 --- a/src/LinqTests/Bugs/Bug_2618_Include_with_AnyTenant.cs +++ b/src/LinqTests/Bugs/Bug_2618_Include_with_AnyTenant.cs @@ -28,7 +28,7 @@ public async Task tenant_filter_should_apply_to_both_parent_and_child_documents( }); var user1a = new User(); - var issue1a = new Issue { AssigneeId = user1a.Id, Tags = new[] { "DIY" }, Title = "Garage Door is busted" }; + var issue1a = new Issue { AssigneeId = user1a.Id, Tags = ["DIY"], Title = "Garage Door is busted" }; await using (var session = theStore.LightweightSession("one")) { @@ -38,7 +38,7 @@ public async Task tenant_filter_should_apply_to_both_parent_and_child_documents( } var user2a = new User(); - var issue2a = new Issue { AssigneeId = user2a.Id, Tags = new[] { "DIY" }, Title = "Garage Door is busted" }; + var issue2a = new Issue { AssigneeId = user2a.Id, Tags = ["DIY"], Title = "Garage Door is busted" }; await using (var session = theStore.LightweightSession("two")) diff --git a/src/LinqTests/Bugs/Bug_2946_querying_on_value_collection_of_enums_serialized_as_string.cs b/src/LinqTests/Bugs/Bug_2946_querying_on_value_collection_of_enums_serialized_as_string.cs index 84c6e09245..aac81d8037 100644 --- a/src/LinqTests/Bugs/Bug_2946_querying_on_value_collection_of_enums_serialized_as_string.cs +++ b/src/LinqTests/Bugs/Bug_2946_querying_on_value_collection_of_enums_serialized_as_string.cs @@ -17,9 +17,9 @@ public async Task try_to_query_on_contains_as_string() { StoreOptions(opts => opts.UseSystemTextJsonForSerialization(EnumStorage.AsString)); - var doc1 = new MyDoc("one", new Colors[] { Colors.Blue, Colors.Green }); - var doc2 = new MyDoc("two", new Colors[] { Colors.Blue, Colors.Red }); - var doc3 = new MyDoc("three", new Colors[] { Colors.Orange, Colors.Yellow }); + var doc1 = new MyDoc("one", [Colors.Blue, Colors.Green]); + var doc2 = new MyDoc("two", [Colors.Blue, Colors.Red]); + var doc3 = new MyDoc("three", [Colors.Orange, Colors.Yellow]); theSession.Store(doc1, doc2, doc3); await theSession.SaveChangesAsync(); @@ -38,9 +38,9 @@ public async Task try_to_query_on_contains_as_int() { StoreOptions(opts => opts.UseSystemTextJsonForSerialization(EnumStorage.AsInteger)); - var doc1 = new MyDoc("one", new Colors[] { Colors.Blue, Colors.Green }); - var doc2 = new MyDoc("two", new Colors[] { Colors.Blue, Colors.Red }); - var doc3 = new MyDoc("three", new Colors[] { Colors.Orange, Colors.Yellow }); + var doc1 = new MyDoc("one", [Colors.Blue, Colors.Green]); + var doc2 = new MyDoc("two", [Colors.Blue, Colors.Red]); + var doc3 = new MyDoc("three", [Colors.Orange, Colors.Yellow]); theSession.Store(doc1, doc2, doc3); await theSession.SaveChangesAsync(); diff --git a/src/LinqTests/Bugs/Bug_3065_include_query_with_conjoined_tenancy.cs b/src/LinqTests/Bugs/Bug_3065_include_query_with_conjoined_tenancy.cs index ef0705cf6d..4da0ee8364 100644 --- a/src/LinqTests/Bugs/Bug_3065_include_query_with_conjoined_tenancy.cs +++ b/src/LinqTests/Bugs/Bug_3065_include_query_with_conjoined_tenancy.cs @@ -23,7 +23,7 @@ public async Task include_with_SingleOrDefault_where_for_a_single_document() StoreOptions(opts => opts.Policies.AllDocumentsAreMultiTenanted()); var user = new User{Id = Guid.NewGuid()}; - var issue = new Issue { AssigneeId = user.Id, Tags = new[] { "DIY" }, Title = "Garage Door is busted" }; + var issue = new Issue { AssigneeId = user.Id, Tags = ["DIY"], Title = "Garage Door is busted" }; using (var session = theStore.LightweightSession("a")) { @@ -34,7 +34,7 @@ public async Task include_with_SingleOrDefault_where_for_a_single_document() using (var session2 = theStore.LightweightSession("b")) { var user2 = new User{Id = user.Id}; - var issue2 = new Issue { AssigneeId = user.Id, Tags = new[] { "DIY" }, Title = "Garage Door is busted" }; + var issue2 = new Issue { AssigneeId = user.Id, Tags = ["DIY"], Title = "Garage Door is busted" }; session2.Store(user2, issue2); await session2.SaveChangesAsync(); diff --git a/src/LinqTests/Bugs/Bug_561_negation_of_query_on_contains.cs b/src/LinqTests/Bugs/Bug_561_negation_of_query_on_contains.cs index 2585dfb6c6..b20384b130 100644 --- a/src/LinqTests/Bugs/Bug_561_negation_of_query_on_contains.cs +++ b/src/LinqTests/Bugs/Bug_561_negation_of_query_on_contains.cs @@ -16,10 +16,10 @@ public Bug_561_negation_of_query_on_contains(DefaultStoreFixture fixture) : base protected override Task fixtureSetup() { - var doc1 = new DocWithArrays { Strings = new string[] { "a", "b", "c" } }; - var doc2 = new DocWithArrays { Strings = new string[] { "c", "d", "e" } }; - var doc3 = new DocWithArrays { Strings = new string[] { "d", "e", "f" } }; - var doc4 = new DocWithArrays { Strings = new string[] { "g", "h", "i" } }; + var doc1 = new DocWithArrays { Strings = ["a", "b", "c"] }; + var doc2 = new DocWithArrays { Strings = ["c", "d", "e"] }; + var doc3 = new DocWithArrays { Strings = ["d", "e", "f"] }; + var doc4 = new DocWithArrays { Strings = ["g", "h", "i"] }; theSession.Store(doc1, doc2, doc3, doc4); @@ -59,10 +59,10 @@ public Bug_561_negation_of_query_on_contains_with_camel_casing() public async Task InitializeAsync() { - var doc1 = new DocWithArrays { Strings = new string[] { "a", "b", "c" } }; - var doc2 = new DocWithArrays { Strings = new string[] { "c", "d", "e" } }; - var doc3 = new DocWithArrays { Strings = new string[] { "d", "e", "f" } }; - var doc4 = new DocWithArrays { Strings = new string[] { "g", "h", "i" } }; + var doc1 = new DocWithArrays { Strings = ["a", "b", "c"] }; + var doc2 = new DocWithArrays { Strings = ["c", "d", "e"] }; + var doc3 = new DocWithArrays { Strings = ["d", "e", "f"] }; + var doc4 = new DocWithArrays { Strings = ["g", "h", "i"] }; theSession.Store(doc1, doc2, doc3, doc4); diff --git a/src/LinqTests/Bugs/Bug_784_Collection_Contains_within_compiled_query.cs b/src/LinqTests/Bugs/Bug_784_Collection_Contains_within_compiled_query.cs index e39d45f84d..b78ec56533 100644 --- a/src/LinqTests/Bugs/Bug_784_Collection_Contains_within_compiled_query.cs +++ b/src/LinqTests/Bugs/Bug_784_Collection_Contains_within_compiled_query.cs @@ -22,12 +22,12 @@ public async Task do_not_blow_up_with_exceptions() if (DateTime.Today < new DateTime(2023, 9, 12)) return; var targets = Target.GenerateRandomData(100).ToArray(); - targets[1].NumberArray = new[] {3, 4, 5}; + targets[1].NumberArray = [3, 4, 5]; targets[1].Flag = true; - targets[5].NumberArray = new[] {3, 4, 5}; + targets[5].NumberArray = [3, 4, 5]; targets[5].Flag = true; - targets[20].NumberArray = new[] {5, 6, 7}; + targets[20].NumberArray = [5, 6, 7]; targets[20].Flag = true; diff --git a/src/LinqTests/ChildCollections/query_against_child_collections.cs b/src/LinqTests/ChildCollections/query_against_child_collections.cs index c31c988c0b..2b886eed08 100644 --- a/src/LinqTests/ChildCollections/query_against_child_collections.cs +++ b/src/LinqTests/ChildCollections/query_against_child_collections.cs @@ -323,7 +323,7 @@ public class Source public string Case { get; set; } } - private readonly Guid[] favAuthors = new Guid[] { Guid.NewGuid(), Guid.NewGuid() }; + private readonly Guid[] favAuthors = [Guid.NewGuid(), Guid.NewGuid()]; private async Task buildAuthorData() { @@ -331,7 +331,7 @@ private async Task buildAuthorData() theSession.Store(new Article { Long = 1, - CategoryArray = new[] { "sports", "finance", "health" }, + CategoryArray = ["sports", "finance", "health"], CategoryList = new List { "sports", "finance", "health" }, AuthorArray = favAuthors, Published = true, @@ -339,13 +339,13 @@ private async Task buildAuthorData() theSession.Store(new Article { - Long = 2, CategoryArray = new[] { "sports", "astrology" }, AuthorArray = favAuthors.Take(1).ToArray(), + Long = 2, CategoryArray = ["sports", "astrology"], AuthorArray = favAuthors.Take(1).ToArray(), }); theSession.Store(new Article { Long = 3, - CategoryArray = new[] { "health", "finance" }, + CategoryArray = ["health", "finance"], CategoryList = new List { "sports", "health" }, AuthorArray = favAuthors.Skip(1).ToArray(), }); @@ -353,7 +353,7 @@ private async Task buildAuthorData() theSession.Store(new Article { Long = 4, - CategoryArray = new[] { "health", "astrology" }, + CategoryArray = ["health", "astrology"], AuthorList = new List { Guid.NewGuid() }, Published = true, }); @@ -361,15 +361,15 @@ private async Task buildAuthorData() theSession.Store(new Article { Long = 5, - CategoryArray = new[] { "sports", "nested" }, + CategoryArray = ["sports", "nested"], AuthorList = new List { Guid.NewGuid(), favAuthors[1] }, }); theSession.Store(new Article { Long = 6, - AuthorArray = new Guid[] { favAuthors[0], Guid.NewGuid() }, - ReferencedArticle = new Article { CategoryArray = new[] { "nested" }, } + AuthorArray = [favAuthors[0], Guid.NewGuid()], + ReferencedArticle = new Article { CategoryArray = ["nested"], } }); await theSession.SaveChangesAsync(); } @@ -488,9 +488,9 @@ public async Task query_guid_list_intersects_array() [Fact] public async Task query_against_number_array() { - var doc1 = new DocWithArrays { Numbers = new[] { 1, 2, 3 } }; - var doc2 = new DocWithArrays { Numbers = new[] { 3, 4, 5 } }; - var doc3 = new DocWithArrays { Numbers = new[] { 5, 6, 7 } }; + var doc1 = new DocWithArrays { Numbers = [1, 2, 3] }; + var doc2 = new DocWithArrays { Numbers = [3, 4, 5] }; + var doc3 = new DocWithArrays { Numbers = [5, 6, 7] }; theSession.Store(doc1, doc2, doc3); @@ -503,9 +503,9 @@ public async Task query_against_number_array() [Fact] public async Task query_against_number_array_count() { - var doc1 = new DocWithArrays { Numbers = new[] { 1, 2, 3 } }; - var doc2 = new DocWithArrays { Numbers = new[] { 3, 4, 5 } }; - var doc3 = new DocWithArrays { Numbers = new[] { 5, 6, 7, 8 } }; + var doc1 = new DocWithArrays { Numbers = [1, 2, 3] }; + var doc2 = new DocWithArrays { Numbers = [3, 4, 5] }; + var doc3 = new DocWithArrays { Numbers = [5, 6, 7, 8] }; theSession.Store(doc1, doc2, doc3); @@ -521,9 +521,9 @@ public async Task query_against_number_array_count() public async Task query_against_string_array() { - var doc1 = new DocWithArrays { Strings = new[] { "a", "b", "c" } }; - var doc2 = new DocWithArrays { Strings = new[] { "c", "d", "e" } }; - var doc3 = new DocWithArrays { Strings = new[] { "d", "e", "f" } }; + var doc1 = new DocWithArrays { Strings = ["a", "b", "c"] }; + var doc2 = new DocWithArrays { Strings = ["c", "d", "e"] }; + var doc3 = new DocWithArrays { Strings = ["d", "e", "f"] }; theSession.Store(doc1); theSession.Store(doc2); @@ -540,9 +540,9 @@ public async Task query_against_string_array() [Fact] public async Task query_against_string_array_with_Any() { - var doc1 = new DocWithArrays { Strings = new[] { "a", "b", "c" } }; - var doc2 = new DocWithArrays { Strings = new[] { "c", "d", "e" } }; - var doc3 = new DocWithArrays { Strings = new[] { "d", "e", "f" } }; + var doc1 = new DocWithArrays { Strings = ["a", "b", "c"] }; + var doc2 = new DocWithArrays { Strings = ["c", "d", "e"] }; + var doc3 = new DocWithArrays { Strings = ["d", "e", "f"] }; theSession.Store(doc1); theSession.Store(doc2); @@ -557,9 +557,9 @@ public async Task query_against_string_array_with_Any() [Fact] public async Task query_against_string_array_with_Length() { - var doc1 = new DocWithArrays { Strings = new[] { "a", "b", "c" } }; - var doc2 = new DocWithArrays { Strings = new[] { "c", "d", "e" } }; - var doc3 = new DocWithArrays { Strings = new[] { "d", "e", "f", "g" } }; + var doc1 = new DocWithArrays { Strings = ["a", "b", "c"] }; + var doc2 = new DocWithArrays { Strings = ["c", "d", "e"] }; + var doc3 = new DocWithArrays { Strings = ["d", "e", "f", "g"] }; theSession.Store(doc1); theSession.Store(doc2); @@ -576,9 +576,9 @@ public async Task query_against_string_array_with_Length() [Fact] public async Task query_against_string_array_with_Count_method() { - var doc1 = new DocWithArrays { Strings = new[] { "a", "b", "c" } }; - var doc2 = new DocWithArrays { Strings = new[] { "c", "d", "e" } }; - var doc3 = new DocWithArrays { Strings = new[] { "d", "e", "f", "g" } }; + var doc1 = new DocWithArrays { Strings = ["a", "b", "c"] }; + var doc2 = new DocWithArrays { Strings = ["c", "d", "e"] }; + var doc3 = new DocWithArrays { Strings = ["d", "e", "f", "g"] }; theSession.Store(doc1); theSession.Store(doc2); @@ -595,15 +595,15 @@ public async Task query_against_date_array() { var doc1 = new DocWithArrays { - Dates = new[] { DateTime.Today, DateTime.Today.AddDays(1), DateTime.Today.AddDays(2) } + Dates = [DateTime.Today, DateTime.Today.AddDays(1), DateTime.Today.AddDays(2)] }; var doc2 = new DocWithArrays { - Dates = new[] { DateTime.Today.AddDays(2), DateTime.Today.AddDays(3), DateTime.Today.AddDays(4) } + Dates = [DateTime.Today.AddDays(2), DateTime.Today.AddDays(3), DateTime.Today.AddDays(4)] }; var doc3 = new DocWithArrays { - Dates = new[] { DateTime.Today.AddDays(4), DateTime.Today.AddDays(5), DateTime.Today.AddDays(6) } + Dates = [DateTime.Today.AddDays(4), DateTime.Today.AddDays(5), DateTime.Today.AddDays(6)] }; theSession.Store(doc1); @@ -754,7 +754,7 @@ public async Task query_against_number_IEnumerable() public async Task naked_any_hit_without_predicate() { var targetithchildren = new Target { Number = 1 }; - targetithchildren.Children = new[] { new Target(), }; + targetithchildren.Children = [new Target(),]; var nochildrennullarray = new Target { Number = 2 }; var nochildrenemptyarray = new Target { Number = 3 }; nochildrenemptyarray.Children = []; diff --git a/src/LinqTests/ChildCollections/query_with_inner_query_with_CollectionToArrayJsonConverter_onProperty.cs b/src/LinqTests/ChildCollections/query_with_inner_query_with_CollectionToArrayJsonConverter_onProperty.cs index 562f6c0e0c..e0e31515ac 100644 --- a/src/LinqTests/ChildCollections/query_with_inner_query_with_CollectionToArrayJsonConverter_onProperty.cs +++ b/src/LinqTests/ChildCollections/query_with_inner_query_with_CollectionToArrayJsonConverter_onProperty.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; @@ -77,12 +77,12 @@ public class query_with_inner_query_with_CollectionToArrayJsonConverter_onProper { private readonly ITestOutputHelper _output; - private static readonly TypeWithInnerCollectionsWithJsonConverterAttribute[] TestData = new TypeWithInnerCollectionsWithJsonConverterAttribute[] - { + private static readonly TypeWithInnerCollectionsWithJsonConverterAttribute[] TestData = + [ TypeWithInnerCollectionsWithJsonConverterAttribute.Create("one", "two"), TypeWithInnerCollectionsWithJsonConverterAttribute.Create("two", "three"), TypeWithInnerCollectionsWithJsonConverterAttribute.Create("four", "five"), - }; + ]; private const string SearchPhrase = "two"; diff --git a/src/LinqTests/ChildCollections/query_with_inner_query_with_global_CollectionStorage_WithArray.cs b/src/LinqTests/ChildCollections/query_with_inner_query_with_global_CollectionStorage_WithArray.cs index 7d0ae7f484..490bc0c582 100644 --- a/src/LinqTests/ChildCollections/query_with_inner_query_with_global_CollectionStorage_WithArray.cs +++ b/src/LinqTests/ChildCollections/query_with_inner_query_with_global_CollectionStorage_WithArray.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; @@ -97,12 +97,12 @@ public static TypeWithInnerCollections Create(params int[] array) public class query_with_inner_query_with_global_CollectionStorage_WithArray: OneOffConfigurationsContext { - private static readonly TypeWithInnerCollections[] TestData = new TypeWithInnerCollections[] - { + private static readonly TypeWithInnerCollections[] TestData = + [ TypeWithInnerCollections.Create(1, 2), TypeWithInnerCollections.Create(2, 3), TypeWithInnerCollections.Create(4, 5), - }; + ]; private const string SearchPhrase = "2"; private const int IntSearchPhrase = 2; diff --git a/src/LinqTests/Includes/end_to_end_query_with_include.cs b/src/LinqTests/Includes/end_to_end_query_with_include.cs index c9d335c552..ffb0e6f339 100644 --- a/src/LinqTests/Includes/end_to_end_query_with_include.cs +++ b/src/LinqTests/Includes/end_to_end_query_with_include.cs @@ -115,7 +115,7 @@ public async Task simple_include_for_a_single_document() public async Task include_with_containment_where_for_a_single_document() { var user = new User(); - var issue = new Issue { AssigneeId = user.Id, Tags = new[] { "DIY" }, Title = "Garage Door is busted" }; + var issue = new Issue { AssigneeId = user.Id, Tags = ["DIY"], Title = "Garage Door is busted" }; using var session = theStore.IdentitySession(); session.Store(user, issue); @@ -142,7 +142,7 @@ public async Task include_with_containment_where_for_a_single_document_with_came await theStore.Advanced.Clean.DeleteAllDocumentsAsync(); var user = new User(); - var issue = new Issue { AssigneeId = user.Id, Tags = new[] { "DIY" }, Title = "Garage Door is busted" }; + var issue = new Issue { AssigneeId = user.Id, Tags = ["DIY"], Title = "Garage Door is busted" }; using var session = theStore.IdentitySession(); session.Store(user, issue); @@ -165,7 +165,7 @@ public async Task include_with_containment_where_for_a_single_document_with_came public async Task include_with_any_containment_where_for_a_single_document() { var user = new User(); - var issue = new Issue { AssigneeId = user.Id, Tags = new[] { "DIY" }, Title = "Garage Door is busted" }; + var issue = new Issue { AssigneeId = user.Id, Tags = ["DIY"], Title = "Garage Door is busted" }; using var session = theStore.IdentitySession(); session.Store(user, issue); @@ -191,7 +191,7 @@ public async Task include_with_any_containment_where_for_a_single_document_with_ await theStore.Advanced.Clean.DeleteAllDocumentsAsync(); var user = new User(); - var issue = new Issue { AssigneeId = user.Id, Tags = new[] { "DIY" }, Title = "Garage Door is busted" }; + var issue = new Issue { AssigneeId = user.Id, Tags = ["DIY"], Title = "Garage Door is busted" }; using var session = theStore.IdentitySession(); session.Store(user, issue); @@ -217,7 +217,7 @@ public async Task include_with_any_containment_where_for_a_single_document_with_ await theStore.Advanced.Clean.DeleteAllDocumentsAsync(); var user = new User(); - var issue = new Issue { AssigneeId = user.Id, Tags = new[] { "DIY" }, Title = "Garage Door is busted" }; + var issue = new Issue { AssigneeId = user.Id, Tags = ["DIY"], Title = "Garage Door is busted" }; using var session = theStore.IdentitySession(); session.Store(user, issue); @@ -243,7 +243,7 @@ public async Task include_with_any_containment_where_for_a_single_document_with_ await theStore.Advanced.Clean.DeleteAllDocumentsAsync(); var user = new User(); - var issue = new Issue { AssigneeId = user.Id, Tags = new[] { "DIY" }, Title = "Garage Door is busted" }; + var issue = new Issue { AssigneeId = user.Id, Tags = ["DIY"], Title = "Garage Door is busted" }; using var session = theStore.IdentitySession(); session.Store(user, issue); @@ -269,7 +269,7 @@ public async Task include_with_any_containment_where_for_a_single_document_with_ await theStore.Advanced.Clean.DeleteAllDocumentsAsync(); var user = new User(); - var issue = new Issue { AssigneeId = user.Id, Tags = new[] { "DIY" }, Title = "Garage Door is busted" }; + var issue = new Issue { AssigneeId = user.Id, Tags = ["DIY"], Title = "Garage Door is busted" }; using var session = theStore.IdentitySession(); session.Store(user, issue); @@ -292,8 +292,8 @@ public async Task include_with_any_containment_where_for_a_single_document_with_ public async Task include_with_any_array_containment_where_for_a_single_document() { var user = new User(); - var issue1 = new Issue { AssigneeId = user.Id, Tags = new[] { "DIY" }, Title = "Garage Door is busted" }; - var issue2 = new Issue { AssigneeId = user.Id, Tags = new[] { "TAG" }, Title = "Garage Door is busted" }; + var issue1 = new Issue { AssigneeId = user.Id, Tags = ["DIY"], Title = "Garage Door is busted" }; + var issue2 = new Issue { AssigneeId = user.Id, Tags = ["TAG"], Title = "Garage Door is busted" }; var issue3 = new Issue { AssigneeId = user.Id, Tags = [], Title = "Garage Door is busted" }; var requestedTags = new[] { "DIY", "TAG" }; @@ -322,7 +322,7 @@ public async Task include_with_any_array_containment_where_for_a_single_document public async Task include_with_generic_type() { var user = new UserWithInterface { Id = Guid.NewGuid(), UserName = "Jens" }; - var issue = new Issue { AssigneeId = user.Id, Tags = new[] { "DIY" }, Title = "Garage Door is busted" }; + var issue = new Issue { AssigneeId = user.Id, Tags = ["DIY"], Title = "Garage Door is busted" }; using var session = theStore.IdentitySession(); session.Store(user, issue); @@ -783,9 +783,9 @@ public async Task include_many_to_list() await theStore.BulkInsertAsync(new User[] { user1, user2, user3, user4, user5, user6, user7 }); - var group1 = new Group { Name = "Odds", Users = new[] { user1.Id, user3.Id, user5.Id, user7.Id } }; + var group1 = new Group { Name = "Odds", Users = [user1.Id, user3.Id, user5.Id, user7.Id] }; - var group2 = new Group { Name = "Evens", Users = new[] { user2.Id, user4.Id, user6.Id } }; + var group2 = new Group { Name = "Evens", Users = [user2.Id, user4.Id, user6.Id] }; using (var session = theStore.LightweightSession()) { @@ -912,7 +912,7 @@ public async Task include_many_to_list_with_empty_parent_collection() await theStore.BulkInsertAsync(new[] { user1, user2, user3 }); - var group1 = new Group { Name = "Users", Users = new[] { user1.Id, user2.Id, user3.Id } }; + var group1 = new Group { Name = "Users", Users = [user1.Id, user2.Id, user3.Id] }; var group2 = new Group { Name = "Empty", Users = [] }; using (var session = theStore.LightweightSession()) diff --git a/src/LinqTests/Operators/all_operator.cs b/src/LinqTests/Operators/all_operator.cs index 72bf3bf318..ecede1b139 100644 --- a/src/LinqTests/Operators/all_operator.cs +++ b/src/LinqTests/Operators/all_operator.cs @@ -19,13 +19,13 @@ public all_operator(DefaultStoreFixture fixture, ITestOutputHelper output) : bas [Fact] public async Task invoking_queryable_all_operation_test1() { - theSession.Store(new User { FirstName = "Hank" , Roles = new []{ "R1", default(string)}}); - theSession.Store(new User { FirstName = "Bill" , Roles = new []{ "R3", "R5"} }); - theSession.Store(new User { FirstName = "Sam" , Roles = new []{ "R1", "R2"} }); - theSession.Store(new User { FirstName = "Tom" , Roles = new []{ "R3", "R5"} }); - theSession.Store(new User { FirstName = "Joe" , Roles = new []{ "R1", "R1"} }); - theSession.Store(new User { FirstName = "Tom" , Roles = new []{ "R1", "R1"} }); - theSession.Store(new User { FirstName = "Joe" , Roles = new []{ default(string), default(string)} }); + theSession.Store(new User { FirstName = "Hank" , Roles = ["R1", default(string)]}); + theSession.Store(new User { FirstName = "Bill" , Roles = ["R3", "R5"] }); + theSession.Store(new User { FirstName = "Sam" , Roles = ["R1", "R2"] }); + theSession.Store(new User { FirstName = "Tom" , Roles = ["R3", "R5"] }); + theSession.Store(new User { FirstName = "Joe" , Roles = ["R1", "R1"] }); + theSession.Store(new User { FirstName = "Tom" , Roles = ["R1", "R1"] }); + theSession.Store(new User { FirstName = "Joe" , Roles = [default(string), default(string)] }); await theSession.SaveChangesAsync(); var results = theSession.Query() @@ -38,13 +38,13 @@ public async Task invoking_queryable_all_operation_test1() [Fact] public async Task invoking_queryable_all_operation_test2() { - theSession.Store(new User { FirstName = "Hank" , Roles = new []{ "R1", default(string)}}); - theSession.Store(new User { FirstName = "Bill" , Roles = new []{ "R3", "R5"} }); - theSession.Store(new User { FirstName = "Sam" , Roles = new []{ "R1", "R2"} }); - theSession.Store(new User { FirstName = "Tom" , Roles = new []{ "R3", "R5"} }); - theSession.Store(new User { FirstName = "Joe" , Roles = new []{ "R1", "R1"} }); - theSession.Store(new User { FirstName = "Tom" , Roles = new []{ "R1", "R1"} }); - theSession.Store(new User { FirstName = "Joe" , Roles = new []{ default(string), default(string)} }); + theSession.Store(new User { FirstName = "Hank" , Roles = ["R1", default(string)]}); + theSession.Store(new User { FirstName = "Bill" , Roles = ["R3", "R5"] }); + theSession.Store(new User { FirstName = "Sam" , Roles = ["R1", "R2"] }); + theSession.Store(new User { FirstName = "Tom" , Roles = ["R3", "R5"] }); + theSession.Store(new User { FirstName = "Joe" , Roles = ["R1", "R1"] }); + theSession.Store(new User { FirstName = "Tom" , Roles = ["R1", "R1"] }); + theSession.Store(new User { FirstName = "Joe" , Roles = [default(string), default(string)] }); await theSession.SaveChangesAsync(); var results = theSession.Query() @@ -57,13 +57,13 @@ public async Task invoking_queryable_all_operation_test2() [Fact] public async Task invoking_queryable_all_operation_test3() { - theSession.Store(new User { FirstName = "Hank" , Roles = new []{ "R1", default(string)}}); - theSession.Store(new User { FirstName = "Bill" , Roles = new []{ "R3", "R5"} }); - theSession.Store(new User { FirstName = "Sam" , Roles = new []{ "R1", "R2"} }); - theSession.Store(new User { FirstName = "Tom" , Roles = new []{ "R3", "R5"} }); - theSession.Store(new User { FirstName = "Joe" , Roles = new []{ "R1", "R1"} }); - theSession.Store(new User { FirstName = "Tom" , Roles = new []{ "R1", "R1"} }); - theSession.Store(new User { FirstName = "Joe" , Roles = new []{ default(string), default(string)} }); + theSession.Store(new User { FirstName = "Hank" , Roles = ["R1", default(string)]}); + theSession.Store(new User { FirstName = "Bill" , Roles = ["R3", "R5"] }); + theSession.Store(new User { FirstName = "Sam" , Roles = ["R1", "R2"] }); + theSession.Store(new User { FirstName = "Tom" , Roles = ["R3", "R5"] }); + theSession.Store(new User { FirstName = "Joe" , Roles = ["R1", "R1"] }); + theSession.Store(new User { FirstName = "Tom" , Roles = ["R1", "R1"] }); + theSession.Store(new User { FirstName = "Joe" , Roles = [default(string), default(string)] }); await theSession.SaveChangesAsync(); var results = theSession.Query() @@ -76,13 +76,13 @@ public async Task invoking_queryable_all_operation_test3() [Fact] public async Task invoking_queryable_all_operation_test4() { - theSession.Store(new User { FirstName = "Hank" , Roles = new []{ "R1", default(string)}}); - theSession.Store(new User { FirstName = "Bill" , Roles = new []{ "R3", "R5"} }); - theSession.Store(new User { FirstName = "Sam" , Roles = new []{ "R1", "R2"} }); - theSession.Store(new User { FirstName = "Tom" , Roles = new []{ "R3", "R5"} }); - theSession.Store(new User { FirstName = "Joe" , Roles = new []{ "R1", "R1"} }); - theSession.Store(new User { FirstName = "Tom" , Roles = new []{ "R1", "R1"} }); - theSession.Store(new User { FirstName = "Joe" , Roles = new []{ default(string), default(string)} }); + theSession.Store(new User { FirstName = "Hank" , Roles = ["R1", default(string)]}); + theSession.Store(new User { FirstName = "Bill" , Roles = ["R3", "R5"] }); + theSession.Store(new User { FirstName = "Sam" , Roles = ["R1", "R2"] }); + theSession.Store(new User { FirstName = "Tom" , Roles = ["R3", "R5"] }); + theSession.Store(new User { FirstName = "Joe" , Roles = ["R1", "R1"] }); + theSession.Store(new User { FirstName = "Tom" , Roles = ["R1", "R1"] }); + theSession.Store(new User { FirstName = "Joe" , Roles = [default(string), default(string)] }); await theSession.SaveChangesAsync(); /* SHOULD BE @@ -114,22 +114,22 @@ public async Task invoking_queryable_all_operation_test5() { theSession.Store(new User { - FirstName = "Joe" , Roles = new []{ "R1", default(string)}, + FirstName = "Joe" , Roles = ["R1", default(string)], Friends = new List { new(){ Name = "F1"}, new(){ Name = "F1"}} }); theSession.Store(new User { - FirstName = "Bill" , Roles = new []{ "R1", default(string)}, + FirstName = "Bill" , Roles = ["R1", default(string)], Friends = new List { new(){ Name = "F1"}, new(){ Name = "F1"}} }); theSession.Store(new User { - FirstName = "Joe" , Roles = new []{ "R1", default(string)}, + FirstName = "Joe" , Roles = ["R1", default(string)], Friends = new List { new(){ Name = "F1"}, new(){ Name = "F2"}} }); theSession.Store(new User { - FirstName = "Joe" , Roles = new []{ "R1", default(string)}, + FirstName = "Joe" , Roles = ["R1", default(string)], Friends = new List { new(){ Name = default}, new(){ Name = default}} }); await theSession.SaveChangesAsync(); @@ -146,22 +146,22 @@ public async Task invoking_queryable_all_operation_test6() { theSession.Store(new User { - FirstName = "Joe" , Roles = new []{ "R1", default(string)}, + FirstName = "Joe" , Roles = ["R1", default(string)], Friends = new List { new(){ Name = "F1"}, new(){ Name = "F1"}} }); theSession.Store(new User { - FirstName = "Bill" , Roles = new []{ "R1", default(string)}, + FirstName = "Bill" , Roles = ["R1", default(string)], Friends = new List { new(){ Name = "F1"}, new(){ Name = "F1"}} }); theSession.Store(new User { - FirstName = "Joe" , Roles = new []{ "R1", default(string)}, + FirstName = "Joe" , Roles = ["R1", default(string)], Friends = new List { new(){ Name = "F1"}, new(){ Name = "F2"}} }); theSession.Store(new User { - FirstName = "Joe" , Roles = new []{ "R1", default(string)}, + FirstName = "Joe" , Roles = ["R1", default(string)], Friends = new List { new(){ Name = default}, new(){ Name = default}} }); await theSession.SaveChangesAsync(); @@ -178,22 +178,22 @@ public async Task invoking_queryable_all_operation_test7() { theSession.Store(new User { - FirstName = "Joe" , Roles = new []{ "R1", default(string)}, + FirstName = "Joe" , Roles = ["R1", default(string)], Friends = new List { new(){ Name = "F1"}, new(){ Name = "F1"}} }); theSession.Store(new User { - FirstName = "Bill" , Roles = new []{ "R1", default(string)}, + FirstName = "Bill" , Roles = ["R1", default(string)], Friends = new List { new(){ Name = "F1"}, new(){ Name = "F1"}} }); theSession.Store(new User { - FirstName = "Joe" , Roles = new []{ "R1", default(string)}, + FirstName = "Joe" , Roles = ["R1", default(string)], Friends = new List { new(){ Name = "F1"}, new(){ Name = "F2"}} }); theSession.Store(new User { - FirstName = "Joe" , Roles = new []{ "R1", default(string)}, + FirstName = "Joe" , Roles = ["R1", default(string)], Friends = new List { new(){ Name = default}, new(){ Name = default}} }); await theSession.SaveChangesAsync(); @@ -210,22 +210,22 @@ public async Task invoking_queryable_all_operation_test8() { theSession.Store(new User { - FirstName = "Joe" , Roles = new []{ "R1", default(string)}, + FirstName = "Joe" , Roles = ["R1", default(string)], Friends = new List { new(){ Name = "F1"}, new(){ Name = "F1"}} }); theSession.Store(new User { - FirstName = "Bill" , Roles = new []{ "R1", default(string)}, + FirstName = "Bill" , Roles = ["R1", default(string)], Friends = new List { new(){ Name = "F1"}, new(){ Name = "F1"}} }); theSession.Store(new User { - FirstName = "Joe" , Roles = new []{ "R1", default(string)}, + FirstName = "Joe" , Roles = ["R1", default(string)], Friends = new List { new(){ Name = "F1"}, new(){ Name = "F2"}} }); theSession.Store(new User { - FirstName = "Joe" , Roles = new []{ "R1", default(string)}, + FirstName = "Joe" , Roles = ["R1", default(string)], Friends = new List { new(){ Name = default}, new(){ Name = default}} }); await theSession.SaveChangesAsync(); diff --git a/src/LinqTests/Operators/custom_marten_operators.cs b/src/LinqTests/Operators/custom_marten_operators.cs index ff4cef6704..8cd8121178 100644 --- a/src/LinqTests/Operators/custom_marten_operators.cs +++ b/src/LinqTests/Operators/custom_marten_operators.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using Marten; @@ -8,14 +8,14 @@ namespace LinqTests.Operators; public class custom_marten_operators { - private static readonly int[] Ints = { 0, 1, 2, 3 }; + private static readonly int[] Ints = [0, 1, 2, 3]; - private static readonly Guid[] Guids = { Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid() }; + private static readonly Guid[] Guids = [Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid()]; private static readonly string[] Strings = - { + [ Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), Guid.NewGuid().ToString() - }; + ]; diff --git a/src/LinqTests/Operators/is_subset_of_operator.cs b/src/LinqTests/Operators/is_subset_of_operator.cs index 94b5247e85..e7a933da9f 100644 --- a/src/LinqTests/Operators/is_subset_of_operator.cs +++ b/src/LinqTests/Operators/is_subset_of_operator.cs @@ -20,8 +20,8 @@ public is_subset_of_operator(DefaultStoreFixture fixture, ITestOutputHelper outp protected override Task fixtureSetup() { - _allTargets = new[] - { + _allTargets = + [ CreateTarget("c#"), CreateTarget("c#", "json", "webapi"), CreateTarget("c#", "logging"), @@ -29,7 +29,7 @@ protected override Task fixtureSetup() CreateTarget("c#", "mssql", "aspnet"), CreateTarget("sql", "mssql"), CreateTarget(".net", "json", "mssql", "c#") - }; + ]; return theStore.BulkInsertAsync(_allTargets); } diff --git a/src/LinqTests/Operators/is_super_set_of_operator.cs b/src/LinqTests/Operators/is_super_set_of_operator.cs index 1208621aa9..c0b6f173a9 100644 --- a/src/LinqTests/Operators/is_super_set_of_operator.cs +++ b/src/LinqTests/Operators/is_super_set_of_operator.cs @@ -30,8 +30,8 @@ public is_super_set_of_operator(DefaultStoreFixture fixture) : base(fixture) protected override Task fixtureSetup() { - _allTargets = new[] - { + _allTargets = + [ CreateTarget("c#"), CreateTarget("c#", "json", "webapi"), CreateTarget("c#", "logging"), @@ -39,7 +39,7 @@ protected override Task fixtureSetup() CreateTarget("c#", "mssql", "aspnet"), CreateTarget("sql", "mssql"), CreateTarget(".net", "json", "mssql", "c#") - }; + ]; return theStore.BulkInsertAsync(_allTargets); } diff --git a/src/Marten.Testing/Documents/TargetIntId.cs b/src/Marten.Testing/Documents/TargetIntId.cs index 73a6256681..79a2864e83 100644 --- a/src/Marten.Testing/Documents/TargetIntId.cs +++ b/src/Marten.Testing/Documents/TargetIntId.cs @@ -10,16 +10,16 @@ public class TargetIntId private static readonly Random _random = new Random(67); private static readonly string[] _strings = - { + [ "Red", "Orange", "Yellow", "Green", "Blue", "Purple", "Violet", "Pink", "Gray", "Black" - }; + ]; private static readonly string[] _otherStrings = - { + [ "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten" - }; + ]; public static IEnumerable GenerateRandomData(int number) { @@ -44,7 +44,7 @@ public static TargetIntId Random(bool deep = false) target.Float = float.Parse(_random.NextDouble().ToString()); - target.NumberArray = new[] { _random.Next(0, 10), _random.Next(0, 10), _random.Next(0, 10) }; + target.NumberArray = [_random.Next(0, 10), _random.Next(0, 10), _random.Next(0, 10)]; target.NumberArray = target.NumberArray.Distinct().ToArray();