diff --git a/src/OrchardCore.Modules/OrchardCore.AdminMenu/Controllers/MenuController.cs b/src/OrchardCore.Modules/OrchardCore.AdminMenu/Controllers/MenuController.cs index 095430392a6..028f8895cd1 100644 --- a/src/OrchardCore.Modules/OrchardCore.AdminMenu/Controllers/MenuController.cs +++ b/src/OrchardCore.Modules/OrchardCore.AdminMenu/Controllers/MenuController.cs @@ -73,7 +73,7 @@ public async Task List(ContentOptions options, PagerParameters pa var startIndex = pager.GetStartIndex(); var pageSize = pager.PageSize; - IEnumerable results = new List(); + IEnumerable results = []; // todo: handle the case where there is a deserialization exception on some of the presets. // load at least the ones without error. Provide a way to delete the ones on error. diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/ContentPickerFieldDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/ContentPickerFieldDisplayDriver.cs index 8b8403461b2..9c1cef593be 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/ContentPickerFieldDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/ContentPickerFieldDisplayDriver.cs @@ -59,7 +59,7 @@ public override IDisplayResult Edit(ContentPickerField field, BuildFieldEditorCo model.Part = context.ContentPart; model.PartFieldDefinition = context.PartFieldDefinition; - model.SelectedItems = new List(); + model.SelectedItems = []; var settings = context.PartFieldDefinition.GetSettings(); foreach (var contentItemId in field.ContentItemIds) diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/LocalizationSetContentPickerFieldDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/LocalizationSetContentPickerFieldDisplayDriver.cs index 90d28901acd..3f93bf80737 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/LocalizationSetContentPickerFieldDisplayDriver.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Drivers/LocalizationSetContentPickerFieldDisplayDriver.cs @@ -56,7 +56,7 @@ public override IDisplayResult Edit(LocalizationSetContentPickerField field, Bui model.Part = context.ContentPart; model.PartFieldDefinition = context.PartFieldDefinition; - model.SelectedItems = new List(); + model.SelectedItems = []; foreach (var kvp in await _contentLocalizationManager.GetFirstItemIdForSetsAsync(field.LocalizationSets)) { diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/ViewModels/EditUserPickerFieldViewModel.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/ViewModels/EditUserPickerFieldViewModel.cs index f46497f6b60..1a8cc9b1186 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/ViewModels/EditUserPickerFieldViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/ViewModels/EditUserPickerFieldViewModel.cs @@ -23,7 +23,7 @@ public class EditUserPickerFieldViewModel public ContentTypePartDefinition TypePartDefinition { get; set; } [BindNever] - public IList SelectedUsers { get; set; } = new List(); + public IList SelectedUsers { get; set; } = []; } public class VueMultiselectUserViewModel diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Views/Items/ContentTypesSitemapSource.SummaryAdmin.cshtml b/src/OrchardCore.Modules/OrchardCore.Contents/Views/Items/ContentTypesSitemapSource.SummaryAdmin.cshtml index eede5e26c70..3e73c22ecbe 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Views/Items/ContentTypesSitemapSource.SummaryAdmin.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Views/Items/ContentTypesSitemapSource.SummaryAdmin.cshtml @@ -3,7 +3,7 @@ @{ var allRoutableContentTypes = await RoutableContentTypeCoordinator.ListRoutableTypeDefinitionsAsync(); - var selectedContentTypes = Model.Value.ContentTypes ?? new ContentTypeSitemapEntry[] { }; + var selectedContentTypes = Model.Value.ContentTypes ?? []; var selectedDisplayNames = allRoutableContentTypes .Where(ctd => selectedContentTypes.Any(sct => sct.ContentTypeName == ctd.Name)) diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Workflows/Activities/ContentEvent.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Workflows/Activities/ContentEvent.cs index d9f1a897ae5..8fc7cb72878 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Workflows/Activities/ContentEvent.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Workflows/Activities/ContentEvent.cs @@ -17,7 +17,7 @@ protected ContentEvent(IContentManager contentManager, IWorkflowScriptEvaluator public IList ContentTypeFilter { - get => GetProperty>(defaultValue: () => new List()); + get => GetProperty>(defaultValue: () => []); set => SetProperty(value); } diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Workflows/ViewModels/ContentEventViewModel.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Workflows/ViewModels/ContentEventViewModel.cs index 93c98494071..e37774ca6cf 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Workflows/ViewModels/ContentEventViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Workflows/ViewModels/ContentEventViewModel.cs @@ -17,6 +17,6 @@ public ContentEventViewModel(T activity) } public IList ContentTypeFilter { get; set; } - public IList SelectedContentTypeNames { get; set; } = new List(); + public IList SelectedContentTypeNames { get; set; } = []; } } diff --git a/src/OrchardCore.Modules/OrchardCore.Forms/Helpers/ModelStateHelpers.cs b/src/OrchardCore.Modules/OrchardCore.Forms/Helpers/ModelStateHelpers.cs index 79e83d0c334..20e3d5ed733 100644 --- a/src/OrchardCore.Modules/OrchardCore.Forms/Helpers/ModelStateHelpers.cs +++ b/src/OrchardCore.Modules/OrchardCore.Forms/Helpers/ModelStateHelpers.cs @@ -43,7 +43,7 @@ private class ModelStateTransferValue public string Key { get; set; } public string AttemptedValue { get; set; } public object RawValue { get; set; } - public ICollection ErrorMessages { get; set; } = new List(); + public ICollection ErrorMessages { get; set; } = []; } } } diff --git a/src/OrchardCore.Modules/OrchardCore.OpenId/ViewModels/OpenIdApplicationsIndexViewModel.cs b/src/OrchardCore.Modules/OrchardCore.OpenId/ViewModels/OpenIdApplicationsIndexViewModel.cs index 262e0aa472a..429841bf9c0 100644 --- a/src/OrchardCore.Modules/OrchardCore.OpenId/ViewModels/OpenIdApplicationsIndexViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.OpenId/ViewModels/OpenIdApplicationsIndexViewModel.cs @@ -4,7 +4,7 @@ namespace OrchardCore.OpenId.ViewModels { public class OpenIdApplicationsIndexViewModel { - public IList Applications { get; } = new List(); + public IList Applications { get; } = []; public dynamic Pager { get; set; } } diff --git a/src/OrchardCore.Modules/OrchardCore.OpenId/ViewModels/OpenIdScopeIndexViewModel.cs b/src/OrchardCore.Modules/OrchardCore.OpenId/ViewModels/OpenIdScopeIndexViewModel.cs index af03ceb5b3d..2f078b947dd 100644 --- a/src/OrchardCore.Modules/OrchardCore.OpenId/ViewModels/OpenIdScopeIndexViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.OpenId/ViewModels/OpenIdScopeIndexViewModel.cs @@ -4,7 +4,7 @@ namespace OrchardCore.OpenId.ViewModels { public class OpenIdScopeIndexViewModel { - public IList Scopes { get; } = new List(); + public IList Scopes { get; } = []; public dynamic Pager { get; set; } } diff --git a/src/OrchardCore.Modules/OrchardCore.OpenId/ViewModels/OpenIdServerSettingsViewModel.cs b/src/OrchardCore.Modules/OrchardCore.OpenId/ViewModels/OpenIdServerSettingsViewModel.cs index 47fdafe4e1b..01ef1da703b 100644 --- a/src/OrchardCore.Modules/OrchardCore.OpenId/ViewModels/OpenIdServerSettingsViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.OpenId/ViewModels/OpenIdServerSettingsViewModel.cs @@ -18,7 +18,7 @@ public class OpenIdServerSettingsViewModel public StoreLocation? SigningCertificateStoreLocation { get; set; } public StoreName? SigningCertificateStoreName { get; set; } public string SigningCertificateThumbprint { get; set; } - public IList AvailableCertificates { get; } = new List(); + public IList AvailableCertificates { get; } = []; public bool EnableTokenEndpoint { get; set; } public bool EnableAuthorizationEndpoint { get; set; } public bool EnableLogoutEndpoint { get; set; } diff --git a/src/OrchardCore.Modules/OrchardCore.Queries/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Queries/Controllers/AdminController.cs index 310cd2ff89a..f8958bc65da 100644 --- a/src/OrchardCore.Modules/OrchardCore.Queries/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Queries/Controllers/AdminController.cs @@ -90,7 +90,7 @@ public async Task Index(ContentOptions options, PagerParameters p var model = new QueriesIndexViewModel { - Queries = new List(), + Queries = [], Options = options, Pager = await _shapeFactory.PagerAsync(pager, queries.Count(), routeData), QuerySourceNames = _querySources.Select(x => x.Name).ToList() diff --git a/src/OrchardCore.Modules/OrchardCore.Rules/Services/ConditionOperatorConfigureOptions.cs b/src/OrchardCore.Modules/OrchardCore.Rules/Services/ConditionOperatorConfigureOptions.cs index 1226ba57e22..496247a497f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Rules/Services/ConditionOperatorConfigureOptions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Rules/Services/ConditionOperatorConfigureOptions.cs @@ -8,8 +8,8 @@ public class ConditionOperatorConfigureOptions : IConfigureOptions - { + options.Operators.AddRange( + [ new ConditionOperatorOption( (S) => S["Equals"], new StringEqualsOperatorComparer(), @@ -58,7 +58,7 @@ public void Configure(ConditionOperatorOptions options) typeof(StringNotContainsOperator), new ConditionOperatorFactory() ) - }); + ]); } } } diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneQuerySource.cs b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneQuerySource.cs index d3c3f4cbe85..20baddad7db 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneQuerySource.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneQuerySource.cs @@ -74,7 +74,7 @@ await _luceneIndexManager.SearchAsync(luceneQuery.Index, async searcher => if (luceneQuery.ReturnContentItems) { // We always return an empty collection if the bottom lines queries have no results. - luceneQueryResults.Items = new List(); + luceneQueryResults.Items = []; // Load corresponding content item versions var indexedContentItemVersionIds = docs.TopDocs.ScoreDocs.Select(x => searcher.Doc(x.Doc).Get("ContentItemVersionId")).ToArray(); diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneSearchQueryService.cs b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneSearchQueryService.cs index 6abf83ca7fd..5407ed2afb1 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneSearchQueryService.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneSearchQueryService.cs @@ -8,7 +8,7 @@ public class LuceneSearchQueryService : ILuceneSearchQueryService { private readonly LuceneIndexManager _luceneIndexManager; - private static readonly HashSet _idSet = new(new string[] { "ContentItemId" }); + private static readonly HashSet _idSet = [..new string[] {"ContentItemId"}]; public LuceneSearchQueryService(LuceneIndexManager luceneIndexManager) { diff --git a/src/OrchardCore.Modules/OrchardCore.Security/Options/SecurityHeadersOptions.cs b/src/OrchardCore.Modules/OrchardCore.Security/Options/SecurityHeadersOptions.cs index a592931bc3e..6522547e37f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Security/Options/SecurityHeadersOptions.cs +++ b/src/OrchardCore.Modules/OrchardCore.Security/Options/SecurityHeadersOptions.cs @@ -9,13 +9,13 @@ public class SecurityHeadersOptions { public SecurityHeadersOptions() { - HeaderPolicyProviders = new List - { + HeaderPolicyProviders = + [ new ContentSecurityPolicyHeaderPolicyProvider { Options = this }, new ContentTypeOptionsHeaderPolicyProvider { Options = this }, new PermissionsHeaderPolicyProvider { Options = this }, new ReferrerHeaderPolicyProvider { Options = this } - }; + ]; } public string[] ContentSecurityPolicy { get; set; } = SecurityHeaderDefaults.ContentSecurityPolicy; diff --git a/src/OrchardCore.Modules/OrchardCore.Users/ViewModels/TwoFactorAuthenticationViewModel.cs b/src/OrchardCore.Modules/OrchardCore.Users/ViewModels/TwoFactorAuthenticationViewModel.cs index f66811fb9f3..eba0c296c24 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/ViewModels/TwoFactorAuthenticationViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/ViewModels/TwoFactorAuthenticationViewModel.cs @@ -24,7 +24,7 @@ public class TwoFactorAuthenticationViewModel public bool CanDisableTwoFactor { get; set; } [BindNever] - public IList AuthenticationMethods { get; } = new List(); + public IList AuthenticationMethods { get; } = []; [BindNever] public IUser User { get; set; } diff --git a/src/OrchardCore.Modules/OrchardCore.Workflows/UserTasks/ViewModels/UserTaskEventViewModel.cs b/src/OrchardCore.Modules/OrchardCore.Workflows/UserTasks/ViewModels/UserTaskEventViewModel.cs index 7929acc61e5..5fe53657f41 100644 --- a/src/OrchardCore.Modules/OrchardCore.Workflows/UserTasks/ViewModels/UserTaskEventViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.Workflows/UserTasks/ViewModels/UserTaskEventViewModel.cs @@ -5,6 +5,6 @@ namespace OrchardCore.Workflows.UserTasks.ViewModels public class UserTaskEventViewModel { public string Actions { get; set; } - public IList Roles { get; set; } = new List(); + public IList Roles { get; set; } = []; } } diff --git a/src/OrchardCore/OrchardCore.Abstractions/Modules/Application.cs b/src/OrchardCore/OrchardCore.Abstractions/Modules/Application.cs index 51980541fcb..baed522b241 100644 --- a/src/OrchardCore/OrchardCore.Abstractions/Modules/Application.cs +++ b/src/OrchardCore/OrchardCore.Abstractions/Modules/Application.cs @@ -33,7 +33,7 @@ public Application(IHostEnvironment environment, IEnumerable modules) Assembly = Assembly.Load(new AssemblyName(Name)); - _modules = new List(modules); + _modules = [..modules]; _modulesByName = _modules.ToDictionary(m => m.Name, m => m); } diff --git a/src/OrchardCore/OrchardCore.Abstractions/Modules/Builder/StartupActions.cs b/src/OrchardCore/OrchardCore.Abstractions/Modules/Builder/StartupActions.cs index bb34dfafe2b..a3db50bd063 100644 --- a/src/OrchardCore/OrchardCore.Abstractions/Modules/Builder/StartupActions.cs +++ b/src/OrchardCore/OrchardCore.Abstractions/Modules/Builder/StartupActions.cs @@ -15,13 +15,10 @@ public StartupActions(int order) public int Order { get; } - public ICollection> ConfigureServicesActions { get; } = - new List>(); + public ICollection> ConfigureServicesActions { get; } = []; - public ICollection> ConfigureActions { get; } = - new List>(); + public ICollection> ConfigureActions { get; } = []; - public ICollection> AsyncConfigureActions { get; } = - new List>(); + public ICollection> AsyncConfigureActions { get; } = []; } } diff --git a/src/OrchardCore/OrchardCore.Abstractions/Shell/Descriptor/Models/ShellDescriptor.cs b/src/OrchardCore/OrchardCore.Abstractions/Shell/Descriptor/Models/ShellDescriptor.cs index 3528702fd2f..3335c1312bf 100644 --- a/src/OrchardCore/OrchardCore.Abstractions/Shell/Descriptor/Models/ShellDescriptor.cs +++ b/src/OrchardCore/OrchardCore.Abstractions/Shell/Descriptor/Models/ShellDescriptor.cs @@ -17,11 +17,11 @@ public class ShellDescriptor /// /// Gets or sets the list of features in the shell. /// - public IList Features { get; set; } = new List(); + public IList Features { get; set; } = []; /// /// Gets or sets the list of installed features in the shell. /// - public IList Installed { get; set; } = new List(); + public IList Installed { get; set; } = []; } } diff --git a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/ContentItemMetadata.cs b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/ContentItemMetadata.cs index f36f6184470..9559023c140 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/ContentItemMetadata.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/ContentItemMetadata.cs @@ -11,7 +11,7 @@ public class ContentItemMetadata public RouteValueDictionary RemoveRouteValues { get; set; } public RouteValueDictionary AdminRouteValues { get; set; } - public readonly IList DisplayGroupInfo = new List(); - public readonly IList EditorGroupInfo = new List(); + public readonly IList DisplayGroupInfo = []; + public readonly IList EditorGroupInfo = []; } } diff --git a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Metadata/Builders/ContentPartDefinitionBuilder.cs b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Metadata/Builders/ContentPartDefinitionBuilder.cs index 6860f67b418..253fa53bd53 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Metadata/Builders/ContentPartDefinitionBuilder.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Metadata/Builders/ContentPartDefinitionBuilder.cs @@ -28,7 +28,7 @@ public ContentPartDefinitionBuilder(ContentPartDefinition existing) if (existing == null) { - _fields = new List(); + _fields = []; _settings = []; } else diff --git a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Metadata/Builders/ContentTypeDefinitionBuilder.cs b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Metadata/Builders/ContentTypeDefinitionBuilder.cs index 9243058de8e..51fda088ee9 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Metadata/Builders/ContentTypeDefinitionBuilder.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Metadata/Builders/ContentTypeDefinitionBuilder.cs @@ -28,7 +28,7 @@ public ContentTypeDefinitionBuilder(ContentTypeDefinition existing) if (existing == null) { - _parts = new List(); + _parts = []; _settings = []; } else diff --git a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Metadata/Records/ContentDefinitionRecord.cs b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Metadata/Records/ContentDefinitionRecord.cs index fab1b6f06f4..43748f24a2d 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Metadata/Records/ContentDefinitionRecord.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Metadata/Records/ContentDefinitionRecord.cs @@ -8,8 +8,8 @@ public class ContentDefinitionRecord : Document { public ContentDefinitionRecord() { - ContentTypeDefinitionRecords = new List(); - ContentPartDefinitionRecords = new List(); + ContentTypeDefinitionRecords = []; + ContentPartDefinitionRecords = []; } public IList ContentTypeDefinitionRecords { get; set; } diff --git a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Routing/ContainedContentItemsAspect.cs b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Routing/ContainedContentItemsAspect.cs index 0b38e3ad578..4462d1f2be1 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Routing/ContainedContentItemsAspect.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Routing/ContainedContentItemsAspect.cs @@ -9,6 +9,6 @@ public class ContainedContentItemsAspect /// /// Json accessors to provide a list of contained content items. /// - public IList> Accessors { get; set; } = new List>(); + public IList> Accessors { get; set; } = []; } } diff --git a/src/OrchardCore/OrchardCore.Deployment.Abstractions/DeploymentPlanResult.cs b/src/OrchardCore/OrchardCore.Deployment.Abstractions/DeploymentPlanResult.cs index 6fa1e2850a1..4c6854f2191 100644 --- a/src/OrchardCore/OrchardCore.Deployment.Abstractions/DeploymentPlanResult.cs +++ b/src/OrchardCore/OrchardCore.Deployment.Abstractions/DeploymentPlanResult.cs @@ -31,7 +31,7 @@ public DeploymentPlanResult(IFileBuilder fileBuilder, RecipeDescriptor recipeDes } public JsonObject Recipe { get; } - public IList Steps { get; init; } = new List(); + public IList Steps { get; init; } = []; public IFileBuilder FileBuilder { get; } public async Task FinalizeAsync() { diff --git a/src/OrchardCore/OrchardCore.DisplayManagement.Liquid/Tags/FluidTagHelper.cs b/src/OrchardCore/OrchardCore.DisplayManagement.Liquid/Tags/FluidTagHelper.cs index 50a740714b3..6378cd96a65 100644 --- a/src/OrchardCore/OrchardCore.DisplayManagement.Liquid/Tags/FluidTagHelper.cs +++ b/src/OrchardCore/OrchardCore.DisplayManagement.Liquid/Tags/FluidTagHelper.cs @@ -44,7 +44,7 @@ public static async ValueTask WriteToAsync(string identifier, List(arguments); + arguments = [..arguments]; arguments[0] = new FilterArgument(mapping, arguments[0].Expression); } diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/Descriptors/DefaultShapeTableManager.cs b/src/OrchardCore/OrchardCore.DisplayManagement/Descriptors/DefaultShapeTableManager.cs index 05f07e0d972..a326feec698 100644 --- a/src/OrchardCore/OrchardCore.DisplayManagement/Descriptors/DefaultShapeTableManager.cs +++ b/src/OrchardCore/OrchardCore.DisplayManagement/Descriptors/DefaultShapeTableManager.cs @@ -64,7 +64,7 @@ public async Task GetShapeTableAsync(string themeId) // Here we don't use a lock for thread safety but for atomicity. lock (_syncLock) { - excludedFeatures = new HashSet(_shapeDescriptors.Select(kv => kv.Value.Feature.Id)); + excludedFeatures = [.._shapeDescriptors.Select(kv => kv.Value.Feature.Id)]; } var shapeDescriptors = new Dictionary(); diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/Descriptors/ShapeTableBuilder.cs b/src/OrchardCore/OrchardCore.DisplayManagement/Descriptors/ShapeTableBuilder.cs index 94e003cef0f..9b5fa2435cc 100644 --- a/src/OrchardCore/OrchardCore.DisplayManagement/Descriptors/ShapeTableBuilder.cs +++ b/src/OrchardCore/OrchardCore.DisplayManagement/Descriptors/ShapeTableBuilder.cs @@ -6,7 +6,7 @@ namespace OrchardCore.DisplayManagement.Descriptors { public class ShapeTableBuilder { - private readonly IList _alterationBuilders = new List(); + private readonly IList _alterationBuilders = []; private readonly IFeatureInfo _feature; public ShapeTableBuilder(IFeatureInfo feature, IReadOnlyCollection excludedFeatureIds = null) diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/Descriptors/ShapeTemplateStrategy/ShapeTemplateOptions.cs b/src/OrchardCore/OrchardCore.DisplayManagement/Descriptors/ShapeTemplateStrategy/ShapeTemplateOptions.cs index f46e9632d95..d6587b45698 100644 --- a/src/OrchardCore/OrchardCore.DisplayManagement/Descriptors/ShapeTemplateStrategy/ShapeTemplateOptions.cs +++ b/src/OrchardCore/OrchardCore.DisplayManagement/Descriptors/ShapeTemplateStrategy/ShapeTemplateOptions.cs @@ -16,6 +16,6 @@ public class ShapeTemplateOptions /// At startup, this is initialized to include an instance of that is /// rooted at the application root. /// - public IList FileProviders { get; } = new List(); + public IList FileProviders { get; } = []; } } diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/Implementation/DefaultShapeFactory.cs b/src/OrchardCore/OrchardCore.DisplayManagement/Implementation/DefaultShapeFactory.cs index c3104a48e92..1b8ee2a17ee 100644 --- a/src/OrchardCore/OrchardCore.DisplayManagement/Implementation/DefaultShapeFactory.cs +++ b/src/OrchardCore/OrchardCore.DisplayManagement/Implementation/DefaultShapeFactory.cs @@ -70,7 +70,7 @@ public async ValueTask CreateAsync(string shapeType, Func>(), + OnCreated = [], CreateAsync = shapeFactory }; diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/Notify/Notifier.cs b/src/OrchardCore/OrchardCore.DisplayManagement/Notify/Notifier.cs index bb372df8f46..b205283de06 100644 --- a/src/OrchardCore/OrchardCore.DisplayManagement/Notify/Notifier.cs +++ b/src/OrchardCore/OrchardCore.DisplayManagement/Notify/Notifier.cs @@ -12,7 +12,7 @@ public class Notifier : INotifier public Notifier(ILogger logger) { - _entries = new List(); + _entries = []; _logger = logger; } diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/Razor/RazorShapeTemplateViewEngine.cs b/src/OrchardCore/OrchardCore.DisplayManagement/Razor/RazorShapeTemplateViewEngine.cs index ad6c19fa421..5e2892792d9 100644 --- a/src/OrchardCore/OrchardCore.DisplayManagement/Razor/RazorShapeTemplateViewEngine.cs +++ b/src/OrchardCore/OrchardCore.DisplayManagement/Razor/RazorShapeTemplateViewEngine.cs @@ -28,7 +28,7 @@ public class RazorShapeTemplateViewEngine : IShapeTemplateViewEngine private readonly IHttpContextAccessor _httpContextAccessor; private readonly ViewContextAccessor _viewContextAccessor; private readonly ITempDataProvider _tempDataProvider; - private readonly List _templateFileExtensions = new(new[] { RazorViewEngine.ViewExtension }); + private readonly List _templateFileExtensions = [..new[] {RazorViewEngine.ViewExtension}]; public RazorShapeTemplateViewEngine( IOptions options, diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/Shapes/ShapeMetadata.cs b/src/OrchardCore/OrchardCore.DisplayManagement/Shapes/ShapeMetadata.cs index 2cc2748bd8d..0a1e67706cf 100644 --- a/src/OrchardCore/OrchardCore.DisplayManagement/Shapes/ShapeMetadata.cs +++ b/src/OrchardCore/OrchardCore.DisplayManagement/Shapes/ShapeMetadata.cs @@ -17,7 +17,7 @@ public ShapeMetadata() { Wrappers = []; Alternates = []; - BindingSources = new List(); + BindingSources = []; Displaying = []; Displayed = []; ProcessingAsync = []; diff --git a/src/OrchardCore/OrchardCore.Feeds.Abstractions/Models/FeedResponse.cs b/src/OrchardCore/OrchardCore.Feeds.Abstractions/Models/FeedResponse.cs index a73cc3a539a..357593001ee 100644 --- a/src/OrchardCore/OrchardCore.Feeds.Abstractions/Models/FeedResponse.cs +++ b/src/OrchardCore/OrchardCore.Feeds.Abstractions/Models/FeedResponse.cs @@ -7,8 +7,8 @@ namespace OrchardCore.Feeds.Models public class FeedResponse { public XElement Element { get; set; } - public IList Items { get; } = new List(); - public IList> Contextualizers { get; } = new List>(); + public IList Items { get; } = []; + public IList> Contextualizers { get; } = []; public void Contextualize(Action contextualizer) { Contextualizers.Add(contextualizer); diff --git a/src/OrchardCore/OrchardCore.ResourceManagement/ResourceManager.cs b/src/OrchardCore/OrchardCore.ResourceManagement/ResourceManager.cs index cf2829f2b41..6c3eaa5510c 100644 --- a/src/OrchardCore/OrchardCore.ResourceManagement/ResourceManager.cs +++ b/src/OrchardCore/OrchardCore.ResourceManagement/ResourceManager.cs @@ -375,7 +375,7 @@ protected virtual void ExpandDependencies( List dependencies = null; if (resource.Dependencies != null) { - dependencies = new List(resource.Dependencies); + dependencies = [..resource.Dependencies]; if (settings.Dependencies != null) { dependencies.AddRange(settings.Dependencies); @@ -383,7 +383,7 @@ protected virtual void ExpandDependencies( } else if (settings.Dependencies != null) { - dependencies = new List(settings.Dependencies); + dependencies = [..settings.Dependencies]; } // Settings is given so they can cascade down into dependencies. For example, if Foo depends on Bar, and Foo's required diff --git a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Services/AzureAISearchIndexingService.cs b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Services/AzureAISearchIndexingService.cs index 34d4b2c18ec..20d5c5105ab 100644 --- a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Services/AzureAISearchIndexingService.cs +++ b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Services/AzureAISearchIndexingService.cs @@ -52,7 +52,7 @@ public async Task ProcessContentItemsAsync(params string[] indexNames) if (indexNames == null || indexNames.Length == 0) { - indexSettings = new List(indexesDocument.IndexSettings.Values); + indexSettings = [..indexesDocument.IndexSettings.Values]; } else { diff --git a/src/OrchardCore/OrchardCore.Search.Elasticsearch.Core/Services/ElasticQuerySource.cs b/src/OrchardCore/OrchardCore.Search.Elasticsearch.Core/Services/ElasticQuerySource.cs index 0235192e43d..72ef9057373 100644 --- a/src/OrchardCore/OrchardCore.Search.Elasticsearch.Core/Services/ElasticQuerySource.cs +++ b/src/OrchardCore/OrchardCore.Search.Elasticsearch.Core/Services/ElasticQuerySource.cs @@ -57,7 +57,7 @@ public async Task ExecuteQueryAsync(Query query, IDictionary(); + elasticQueryResults.Items = []; // Load corresponding content item versions var topDocs = docs.TopDocs.Where(x => x != null).ToList(); diff --git a/src/OrchardCore/OrchardCore.Search.Lucene.Abstractions/LuceneOptions.cs b/src/OrchardCore/OrchardCore.Search.Lucene.Abstractions/LuceneOptions.cs index 0218484621b..5ad3aacb758 100644 --- a/src/OrchardCore/OrchardCore.Search.Lucene.Abstractions/LuceneOptions.cs +++ b/src/OrchardCore/OrchardCore.Search.Lucene.Abstractions/LuceneOptions.cs @@ -4,6 +4,6 @@ namespace OrchardCore.Search.Lucene { public class LuceneOptions { - public IList Analyzers { get; } = new List(); + public IList Analyzers { get; } = []; } } diff --git a/src/OrchardCore/OrchardCore.Sitemaps.Abstractions/Builders/ContentItemsQueryContext.cs b/src/OrchardCore/OrchardCore.Sitemaps.Abstractions/Builders/ContentItemsQueryContext.cs index 54e9d19721e..9dd86f42b85 100644 --- a/src/OrchardCore/OrchardCore.Sitemaps.Abstractions/Builders/ContentItemsQueryContext.cs +++ b/src/OrchardCore/OrchardCore.Sitemaps.Abstractions/Builders/ContentItemsQueryContext.cs @@ -8,11 +8,11 @@ public class ContentItemsQueryContext /// /// Content items to include in sitemap. /// - public IEnumerable ContentItems { get; set; } = new List(); + public IEnumerable ContentItems { get; set; } = []; /// /// Reference content items that may be used to perform a lookup for url alternatives. /// - public IEnumerable ReferenceContentItems { get; set; } = new List(); + public IEnumerable ReferenceContentItems { get; set; } = []; } } diff --git a/src/OrchardCore/OrchardCore.Users.Core/Models/TwoFactorOptions.cs b/src/OrchardCore/OrchardCore.Users.Core/Models/TwoFactorOptions.cs index bf631790bbc..bdfa10744c0 100644 --- a/src/OrchardCore/OrchardCore.Users.Core/Models/TwoFactorOptions.cs +++ b/src/OrchardCore/OrchardCore.Users.Core/Models/TwoFactorOptions.cs @@ -4,5 +4,5 @@ namespace OrchardCore.Users.Models; public class TwoFactorOptions { - public IList Providers { get; init; } = new List(); + public IList Providers { get; init; } = []; } diff --git a/src/OrchardCore/OrchardCore.Users.Core/Models/User.cs b/src/OrchardCore/OrchardCore.Users.Core/Models/User.cs index d076c29ebf1..37b274f5097 100644 --- a/src/OrchardCore/OrchardCore.Users.Core/Models/User.cs +++ b/src/OrchardCore/OrchardCore.Users.Core/Models/User.cs @@ -41,13 +41,13 @@ public class User : Entity, IUser public string ResetToken { get; set; } - public IList RoleNames { get; set; } = new List(); + public IList RoleNames { get; set; } = []; - public IList UserClaims { get; set; } = new List(); + public IList UserClaims { get; set; } = []; - public IList LoginInfos { get; set; } = new List(); + public IList LoginInfos { get; set; } = []; - public IList UserTokens { get; set; } = new List(); + public IList UserTokens { get; set; } = []; public override string ToString() { diff --git a/src/OrchardCore/OrchardCore.Users.Core/Services/UserStore.cs b/src/OrchardCore/OrchardCore.Users.Core/Services/UserStore.cs index 587c7d5a26c..f542717b5e8 100644 --- a/src/OrchardCore/OrchardCore.Users.Core/Services/UserStore.cs +++ b/src/OrchardCore/OrchardCore.Users.Core/Services/UserStore.cs @@ -448,7 +448,7 @@ public Task> GetRolesAsync(IUser user, CancellationToken cancellat return Task.FromResult(u.RoleNames); } - return Task.FromResult>(new List()); + return Task.FromResult>([]); } public Task IsInRoleAsync(IUser user, string normalizedRoleName, CancellationToken cancellationToken) @@ -513,7 +513,7 @@ public Task> GetLoginsAsync(IUser user, CancellationToken c return Task.FromResult(u.LoginInfos); } - return Task.FromResult>(new List()); + return Task.FromResult>([]); } public Task RemoveLoginAsync(IUser user, string loginProvider, string providerKey, CancellationToken cancellationToken) @@ -542,7 +542,7 @@ public Task> GetClaimsAsync(IUser user, CancellationToken cancellat if (user is not User u) { - return Task.FromResult>(new List()); + return Task.FromResult>([]); } return Task.FromResult>(u.UserClaims.Select(x => x.ToClaim()).ToList()); diff --git a/src/OrchardCore/OrchardCore.Workflows.Abstractions/Models/Workflow.cs b/src/OrchardCore/OrchardCore.Workflows.Abstractions/Models/Workflow.cs index 10173fe0509..00f3169bce4 100644 --- a/src/OrchardCore/OrchardCore.Workflows.Abstractions/Models/Workflow.cs +++ b/src/OrchardCore/OrchardCore.Workflows.Abstractions/Models/Workflow.cs @@ -45,7 +45,7 @@ public class Workflow /// List of activities the current workflow instance is waiting on /// for continuing its process. /// - public IList BlockingActivities { get; init; } = new List(); + public IList BlockingActivities { get; init; } = []; public DateTime CreatedUtc { get; set; } diff --git a/src/OrchardCore/OrchardCore.Workflows.Abstractions/Models/WorkflowExecutionContext.cs b/src/OrchardCore/OrchardCore.Workflows.Abstractions/Models/WorkflowExecutionContext.cs index 3b4aa4c1178..33fe357f6e0 100644 --- a/src/OrchardCore/OrchardCore.Workflows.Abstractions/Models/WorkflowExecutionContext.cs +++ b/src/OrchardCore/OrchardCore.Workflows.Abstractions/Models/WorkflowExecutionContext.cs @@ -21,7 +21,7 @@ IEnumerable activities Input = input ?? new Dictionary(); Output = output ?? new Dictionary(); Properties = properties ?? new Dictionary(); - ExecutedActivities = new Stack(executedActivities ?? new List()); + ExecutedActivities = new Stack(executedActivities ?? []); LastResult = lastResult; WorkflowType = workflowType; Workflow = workflow; diff --git a/src/OrchardCore/OrchardCore.Workflows.Abstractions/Models/WorkflowExecutionScriptContext.cs b/src/OrchardCore/OrchardCore.Workflows.Abstractions/Models/WorkflowExecutionScriptContext.cs index 8b33d4b06e5..4096dd7a787 100644 --- a/src/OrchardCore/OrchardCore.Workflows.Abstractions/Models/WorkflowExecutionScriptContext.cs +++ b/src/OrchardCore/OrchardCore.Workflows.Abstractions/Models/WorkflowExecutionScriptContext.cs @@ -9,6 +9,6 @@ public WorkflowExecutionScriptContext(WorkflowExecutionContext workflowContext) { } - public IList ScopedMethodProviders { get; init; } = new List(); + public IList ScopedMethodProviders { get; init; } = []; } } diff --git a/src/OrchardCore/OrchardCore.Workflows.Abstractions/Models/WorkflowState.cs b/src/OrchardCore/OrchardCore.Workflows.Abstractions/Models/WorkflowState.cs index 789d0a760a3..b5ae0e1904f 100644 --- a/src/OrchardCore/OrchardCore.Workflows.Abstractions/Models/WorkflowState.cs +++ b/src/OrchardCore/OrchardCore.Workflows.Abstractions/Models/WorkflowState.cs @@ -37,6 +37,6 @@ public class WorkflowState /// /// The list of executed activities. /// - public IList ExecutedActivities { get; set; } = new List(); + public IList ExecutedActivities { get; set; } = []; } } diff --git a/src/OrchardCore/OrchardCore.Workflows.Abstractions/Models/WorkflowType.cs b/src/OrchardCore/OrchardCore.Workflows.Abstractions/Models/WorkflowType.cs index e62ce6387eb..f9e0f3f5e45 100644 --- a/src/OrchardCore/OrchardCore.Workflows.Abstractions/Models/WorkflowType.cs +++ b/src/OrchardCore/OrchardCore.Workflows.Abstractions/Models/WorkflowType.cs @@ -48,11 +48,11 @@ public class WorkflowType : Entity /// /// A complete list of all activities that are part of this workflow. /// - public IList Activities { get; set; } = new List(); + public IList Activities { get; set; } = []; /// /// A complete list of the transitions between the activities on this workflow. /// - public IList Transitions { get; set; } = new List(); + public IList Transitions { get; set; } = []; } } diff --git a/src/OrchardCore/OrchardCore.XmlRpc.Abstractions/Models/XRpcArray.cs b/src/OrchardCore/OrchardCore.XmlRpc.Abstractions/Models/XRpcArray.cs index 4be598b5565..0f0d6945880 100644 --- a/src/OrchardCore/OrchardCore.XmlRpc.Abstractions/Models/XRpcArray.cs +++ b/src/OrchardCore/OrchardCore.XmlRpc.Abstractions/Models/XRpcArray.cs @@ -6,7 +6,7 @@ public class XRpcArray { public XRpcArray() { - Data = new List(); + Data = []; } public IList Data { get; set; } diff --git a/src/OrchardCore/OrchardCore.XmlRpc.Abstractions/Models/XRpcMethodCall.cs b/src/OrchardCore/OrchardCore.XmlRpc.Abstractions/Models/XRpcMethodCall.cs index 2f281dd55d7..4929872b4c4 100644 --- a/src/OrchardCore/OrchardCore.XmlRpc.Abstractions/Models/XRpcMethodCall.cs +++ b/src/OrchardCore/OrchardCore.XmlRpc.Abstractions/Models/XRpcMethodCall.cs @@ -5,6 +5,6 @@ namespace OrchardCore.XmlRpc.Models public class XRpcMethodCall { public string MethodName { get; set; } - public IList Params { get; set; } = new List(); + public IList Params { get; set; } = []; } } diff --git a/src/OrchardCore/OrchardCore.XmlRpc.Abstractions/Models/XRpcMethodResponse.cs b/src/OrchardCore/OrchardCore.XmlRpc.Abstractions/Models/XRpcMethodResponse.cs index b190fa1458c..fce5461dff5 100644 --- a/src/OrchardCore/OrchardCore.XmlRpc.Abstractions/Models/XRpcMethodResponse.cs +++ b/src/OrchardCore/OrchardCore.XmlRpc.Abstractions/Models/XRpcMethodResponse.cs @@ -6,7 +6,7 @@ public class XRpcMethodResponse { public XRpcMethodResponse() { - Params = new List(); + Params = []; } public IList Params { get; set; } diff --git a/src/OrchardCore/OrchardCore.XmlRpc.Abstractions/XmlRpcContext.cs b/src/OrchardCore/OrchardCore.XmlRpc.Abstractions/XmlRpcContext.cs index e79802b6b7c..53efa216426 100644 --- a/src/OrchardCore/OrchardCore.XmlRpc.Abstractions/XmlRpcContext.cs +++ b/src/OrchardCore/OrchardCore.XmlRpc.Abstractions/XmlRpcContext.cs @@ -12,6 +12,6 @@ public class XmlRpcContext public IUrlHelper Url { get; set; } public XRpcMethodCall RpcMethodCall { get; set; } public XRpcMethodResponse RpcMethodResponse { get; set; } - public ICollection Drivers = new List(); + public ICollection Drivers = []; } } diff --git a/src/OrchardCore/OrchardCore/Shell/Builders/ShellContainerFactory.cs b/src/OrchardCore/OrchardCore/Shell/Builders/ShellContainerFactory.cs index cf0eac88998..4ae3c1281de 100644 --- a/src/OrchardCore/OrchardCore/Shell/Builders/ShellContainerFactory.cs +++ b/src/OrchardCore/OrchardCore/Shell/Builders/ShellContainerFactory.cs @@ -79,7 +79,7 @@ public async Task CreateContainerAsync(ShellSettings settings, BindingFlags.Public | BindingFlags.Instance, null, CallingConventions.Any, - new Type[] { typeof(IServiceCollection) }, + [typeof(IServiceCollection)], null); var configureMethod = rawStartup.GetMethod( diff --git a/src/OrchardCore/OrchardCore/Shell/Builders/StartupBaseMock.cs b/src/OrchardCore/OrchardCore/Shell/Builders/StartupBaseMock.cs index ef54eea568c..0d371658049 100644 --- a/src/OrchardCore/OrchardCore/Shell/Builders/StartupBaseMock.cs +++ b/src/OrchardCore/OrchardCore/Shell/Builders/StartupBaseMock.cs @@ -45,7 +45,7 @@ public override void ConfigureServices(IServiceCollection services) return; } - _configureService.Invoke(_startup, new[] { services }); + _configureService.Invoke(_startup, [services]); } public override void Configure(IApplicationBuilder app, IEndpointRouteBuilder routes, IServiceProvider serviceProvider) diff --git a/test/OrchardCore.Tests/Extensions/ExtensionManagerTests.cs b/test/OrchardCore.Tests/Extensions/ExtensionManagerTests.cs index 4c29bc0f89d..1135d2f8872 100644 --- a/test/OrchardCore.Tests/Extensions/ExtensionManagerTests.cs +++ b/test/OrchardCore.Tests/Extensions/ExtensionManagerTests.cs @@ -13,10 +13,7 @@ private static readonly IHostEnvironment _hostingEnvironment = new StubHostingEnvironment(); private static readonly IApplicationContext _applicationContext - = new ModularApplicationContext(_hostingEnvironment, new List() - { - new ModuleNamesProvider() - }); + = new ModularApplicationContext(_hostingEnvironment, [new ModuleNamesProvider()]); private static readonly IFeaturesProvider _moduleFeatureProvider = new FeaturesProvider(new[] { new ThemeFeatureBuilderEvents() }); diff --git a/test/OrchardCore.Tests/Localization/CultureDictionaryTests.cs b/test/OrchardCore.Tests/Localization/CultureDictionaryTests.cs index 2683cb8ea87..245cb020eef 100644 --- a/test/OrchardCore.Tests/Localization/CultureDictionaryTests.cs +++ b/test/OrchardCore.Tests/Localization/CultureDictionaryTests.cs @@ -59,11 +59,11 @@ public void EnumerateCultureDictionary() { // Arrange var dictionary = new CultureDictionary("ar", PluralizationRule.Arabic); - dictionary.MergeTranslations(new List - { + dictionary.MergeTranslations( + [ new("Hello", "مرحبا"), new("Bye", "مع السلامة") - }); + ]); // Act & Assert Assert.NotEmpty(dictionary); diff --git a/test/OrchardCore.Tests/Localization/PortableObjectStringLocalizerTests.cs b/test/OrchardCore.Tests/Localization/PortableObjectStringLocalizerTests.cs index 0755bab0973..be361129d41 100644 --- a/test/OrchardCore.Tests/Localization/PortableObjectStringLocalizerTests.cs +++ b/test/OrchardCore.Tests/Localization/PortableObjectStringLocalizerTests.cs @@ -106,7 +106,7 @@ public void LocalizerReturnsTranslationWithSpecificContext() { SetupDictionary("cs", new[] { new CultureDictionaryRecord("ball", "míč", "míče", "míčů"), - new CultureDictionaryRecord("ball", "small", new [] { "míček", "míčky", "míčků" }) + new CultureDictionaryRecord("ball", "small", ["míček", "míčky", "míčků"]) }); var localizer = new PortableObjectStringLocalizer("small", _localizationManager.Object, true, _logger.Object); @@ -123,7 +123,7 @@ public void LocalizerReturnsTranslationWithoutContextIfTranslationWithContextDoe { SetupDictionary("cs", new[] { new CultureDictionaryRecord("ball", "míč", "míče", "míčů"), - new CultureDictionaryRecord("ball", "big", new [] { "míček", "míčky", "míčků" }) + new CultureDictionaryRecord("ball", "big", ["míček", "míčky", "míčků"]) }); var localizer = new PortableObjectStringLocalizer("small", _localizationManager.Object, true, _logger.Object); diff --git a/test/OrchardCore.Tests/Workflows/WorkflowManagerTests.cs b/test/OrchardCore.Tests/Workflows/WorkflowManagerTests.cs index 904a56659c5..0aa755b234b 100644 --- a/test/OrchardCore.Tests/Workflows/WorkflowManagerTests.cs +++ b/test/OrchardCore.Tests/Workflows/WorkflowManagerTests.cs @@ -31,8 +31,8 @@ public async Task CanExecuteSimpleWorkflow() { Id = 1, WorkflowTypeId = IdGenerator.GenerateId(), - Activities = new List - { + Activities = + [ new() { ActivityId = "1", IsStart = true, Name = addTask.Name, Properties = JObject.FromObject( new { A = new WorkflowExpression("input(\"A\")"), @@ -40,12 +40,12 @@ public async Task CanExecuteSimpleWorkflow() }) }, new() { ActivityId = "2", Name = writeLineTask.Name, Properties = JObject.FromObject( new { Text = new WorkflowExpression("lastResult().toString()") }) }, new() { ActivityId = "3", Name = setOutputTask.Name, Properties = JObject.FromObject( new { Value = new WorkflowExpression("lastResult()"), OutputName = "Sum" }) } - }, - Transitions = new List - { + ], + Transitions = + [ new() { SourceActivityId = "1", SourceOutcomeName = "Done", DestinationActivityId = "2" }, new() { SourceActivityId = "2", SourceOutcomeName = "Done", DestinationActivityId = "3" } - } + ] }; var workflowManager = CreateWorkflowManager(serviceProvider, new IActivity[] { addTask, writeLineTask, setOutputTask }, workflowType);