diff --git a/.github/workflows/check-updates.yml b/.github/workflows/check-updates.yml index cda5f0e69..fb20d60fd 100644 --- a/.github/workflows/check-updates.yml +++ b/.github/workflows/check-updates.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2.5.0 + - uses: actions/checkout@v3 with: token: ${{ secrets.WORKFLOW_SECRET }} diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index 0fbc67feb..45029b267 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2.5.0 + uses: actions/checkout@v3 - name: Inject slug/short variables uses: rlespinasse/github-slug-action@v4.3.2 @@ -25,7 +25,7 @@ jobs: env: BUILD_NUMBER: ${{ github.run_number }} run: | - echo "BUILD_NUMBER=$(($BUILD_NUMBER + 5967))" >> $GITHUB_ENV + echo "BUILD_NUMBER=$(($BUILD_NUMBER + 6000))" >> $GITHUB_ENV - name: Set up QEMU uses: docker/setup-qemu-action@v2.1.0 @@ -73,10 +73,10 @@ jobs: env: BUILD_NUMBER: ${{ github.run_number }} run: | - echo "BUILD_NUMBER=$(($BUILD_NUMBER + 5967))" >> $GITHUB_ENV + echo "BUILD_NUMBER=$(($BUILD_NUMBER + 6000))" >> $GITHUB_ENV - name: Checkout - uses: actions/checkout@v2.5.0 + uses: actions/checkout@v3 - name: Inject slug/short variables uses: rlespinasse/github-slug-action@v4.3.2 @@ -112,7 +112,7 @@ jobs: - name: RUN TEST uses: kohlerdominik/docker-run-action@v1.1.0 with: - image: squidex/build + image: squidex/build:7 environment: | CONFIG__BACKUPURL=http://localhost:5000 CONFIG__WAIT=60 @@ -126,7 +126,7 @@ jobs: - name: RUN TEST on path uses: kohlerdominik/docker-run-action@v1.1.0 with: - image: squidex/build + image: squidex/build:7 environment: | CONFIG__BACKUPURL=http://localhost:5000 CONFIG__WAIT=60 @@ -140,7 +140,7 @@ jobs: - name: RUN TEST with dedicated collections uses: kohlerdominik/docker-run-action@v1.1.0 with: - image: squidex/build + image: squidex/build:7 environment: | CONFIG__BACKUPURL=http://localhost:5000 CONFIG__WAIT=60 @@ -171,7 +171,7 @@ jobs: env: BUILD_NUMBER: ${{ github.run_number }} run: | - echo "BUILD_NUMBER=$(($BUILD_NUMBER + 5967))" >> $GITHUB_ENV + echo "BUILD_NUMBER=$(($BUILD_NUMBER + 6000))" >> $GITHUB_ENV - name: Inject slug/short variables uses: rlespinasse/github-slug-action@v4.3.2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8ce51c3ab..5bee6fcc6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2.5.0 + uses: actions/checkout@v3 - name: Inject slug/short variables uses: rlespinasse/github-slug-action@v4.3.2 @@ -59,7 +59,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2.5.0 + uses: actions/checkout@v3 - name: Inject slug/short variables uses: rlespinasse/github-slug-action@v4.3.2 @@ -95,7 +95,7 @@ jobs: - name: RUN TEST uses: kohlerdominik/docker-run-action@v1.1.0 with: - image: squidex/build + image: squidex/build:7 environment: | CONFIG__BACKUPURL=http://localhost:5000 CONFIG__WAIT=60 @@ -109,7 +109,7 @@ jobs: - name: RUN TEST on path uses: kohlerdominik/docker-run-action@v1.1.0 with: - image: squidex/build + image: squidex/build:7 environment: | CONFIG__BACKUPURL=http://localhost:5000 CONFIG__WAIT=60 @@ -123,7 +123,7 @@ jobs: - name: RUN TEST with dedicated collections uses: kohlerdominik/docker-run-action@v1.1.0 with: - image: squidex/build + image: squidex/build:7 environment: | CONFIG__BACKUPURL=http://localhost:5000 CONFIG__WAIT=60 @@ -204,7 +204,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2.5.0 + uses: actions/checkout@v3 - name: Inject slug/short variables uses: rlespinasse/github-slug-action@v4.3.2 diff --git a/CHANGELOG.md b/CHANGELOG.md index c7116b3cc..6f454bb7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [7.3.0] - 2022-18-11 + +This version is all about the Update to .NET 7. If you host Squidex with Containers, e.g. with Docker Compose, Kubernetes or Managed Containers nothing changes. But if you host Squidex yourself in IIS or Linux, you have to ensure that you use the latest runtime. + +### Changed + +* **Runtime**: Migration to .NET 7 +* **API**: New system how to manage type names, e.g. for field types, rule actions and so on, with the goal to improve serialization performance. + ## [7.2.0] - 2022-11-11 ### Fixed diff --git a/Dockerfile b/Dockerfile index 23a5f38fe..7a3d1af0b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # # Stage 1, Build Backend # -FROM mcr.microsoft.com/dotnet/sdk:6.0 as backend +FROM mcr.microsoft.com/dotnet/sdk:7.0 as backend ARG SQUIDEX__VERSION=7.0.0 @@ -68,7 +68,7 @@ RUN cp -a build /build/ # # Stage 3, Build runtime # -FROM mcr.microsoft.com/dotnet/aspnet:6.0.10-bullseye-slim +FROM mcr.microsoft.com/dotnet/aspnet:7.0-bullseye-slim # Curl for debugging and libc-dev for protobuf RUN apt-get update \ diff --git a/backend/.editorconfig b/backend/.editorconfig index 81fc8479e..f88bc259f 100644 --- a/backend/.editorconfig +++ b/backend/.editorconfig @@ -13,6 +13,8 @@ insert_final_newline = true indent_style = space indent_size = 4 +csharp_style_namespace_declarations = file_scoped + # FAILING ANALYZERS dotnet_diagnostic.RECS0002.severity = none dotnet_diagnostic.RECS0117.severity = none @@ -166,5 +168,8 @@ dotnet_diagnostic.SA1601.severity = none # SA1602: Enumeration items should be documented dotnet_diagnostic.SA1602.severity = none +# SA1615: Element return value should be documented +dotnet_diagnostic.SA1615.severity = none + # SA1623: Property summary documentation should match accessors dotnet_diagnostic.SA1623.severity = none \ No newline at end of file diff --git a/backend/extensions/Squidex.Extensions/Squidex.Extensions.csproj b/backend/extensions/Squidex.Extensions/Squidex.Extensions.csproj index 7c9d06d7d..f0915c5cf 100644 --- a/backend/extensions/Squidex.Extensions/Squidex.Extensions.csproj +++ b/backend/extensions/Squidex.Extensions/Squidex.Extensions.csproj @@ -1,6 +1,6 @@  - net6.0 + net7.0 10.0 enable @@ -9,29 +9,29 @@ - + - + - + - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - + + + + + + + + diff --git a/backend/i18n/translator/Squidex.Translator/Squidex.Translator.csproj b/backend/i18n/translator/Squidex.Translator/Squidex.Translator.csproj index d576b81dd..175da3681 100644 --- a/backend/i18n/translator/Squidex.Translator/Squidex.Translator.csproj +++ b/backend/i18n/translator/Squidex.Translator/Squidex.Translator.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net7.0 10.0 enable NU1608 diff --git a/backend/src/Migrations/Migrations.csproj b/backend/src/Migrations/Migrations.csproj index e7223472d..4b2be9ff4 100644 --- a/backend/src/Migrations/Migrations.csproj +++ b/backend/src/Migrations/Migrations.csproj @@ -1,12 +1,12 @@  - net6.0 + net7.0 10.0 enable enable - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldTypeProvider.cs b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldTypeProvider.cs index 0e7e3a2b6..a9f5f53d7 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldTypeProvider.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Schemas/FieldTypeProvider.cs @@ -14,19 +14,17 @@ public class FieldTypeProvider : ITypeProvider private const string Suffix = "Properties"; private const string SuffixOld = "FieldProperties"; - public void Map(TypeNameRegistry typeNameRegistry) + public void Map(TypeRegistry typeRegistry) { - var types = typeof(FieldTypeProvider).Assembly.GetTypes().Where(x => typeof(FieldProperties).IsAssignableFrom(x) && !x.IsAbstract); - - var addedTypes = new HashSet(); + static IEnumerable FindTypes(Type baseType) + { + return baseType.Assembly.GetTypes().Where(x => baseType.IsAssignableFrom(x) && !x.IsAbstract); + } - foreach (var type in types) + foreach (var type in FindTypes(typeof(FieldProperties))) { - if (addedTypes.Add(type)) - { - typeNameRegistry.Map(type, type.TypeName(false, Suffix)); - typeNameRegistry.MapObsolete(type, type.TypeName(false, SuffixOld)); - } + typeRegistry.Add(type, type.TypeName(false, SuffixOld)); + typeRegistry.Add(type, type.TypeName(false, Suffix)); } } } diff --git a/backend/src/Squidex.Domain.Apps.Core.Model/Squidex.Domain.Apps.Core.Model.csproj b/backend/src/Squidex.Domain.Apps.Core.Model/Squidex.Domain.Apps.Core.Model.csproj index efc400447..0362b100b 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Model/Squidex.Domain.Apps.Core.Model.csproj +++ b/backend/src/Squidex.Domain.Apps.Core.Model/Squidex.Domain.Apps.Core.Model.csproj @@ -1,6 +1,6 @@  - net6.0 + net7.0 Squidex.Domain.Apps.Core 10.0 enable @@ -12,15 +12,15 @@ True - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + - + diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleService.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleService.cs index 42801fcea..f1a0af6bd 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleService.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleService.cs @@ -24,7 +24,7 @@ public sealed class RuleService : IRuleService { private readonly Dictionary ruleActionHandlers; private readonly Dictionary ruleTriggerHandlers; - private readonly TypeNameRegistry typeNameRegistry; + private readonly TypeRegistry typeRegistry; private readonly RuleOptions ruleOptions; private readonly IEventEnricher eventEnricher; private readonly IJsonSerializer serializer; @@ -39,9 +39,9 @@ public sealed class RuleService : IRuleService IEventEnricher eventEnricher, IJsonSerializer serializer, ILogger log, - TypeNameRegistry typeNameRegistry) + TypeRegistry typeRegistry) { - this.typeNameRegistry = typeNameRegistry; + this.typeRegistry = typeRegistry; this.eventEnricher = eventEnricher; this.ruleOptions = ruleOptions.Value; this.ruleTriggerHandlers = ruleTriggerHandlers.ToDictionary(x => x.TriggerType); @@ -295,7 +295,8 @@ public sealed class RuleService : IRuleService private async Task CreateJobAsync(IRuleActionHandler actionHandler, EnrichedEvent enrichedEvent, RuleContext context, Instant now) { - var actionName = typeNameRegistry.GetName(context.Rule.Action.GetType()); + var actionType = context.Rule.Action.GetType(); + var actionName = typeRegistry.GetName(actionType); var expires = now.Plus(Constants.ExpirationTime); @@ -359,17 +360,16 @@ public sealed class RuleService : IRuleService try { - var actionType = typeNameRegistry.GetType(actionName); + var actionType = typeRegistry.GetType(actionName); var actionHandler = ruleActionHandlers[actionType]; - - var deserialized = serializer.Deserialize(job, actionHandler.DataType); + var actionObject = serializer.Deserialize(job, actionHandler.DataType); using (var combined = CancellationTokenSource.CreateLinkedTokenSource(ct)) { // Enforce a timeout after a configured time span. combined.CancelAfter(GetTimeoutInMs()); - result = await actionHandler.ExecuteJobAsync(deserialized, combined.Token).WithCancellation(combined.Token); + result = await actionHandler.ExecuteJobAsync(actionObject, combined.Token).WithCancellation(combined.Token); } } catch (Exception ex) diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleTypeProvider.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleTypeProvider.cs index 538968ef1..a8b2b09b2 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleTypeProvider.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/RuleTypeProvider.cs @@ -206,34 +206,17 @@ public sealed class RuleTypeProvider : ITypeProvider return type.TypeName(false, ActionSuffix, ActionSuffixV2); } - public void Map(TypeNameRegistry typeNameRegistry) + public void Map(TypeRegistry typeRegistry) { - foreach (var (_, actionType) in actionTypes) - { - typeNameRegistry.Map(actionType.Type, actionType.Type.Name); - } - - var addedTypes = new HashSet(); - - static IEnumerable FindTypes(Type baseType) - { - return baseType.Assembly.GetTypes().Where(x => baseType.IsAssignableFrom(x) && !x.IsAbstract); - } + typeRegistry.Discriminator("actionType"); - foreach (var type in FindTypes(typeof(EnrichedEvent))) + foreach (var (name, actionType) in actionTypes) { - if (addedTypes.Add(type)) - { - typeNameRegistry.Map(type, type.Name); - } + typeRegistry.Add(actionType.Type, actionType.Type.Name); + typeRegistry.Add(actionType.Type, name); } - foreach (var type in FindTypes(typeof(RuleTrigger))) - { - if (addedTypes.Add(type)) - { - typeNameRegistry.Map(type, type.Name); - } - } + typeRegistry.Map(new AssemblyTypeProvider()); + typeRegistry.Map(new AssemblyTypeProvider("triggerType")); } } diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/Internal/Parser.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/Internal/Parser.cs index c4d6bf8b9..3852780ad 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/Internal/Parser.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/Internal/Parser.cs @@ -37,6 +37,6 @@ internal sealed class Parser var parser = new JavaScriptParser(script, DefaultParserOptions); return parser.ParseScript(); - }); + })!; } } diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/Squidex.Domain.Apps.Core.Operations.csproj b/backend/src/Squidex.Domain.Apps.Core.Operations/Squidex.Domain.Apps.Core.Operations.csproj index b0b4bf921..b95ea946c 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/Squidex.Domain.Apps.Core.Operations.csproj +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/Squidex.Domain.Apps.Core.Operations.csproj @@ -1,6 +1,6 @@  - net6.0 + net7.0 Squidex.Domain.Apps.Core 10.0 enable @@ -21,16 +21,16 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + - + - + diff --git a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Squidex.Domain.Apps.Entities.MongoDb.csproj b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Squidex.Domain.Apps.Entities.MongoDb.csproj index 3dd9668eb..887ac93f4 100644 --- a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Squidex.Domain.Apps.Entities.MongoDb.csproj +++ b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Squidex.Domain.Apps.Entities.MongoDb.csproj @@ -1,6 +1,6 @@  - net6.0 + net7.0 10.0 enable enable @@ -19,11 +19,11 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/AppHistoryEventsCreator.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/AppHistoryEventsCreator.cs index 44ef93b3e..78e2344de 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/AppHistoryEventsCreator.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/AppHistoryEventsCreator.cs @@ -15,8 +15,8 @@ namespace Squidex.Domain.Apps.Entities.Apps; public sealed class AppHistoryEventsCreator : HistoryEventsCreatorBase { - public AppHistoryEventsCreator(TypeNameRegistry typeNameRegistry) - : base(typeNameRegistry) + public AppHistoryEventsCreator(TypeRegistry typeRegistry) + : base(typeRegistry) { AddEventMessage( "history.apps.created"); diff --git a/backend/src/Squidex.Domain.Apps.Entities/Apps/AppPermanentDeleter.cs b/backend/src/Squidex.Domain.Apps.Entities/Apps/AppPermanentDeleter.cs index 673a88bc7..7a2b689e7 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Apps/AppPermanentDeleter.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Apps/AppPermanentDeleter.cs @@ -30,7 +30,7 @@ public sealed class AppPermanentDeleter : IEventConsumer get => "^app-"; } - public AppPermanentDeleter(IEnumerable deleters, IDomainObjectFactory factory, TypeNameRegistry typeNameRegistry) + public AppPermanentDeleter(IEnumerable deleters, IDomainObjectFactory factory, TypeRegistry typeRegistry) { this.deleters = deleters.OrderBy(x => x.Order).ToList(); this.factory = factory; @@ -38,8 +38,8 @@ public sealed class AppPermanentDeleter : IEventConsumer // Compute the event types names once for performance reasons and use hashset for extensibility. consumingTypes = new HashSet { - typeNameRegistry.GetName(), - typeNameRegistry.GetName() + typeRegistry.GetName(), + typeRegistry.GetName() }; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetHistoryEventsCreator.cs b/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetHistoryEventsCreator.cs index 19bb2d4a1..df38b6366 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetHistoryEventsCreator.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetHistoryEventsCreator.cs @@ -14,8 +14,8 @@ namespace Squidex.Domain.Apps.Entities.Assets; public sealed class AssetHistoryEventsCreator : HistoryEventsCreatorBase { - public AssetHistoryEventsCreator(TypeNameRegistry typeNameRegistry) - : base(typeNameRegistry) + public AssetHistoryEventsCreator(TypeRegistry typeRegistry) + : base(typeRegistry) { AddEventMessage( "history.assets.uploaded"); diff --git a/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetPermanentDeleter.cs b/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetPermanentDeleter.cs index 1343d54e3..0ca13dc5b 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetPermanentDeleter.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetPermanentDeleter.cs @@ -27,14 +27,14 @@ public sealed class AssetPermanentDeleter : IEventConsumer get => "^asset-"; } - public AssetPermanentDeleter(IAssetFileStore assetFileStore, TypeNameRegistry typeNameRegistry) + public AssetPermanentDeleter(IAssetFileStore assetFileStore, TypeRegistry typeRegistry) { this.assetFileStore = assetFileStore; // Compute the event types names once for performance reasons and use hashset for extensibility. consumingTypes = new HashSet { - typeNameRegistry.GetName() + typeRegistry.GetName() }; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetUsageTracker_EventHandling.cs b/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetUsageTracker_EventHandling.cs index 4e8629cc0..9f21c832f 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetUsageTracker_EventHandling.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Assets/AssetUsageTracker_EventHandling.cs @@ -157,7 +157,7 @@ public partial class AssetUsageTracker : IEventConsumer // Store the latest tags in memory for fast access. if (memoryCache.TryGetValue(key, out var state)) { - return state.Tags; + return state?.Tags; } var stored = await store.ReadAsync(key, ct); diff --git a/backend/src/Squidex.Domain.Apps.Entities/Assets/RecursiveDeleter.cs b/backend/src/Squidex.Domain.Apps.Entities/Assets/RecursiveDeleter.cs index a38b43c4a..1ec6fa155 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Assets/RecursiveDeleter.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Assets/RecursiveDeleter.cs @@ -37,7 +37,7 @@ public sealed class RecursiveDeleter : IEventConsumer ICommandBus commandBus, IAssetRepository assetRepository, IAssetFolderRepository assetFolderRepository, - TypeNameRegistry typeNameRegistry, + TypeRegistry typeRegistry, ILogger log) { this.commandBus = commandBus; @@ -49,7 +49,7 @@ public sealed class RecursiveDeleter : IEventConsumer // Compute the event types names once for performance reasons and use hashset for extensibility. consumingTypes = new HashSet { - typeNameRegistry.GetName() + typeRegistry.GetName() }; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/ContentHistoryEventsCreator.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/ContentHistoryEventsCreator.cs index 070cac44d..911c4bbd9 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/ContentHistoryEventsCreator.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/ContentHistoryEventsCreator.cs @@ -15,8 +15,8 @@ namespace Squidex.Domain.Apps.Entities.Contents; public sealed class ContentHistoryEventsCreator : HistoryEventsCreatorBase { - public ContentHistoryEventsCreator(TypeNameRegistry typeNameRegistry) - : base(typeNameRegistry) + public ContentHistoryEventsCreator(TypeRegistry typeRegistry) + : base(typeRegistry) { AddEventMessage( "history.contents.created"); diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/ContentQueryParser.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/ContentQueryParser.cs index 0a1c1bb85..821b2a81f 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/ContentQueryParser.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/Queries/ContentQueryParser.cs @@ -230,7 +230,7 @@ public class ContentQueryParser entry.AbsoluteExpirationRelativeToNow = CacheTime; return ContentQueryModel.Build(schema?.SchemaDef, context.App.PartitionResolver(), components); - }); + })!; return result; } @@ -245,7 +245,7 @@ public class ContentQueryParser entry.AbsoluteExpirationRelativeToNow = CacheTime; return BuildQueryModel(context, schema, components).ConvertToEdm("Contents", schema?.SchemaDef.Name ?? "Generic"); - }); + })!; return result; } diff --git a/backend/src/Squidex.Domain.Apps.Entities/History/HistoryEventsCreatorBase.cs b/backend/src/Squidex.Domain.Apps.Entities/History/HistoryEventsCreatorBase.cs index b5168cb0c..aceb8cda3 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/History/HistoryEventsCreatorBase.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/History/HistoryEventsCreatorBase.cs @@ -14,37 +14,37 @@ namespace Squidex.Domain.Apps.Entities.History; public abstract class HistoryEventsCreatorBase : IHistoryEventsCreator { private readonly Dictionary texts = new Dictionary(); - private readonly TypeNameRegistry typeNameRegistry; + private readonly TypeRegistry typeRegistry; public IReadOnlyDictionary Texts { get => texts; } - protected HistoryEventsCreatorBase(TypeNameRegistry typeNameRegistry) + protected HistoryEventsCreatorBase(TypeRegistry typeRegistry) { - Guard.NotNull(typeNameRegistry); + Guard.NotNull(typeRegistry); - this.typeNameRegistry = typeNameRegistry; + this.typeRegistry = typeRegistry; } protected void AddEventMessage(string message) where TEvent : IEvent { Guard.NotNullOrEmpty(message); - texts[typeNameRegistry.GetName()] = message; + texts[typeRegistry.GetName()] = message; } protected bool HasEventText(IEvent @event) { - var message = typeNameRegistry.GetName(@event.GetType()); + var message = typeRegistry.GetName(@event.GetType()); return texts.ContainsKey(message); } protected HistoryEvent ForEvent(IEvent @event, string channel) { - var message = typeNameRegistry.GetName(@event.GetType()); + var message = typeRegistry.GetName(@event.GetType()); return new HistoryEvent(channel, message); } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Rules/RuleEnqueuer.cs b/backend/src/Squidex.Domain.Apps.Entities/Rules/RuleEnqueuer.cs index e902099f1..9afaaff40 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Rules/RuleEnqueuer.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Rules/RuleEnqueuer.cs @@ -111,6 +111,6 @@ public sealed class RuleEnqueuer : IEventConsumer, IRuleEnqueuer entry.AbsoluteExpirationRelativeToNow = cacheDuration; return appProvider.GetRulesAsync(appId); - }); + })!; } } diff --git a/backend/src/Squidex.Domain.Apps.Entities/Schemas/SchemaHistoryEventsCreator.cs b/backend/src/Squidex.Domain.Apps.Entities/Schemas/SchemaHistoryEventsCreator.cs index faaa02fb7..45a019644 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Schemas/SchemaHistoryEventsCreator.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Schemas/SchemaHistoryEventsCreator.cs @@ -15,8 +15,8 @@ namespace Squidex.Domain.Apps.Entities.Schemas; public sealed class SchemaHistoryEventsCreator : HistoryEventsCreatorBase { - public SchemaHistoryEventsCreator(TypeNameRegistry typeNameRegistry) - : base(typeNameRegistry) + public SchemaHistoryEventsCreator(TypeRegistry typeRegistry) + : base(typeRegistry) { AddEventMessage( "history.schemas.fieldsReordered"); diff --git a/backend/src/Squidex.Domain.Apps.Entities/Squidex.Domain.Apps.Entities.csproj b/backend/src/Squidex.Domain.Apps.Entities/Squidex.Domain.Apps.Entities.csproj index c526b4b92..880500791 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Squidex.Domain.Apps.Entities.csproj +++ b/backend/src/Squidex.Domain.Apps.Entities/Squidex.Domain.Apps.Entities.csproj @@ -1,6 +1,6 @@  - net6.0 + net7.0 10.0 enable en @@ -22,19 +22,19 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + - + - + diff --git a/backend/src/Squidex.Domain.Apps.Entities/Teams/TeamHistoryEventsCreator.cs b/backend/src/Squidex.Domain.Apps.Entities/Teams/TeamHistoryEventsCreator.cs index b4191fd94..276a80909 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Teams/TeamHistoryEventsCreator.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Teams/TeamHistoryEventsCreator.cs @@ -14,8 +14,8 @@ namespace Squidex.Domain.Teams.Entities.Teams; public sealed class TeamHistoryEventsCreator : HistoryEventsCreatorBase { - public TeamHistoryEventsCreator(TypeNameRegistry typeNameRegistry) - : base(typeNameRegistry) + public TeamHistoryEventsCreator(TypeRegistry typeRegistry) + : base(typeRegistry) { AddEventMessage( "history.teams.created"); diff --git a/backend/src/Squidex.Domain.Apps.Events/Squidex.Domain.Apps.Events.csproj b/backend/src/Squidex.Domain.Apps.Events/Squidex.Domain.Apps.Events.csproj index ec123723c..811858a8d 100644 --- a/backend/src/Squidex.Domain.Apps.Events/Squidex.Domain.Apps.Events.csproj +++ b/backend/src/Squidex.Domain.Apps.Events/Squidex.Domain.Apps.Events.csproj @@ -1,6 +1,6 @@  - net6.0 + net7.0 10.0 enable enable @@ -14,7 +14,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/backend/src/Squidex.Domain.Users.MongoDb/MongoRoleStore.cs b/backend/src/Squidex.Domain.Users.MongoDb/MongoRoleStore.cs index 7e3ddd721..a72e769de 100644 --- a/backend/src/Squidex.Domain.Users.MongoDb/MongoRoleStore.cs +++ b/backend/src/Squidex.Domain.Users.MongoDb/MongoRoleStore.cs @@ -62,13 +62,13 @@ public sealed class MongoRoleStore : MongoRepositoryBase, IRoleSto { } - public async Task FindByIdAsync(string roleId, + public async Task FindByIdAsync(string roleId, CancellationToken cancellationToken) { return await Collection.Find(x => x.Id == roleId).FirstOrDefaultAsync(cancellationToken); } - public async Task FindByNameAsync(string normalizedRoleName, + public async Task FindByNameAsync(string normalizedRoleName, CancellationToken cancellationToken) { return await Collection.Find(x => x.NormalizedName == normalizedRoleName).FirstOrDefaultAsync(cancellationToken); @@ -104,19 +104,19 @@ public sealed class MongoRoleStore : MongoRepositoryBase, IRoleSto return Task.FromResult(role.Id); } - public Task GetRoleNameAsync(IdentityRole role, + public Task GetRoleNameAsync(IdentityRole role, CancellationToken cancellationToken) { return Task.FromResult(role.Name); } - public Task GetNormalizedRoleNameAsync(IdentityRole role, + public Task GetNormalizedRoleNameAsync(IdentityRole role, CancellationToken cancellationToken) { return Task.FromResult(role.NormalizedName); } - public Task SetRoleNameAsync(IdentityRole role, string roleName, + public Task SetRoleNameAsync(IdentityRole role, string? roleName, CancellationToken cancellationToken) { role.Name = roleName; @@ -124,7 +124,7 @@ public sealed class MongoRoleStore : MongoRepositoryBase, IRoleSto return Task.CompletedTask; } - public Task SetNormalizedRoleNameAsync(IdentityRole role, string normalizedName, + public Task SetNormalizedRoleNameAsync(IdentityRole role, string? normalizedName, CancellationToken cancellationToken) { role.NormalizedName = normalizedName; diff --git a/backend/src/Squidex.Domain.Users.MongoDb/MongoUser.cs b/backend/src/Squidex.Domain.Users.MongoDb/MongoUser.cs index 3b1381f5f..d4538832b 100644 --- a/backend/src/Squidex.Domain.Users.MongoDb/MongoUser.cs +++ b/backend/src/Squidex.Domain.Users.MongoDb/MongoUser.cs @@ -87,18 +87,24 @@ public sealed class MongoUser : IdentityUser claims.Foreach(RemoveClaim); } - internal void ReplaceClaim(Claim existingClaim, Claim newClaim) + internal void ReplaceClaim(Claim existingClaim, Claim? newClaim) { RemoveClaim(existingClaim); - AddClaim(newClaim); + if (newClaim != null) + { + AddClaim(newClaim); + } } - internal void ReplaceToken(string provider, string name, string value) + internal void ReplaceToken(string provider, string name, string? value) { RemoveToken(provider, name); - AddToken(provider, name, value); + if (value != null) + { + AddToken(provider, name, value); + } } } diff --git a/backend/src/Squidex.Domain.Users.MongoDb/MongoUserStore.cs b/backend/src/Squidex.Domain.Users.MongoDb/MongoUserStore.cs index c90f92e5f..efccb0c17 100644 --- a/backend/src/Squidex.Domain.Users.MongoDb/MongoUserStore.cs +++ b/backend/src/Squidex.Domain.Users.MongoDb/MongoUserStore.cs @@ -183,18 +183,15 @@ public sealed class MongoUserStore : return new MongoUser { Email = email, UserName = email }; } - public async Task FindByIdAsync(string userId, + public async Task FindByIdAsync(string userId, CancellationToken cancellationToken) { - if (!IsId(userId)) - { - return null!; - } + var result = await Collection.Find(x => x.Id == userId).FirstOrDefaultAsync(cancellationToken); - return await Collection.Find(x => x.Id == userId).FirstOrDefaultAsync(cancellationToken); + return result; } - public async Task FindByEmailAsync(string normalizedEmail, + public async Task FindByEmailAsync(string normalizedEmail, CancellationToken cancellationToken) { var result = await Collection.Find(x => x.NormalizedEmail == normalizedEmail).FirstOrDefaultAsync(cancellationToken); @@ -202,7 +199,7 @@ public sealed class MongoUserStore : return result; } - public async Task FindByNameAsync(string normalizedUserName, + public async Task FindByNameAsync(string normalizedUserName, CancellationToken cancellationToken) { var result = await Collection.Find(x => x.NormalizedEmail == normalizedUserName).FirstOrDefaultAsync(cancellationToken); @@ -210,7 +207,7 @@ public sealed class MongoUserStore : return result; } - public async Task FindByLoginAsync(string loginProvider, string providerKey, + public async Task FindByLoginAsync(string loginProvider, string providerKey, CancellationToken cancellationToken) { var result = await Collection.Find(x => x.Logins.Any(y => y.LoginProvider == loginProvider && y.ProviderKey == providerKey)).FirstOrDefaultAsync(cancellationToken); @@ -268,7 +265,7 @@ public sealed class MongoUserStore : return Task.FromResult(result); } - public Task GetUserNameAsync(IdentityUser user, + public Task GetUserNameAsync(IdentityUser user, CancellationToken cancellationToken) { var result = user.UserName; @@ -276,7 +273,7 @@ public sealed class MongoUserStore : return Task.FromResult(result); } - public Task GetNormalizedUserNameAsync(IdentityUser user, + public Task GetNormalizedUserNameAsync(IdentityUser user, CancellationToken cancellationToken) { var result = user.NormalizedUserName; @@ -284,7 +281,7 @@ public sealed class MongoUserStore : return Task.FromResult(result); } - public Task GetPasswordHashAsync(IdentityUser user, + public Task GetPasswordHashAsync(IdentityUser user, CancellationToken cancellationToken) { var result = user.PasswordHash; @@ -316,7 +313,7 @@ public sealed class MongoUserStore : return Task.FromResult>(result); } - public Task GetSecurityStampAsync(IdentityUser user, + public Task GetSecurityStampAsync(IdentityUser user, CancellationToken cancellationToken) { var result = user.SecurityStamp; @@ -324,7 +321,7 @@ public sealed class MongoUserStore : return Task.FromResult(result); } - public Task GetEmailAsync(IdentityUser user, + public Task GetEmailAsync(IdentityUser user, CancellationToken cancellationToken) { var result = user.Email; @@ -340,7 +337,7 @@ public sealed class MongoUserStore : return Task.FromResult(result); } - public Task GetNormalizedEmailAsync(IdentityUser user, + public Task GetNormalizedEmailAsync(IdentityUser user, CancellationToken cancellationToken) { var result = user.NormalizedEmail; @@ -356,7 +353,7 @@ public sealed class MongoUserStore : return Task.FromResult>(result); } - public Task GetPhoneNumberAsync(IdentityUser user, + public Task GetPhoneNumberAsync(IdentityUser user, CancellationToken cancellationToken) { var result = user.PhoneNumber; @@ -404,20 +401,20 @@ public sealed class MongoUserStore : return Task.FromResult(result); } - public Task GetTokenAsync(IdentityUser user, string loginProvider, string name, + public Task GetTokenAsync(IdentityUser user, string loginProvider, string name, CancellationToken cancellationToken) { var result = ((MongoUser)user).GetToken(loginProvider, name)!; - return Task.FromResult(result); + return Task.FromResult(result); } - public Task GetAuthenticatorKeyAsync(IdentityUser user, + public Task GetAuthenticatorKeyAsync(IdentityUser user, CancellationToken cancellationToken) { var result = ((MongoUser)user).GetToken(InternalLoginProvider, AuthenticatorKeyTokenName)!; - return Task.FromResult(result); + return Task.FromResult(result); } public Task HasPasswordAsync(IdentityUser user, @@ -436,7 +433,7 @@ public sealed class MongoUserStore : return Task.FromResult(result); } - public Task SetUserNameAsync(IdentityUser user, string userName, + public Task SetUserNameAsync(IdentityUser user, string? userName, CancellationToken cancellationToken) { ((MongoUser)user).UserName = userName; @@ -444,7 +441,7 @@ public sealed class MongoUserStore : return Task.CompletedTask; } - public Task SetNormalizedUserNameAsync(IdentityUser user, string normalizedName, + public Task SetNormalizedUserNameAsync(IdentityUser user, string? normalizedName, CancellationToken cancellationToken) { ((MongoUser)user).NormalizedUserName = normalizedName; @@ -452,7 +449,7 @@ public sealed class MongoUserStore : return Task.CompletedTask; } - public Task SetPasswordHashAsync(IdentityUser user, string passwordHash, + public Task SetPasswordHashAsync(IdentityUser user, string? passwordHash, CancellationToken cancellationToken) { ((MongoUser)user).PasswordHash = passwordHash; @@ -500,7 +497,7 @@ public sealed class MongoUserStore : return Task.CompletedTask; } - public Task SetEmailAsync(IdentityUser user, string email, + public Task SetEmailAsync(IdentityUser user, string? email, CancellationToken cancellationToken) { ((MongoUser)user).Email = email; @@ -516,7 +513,7 @@ public sealed class MongoUserStore : return Task.CompletedTask; } - public Task SetNormalizedEmailAsync(IdentityUser user, string normalizedEmail, + public Task SetNormalizedEmailAsync(IdentityUser user, string? normalizedEmail, CancellationToken cancellationToken) { ((MongoUser)user).NormalizedEmail = normalizedEmail; @@ -548,7 +545,7 @@ public sealed class MongoUserStore : return Task.CompletedTask; } - public Task SetPhoneNumberAsync(IdentityUser user, string phoneNumber, + public Task SetPhoneNumberAsync(IdentityUser user, string? phoneNumber, CancellationToken cancellationToken) { ((MongoUser)user).PhoneNumber = phoneNumber; @@ -604,7 +601,7 @@ public sealed class MongoUserStore : return Task.CompletedTask; } - public Task SetTokenAsync(IdentityUser user, string loginProvider, string name, string value, + public Task SetTokenAsync(IdentityUser user, string loginProvider, string name, string? value, CancellationToken cancellationToken) { ((MongoUser)user).ReplaceToken(loginProvider, name, value); diff --git a/backend/src/Squidex.Domain.Users.MongoDb/Squidex.Domain.Users.MongoDb.csproj b/backend/src/Squidex.Domain.Users.MongoDb/Squidex.Domain.Users.MongoDb.csproj index 30e7febdc..baec6968d 100644 --- a/backend/src/Squidex.Domain.Users.MongoDb/Squidex.Domain.Users.MongoDb.csproj +++ b/backend/src/Squidex.Domain.Users.MongoDb/Squidex.Domain.Users.MongoDb.csproj @@ -1,6 +1,6 @@  - net6.0 + net7.0 10.0 enable enable @@ -19,12 +19,12 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/backend/src/Squidex.Domain.Users/DefaultUserService.cs b/backend/src/Squidex.Domain.Users/DefaultUserService.cs index 10f4afe8e..1e2c9b722 100644 --- a/backend/src/Squidex.Domain.Users/DefaultUserService.cs +++ b/backend/src/Squidex.Domain.Users/DefaultUserService.cs @@ -46,7 +46,7 @@ public sealed class DefaultUserService : IUserService { Guard.NotNull(user); - return userManager.GetUserId(user); + return userManager.GetUserId(user)!; } public async Task> QueryAsync(IEnumerable ids, @@ -82,7 +82,7 @@ public sealed class DefaultUserService : IUserService { var normalizedEmail = userManager.NormalizeEmail(email); - result = result.Where(x => x.NormalizedEmail.Contains(normalizedEmail)); + result = result.Where(x => x.NormalizedEmail!.Contains(normalizedEmail)); } return result; @@ -387,7 +387,7 @@ public sealed class DefaultUserService : IUserService if (!claims.Any(x => string.Equals(x.Type, SquidexClaimTypes.DisplayName, StringComparison.OrdinalIgnoreCase))) { - claims.Add(new Claim(SquidexClaimTypes.DisplayName, user.Email)); + claims.Add(new Claim(SquidexClaimTypes.DisplayName, user.Email!)); } return new UserWithClaims(user, claims.ToList()); diff --git a/backend/src/Squidex.Domain.Users/Squidex.Domain.Users.csproj b/backend/src/Squidex.Domain.Users/Squidex.Domain.Users.csproj index 7120aac55..d5bcbc439 100644 --- a/backend/src/Squidex.Domain.Users/Squidex.Domain.Users.csproj +++ b/backend/src/Squidex.Domain.Users/Squidex.Domain.Users.csproj @@ -1,6 +1,6 @@  - net6.0 + net7.0 10.0 enable enable @@ -18,11 +18,11 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/backend/src/Squidex.Domain.Users/UserClaimsPrincipalFactoryWithEmail.cs b/backend/src/Squidex.Domain.Users/UserClaimsPrincipalFactoryWithEmail.cs index 57ba07304..ae95e298d 100644 --- a/backend/src/Squidex.Domain.Users/UserClaimsPrincipalFactoryWithEmail.cs +++ b/backend/src/Squidex.Domain.Users/UserClaimsPrincipalFactoryWithEmail.cs @@ -25,17 +25,21 @@ public sealed class UserClaimsPrincipalFactoryWithEmail : UserClaimsPrincipalFac public override async Task CreateAsync(IdentityUser user) { - var principal = await base.CreateAsync(user); + var userPrincipal = await base.CreateAsync(user); + var userIdentity = userPrincipal.Identities.First(); - var identity = principal.Identities.First(); + var email = await UserManager.GetEmailAsync(user); - identity.AddClaim(new Claim(OpenIdClaims.Email, await UserManager.GetEmailAsync(user))); + if (email != null) + { + userIdentity.AddClaim(new Claim(OpenIdClaims.Email, email)); + } if (await UserManager.IsInRoleAsync(user, AdministratorRole)) { - identity.AddClaim(new Claim(SquidexClaimTypes.Permissions, PermissionIds.Admin)); + userIdentity.AddClaim(new Claim(SquidexClaimTypes.Permissions, PermissionIds.Admin)); } - return principal; + return userPrincipal; } } diff --git a/backend/src/Squidex.Domain.Users/UserWithClaims.cs b/backend/src/Squidex.Domain.Users/UserWithClaims.cs index 045c9f897..8f6dd6a23 100644 --- a/backend/src/Squidex.Domain.Users/UserWithClaims.cs +++ b/backend/src/Squidex.Domain.Users/UserWithClaims.cs @@ -22,7 +22,7 @@ internal sealed class UserWithClaims : IUser public string Email { - get => Identity.Email; + get => Identity.Email!; } public bool IsLocked diff --git a/backend/src/Squidex.Infrastructure.Azure/Squidex.Infrastructure.Azure.csproj b/backend/src/Squidex.Infrastructure.Azure/Squidex.Infrastructure.Azure.csproj index eb3095b91..a66abd4df 100644 --- a/backend/src/Squidex.Infrastructure.Azure/Squidex.Infrastructure.Azure.csproj +++ b/backend/src/Squidex.Infrastructure.Azure/Squidex.Infrastructure.Azure.csproj @@ -1,6 +1,6 @@  - net6.0 + net7.0 Squidex.Infrastructure 10.0 enable diff --git a/backend/src/Squidex.Infrastructure.GetEventStore/Squidex.Infrastructure.GetEventStore.csproj b/backend/src/Squidex.Infrastructure.GetEventStore/Squidex.Infrastructure.GetEventStore.csproj index 8b22b6975..3da5216fe 100644 --- a/backend/src/Squidex.Infrastructure.GetEventStore/Squidex.Infrastructure.GetEventStore.csproj +++ b/backend/src/Squidex.Infrastructure.GetEventStore/Squidex.Infrastructure.GetEventStore.csproj @@ -1,6 +1,6 @@  - net6.0 + net7.0 Squidex.Infrastructure 10.0 enable @@ -14,8 +14,8 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/backend/src/Squidex.Infrastructure.MongoDb/Squidex.Infrastructure.MongoDb.csproj b/backend/src/Squidex.Infrastructure.MongoDb/Squidex.Infrastructure.MongoDb.csproj index d5fac74ef..825e83efc 100644 --- a/backend/src/Squidex.Infrastructure.MongoDb/Squidex.Infrastructure.MongoDb.csproj +++ b/backend/src/Squidex.Infrastructure.MongoDb/Squidex.Infrastructure.MongoDb.csproj @@ -1,6 +1,6 @@  - net6.0 + net7.0 Squidex.Infrastructure 10.0 enable @@ -14,15 +14,15 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + - + diff --git a/backend/src/Squidex.Infrastructure.RabbitMq/Squidex.Infrastructure.RabbitMq.csproj b/backend/src/Squidex.Infrastructure.RabbitMq/Squidex.Infrastructure.RabbitMq.csproj index 4d5f5fb22..56c98168e 100644 --- a/backend/src/Squidex.Infrastructure.RabbitMq/Squidex.Infrastructure.RabbitMq.csproj +++ b/backend/src/Squidex.Infrastructure.RabbitMq/Squidex.Infrastructure.RabbitMq.csproj @@ -1,6 +1,6 @@  - net6.0 + net7.0 Squidex.Infrastructure 10.0 enable @@ -11,7 +11,7 @@ True - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/backend/src/Squidex.Infrastructure.Redis/Squidex.Infrastructure.Redis.csproj b/backend/src/Squidex.Infrastructure.Redis/Squidex.Infrastructure.Redis.csproj index 7fcb84452..ec30c5e2b 100644 --- a/backend/src/Squidex.Infrastructure.Redis/Squidex.Infrastructure.Redis.csproj +++ b/backend/src/Squidex.Infrastructure.Redis/Squidex.Infrastructure.Redis.csproj @@ -1,6 +1,6 @@  - net6.0 + net7.0 Squidex.Infrastructure 10.0 enable diff --git a/backend/src/Squidex.Infrastructure/EventSourcing/DefaultEventFormatter.cs b/backend/src/Squidex.Infrastructure/EventSourcing/DefaultEventFormatter.cs index ca8fcc9ae..2bedf862f 100644 --- a/backend/src/Squidex.Infrastructure/EventSourcing/DefaultEventFormatter.cs +++ b/backend/src/Squidex.Infrastructure/EventSourcing/DefaultEventFormatter.cs @@ -14,11 +14,11 @@ namespace Squidex.Infrastructure.EventSourcing; public sealed class DefaultEventFormatter : IEventFormatter { private readonly IJsonSerializer serializer; - private readonly TypeNameRegistry typeNameRegistry; + private readonly TypeRegistry typeRegistry; - public DefaultEventFormatter(TypeNameRegistry typeNameRegistry, IJsonSerializer serializer) + public DefaultEventFormatter(TypeRegistry typeRegistry, IJsonSerializer serializer) { - this.typeNameRegistry = typeNameRegistry; + this.typeRegistry = typeRegistry; this.serializer = serializer; } @@ -33,7 +33,8 @@ public sealed class DefaultEventFormatter : IEventFormatter if (envelope == null) { - throw new TypeNameNotFoundException($"Cannot find event with type name '{storedEvent.Data.Type}'."); + ThrowHelper.InvalidOperationException($"Cannot find event with type name '{storedEvent.Data.Type}'."); + return default!; } return envelope; @@ -43,21 +44,19 @@ public sealed class DefaultEventFormatter : IEventFormatter { Guard.NotNull(storedEvent); - var payloadType = typeNameRegistry.GetTypeOrNull(storedEvent.Data.Type); - - if (payloadType == null) + if (!typeRegistry.TryGetType(storedEvent.Data.Type, out var type)) { return null; } - var payloadValue = serializer.Deserialize(storedEvent.Data.Payload, payloadType); + var payload = serializer.Deserialize(storedEvent.Data.Payload, type); - if (payloadValue is IMigrated migratedEvent) + if (payload is IMigrated migratedEvent) { - payloadValue = migratedEvent.Migrate(); + payload = migratedEvent.Migrate(); } - var envelope = new Envelope(payloadValue, storedEvent.Data.Headers); + var envelope = new Envelope(payload, storedEvent.Data.Headers); envelope.SetEventPosition(storedEvent.EventPosition); envelope.SetEventStreamNumber(storedEvent.EventStreamNumber); @@ -67,14 +66,14 @@ public sealed class DefaultEventFormatter : IEventFormatter public EventData ToEventData(Envelope envelope, Guid commitId, bool migrate = true) { - var payloadValue = envelope.Payload; + var payload = envelope.Payload; - if (migrate && payloadValue is IMigrated migratedEvent) + if (migrate && payload is IMigrated migratedEvent) { - payloadValue = migratedEvent.Migrate(); + payload = migratedEvent.Migrate(); } - var payloadType = typeNameRegistry.GetName(payloadValue.GetType()); + var payloadType = typeRegistry.GetName(payload.GetType()); var payloadJson = serializer.Serialize(envelope.Payload, envelope.Payload.GetType()); envelope.SetCommitId(commitId); diff --git a/backend/src/Squidex.Infrastructure/EventSourcing/EventTypeAttribute.cs b/backend/src/Squidex.Infrastructure/EventSourcing/EventTypeAttribute.cs index 364233333..c093605ba 100644 --- a/backend/src/Squidex.Infrastructure/EventSourcing/EventTypeAttribute.cs +++ b/backend/src/Squidex.Infrastructure/EventSourcing/EventTypeAttribute.cs @@ -12,6 +12,8 @@ namespace Squidex.Infrastructure.EventSourcing; [AttributeUsage(AttributeTargets.Class, Inherited = false)] public sealed class EventTypeAttribute : TypeNameAttribute { + private const string Suffix = "Event"; + public EventTypeAttribute(string typeName, int version = 1) : base(CreateTypeName(typeName, version)) { @@ -19,6 +21,16 @@ public sealed class EventTypeAttribute : TypeNameAttribute private static string CreateTypeName(string typeName, int version) { - return $"{typeName}Event" + (version > 1 ? $"V{version}" : string.Empty); + if (!typeName.EndsWith(Suffix, StringComparison.OrdinalIgnoreCase)) + { + typeName += Suffix; + } + + if (version > 1) + { + typeName = $"{typeName}V{version}"; + } + + return typeName; } } diff --git a/backend/src/Squidex.Infrastructure/GravatarHelper.cs b/backend/src/Squidex.Infrastructure/GravatarHelper.cs index a9e11cb82..076153e86 100644 --- a/backend/src/Squidex.Infrastructure/GravatarHelper.cs +++ b/backend/src/Squidex.Infrastructure/GravatarHelper.cs @@ -29,19 +29,16 @@ public static class GravatarHelper private static string Hash(string email) { - using (var md5 = MD5.Create()) - { - var normalizedEmail = email.ToLowerInvariant().Trim(); - - var hashBytes = md5.ComputeHash(Encoding.UTF8.GetBytes(normalizedEmail)); - var hashBuilder = new StringBuilder(); + var normalizedEmail = email.ToLowerInvariant().Trim(); - for (var i = 0; i < hashBytes.Length; i++) - { - hashBuilder.Append(hashBytes[i].ToString("x2", CultureInfo.InvariantCulture)); - } + var hashBytes = MD5.HashData(Encoding.UTF8.GetBytes(normalizedEmail)); + var hashBuilder = new StringBuilder(); - return hashBuilder.ToString(); + for (var i = 0; i < hashBytes.Length; i++) + { + hashBuilder.Append(hashBytes[i].ToString("x2", CultureInfo.InvariantCulture)); } + + return hashBuilder.ToString(); } } diff --git a/backend/src/Squidex.Infrastructure/Reflection/AutoAssembyTypeProvider.cs b/backend/src/Squidex.Infrastructure/Json/System/Constants.cs similarity index 57% rename from backend/src/Squidex.Infrastructure/Reflection/AutoAssembyTypeProvider.cs rename to backend/src/Squidex.Infrastructure/Json/System/Constants.cs index 2b605b37f..2a1262948 100644 --- a/backend/src/Squidex.Infrastructure/Reflection/AutoAssembyTypeProvider.cs +++ b/backend/src/Squidex.Infrastructure/Json/System/Constants.cs @@ -5,12 +5,13 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -namespace Squidex.Infrastructure.Reflection; +using System.Text.Json; -public sealed class AutoAssembyTypeProvider : ITypeProvider +namespace Squidex.Infrastructure.Json.System; + +internal sealed class Constants { - public void Map(TypeNameRegistry typeNameRegistry) - { - typeNameRegistry.MapUnmapped(typeof(T).Assembly); - } + public const string DefaultDiscriminatorProperty = "$type"; + + public static readonly JsonEncodedText DefaultDiscriminiatorPropertyJson = JsonEncodedText.Encode("$type"); } diff --git a/backend/src/Squidex.Infrastructure/Json/System/InheritanceConverter.cs b/backend/src/Squidex.Infrastructure/Json/System/InheritanceConverter.cs deleted file mode 100644 index 89fb9bd06..000000000 --- a/backend/src/Squidex.Infrastructure/Json/System/InheritanceConverter.cs +++ /dev/null @@ -1,52 +0,0 @@ -// ========================================================================== -// Squidex Headless CMS -// ========================================================================== -// Copyright (c) Squidex UG (haftungsbeschraenkt) -// All rights reserved. Licensed under the MIT license. -// ========================================================================== - -using Squidex.Infrastructure.Reflection; - -namespace Squidex.Infrastructure.Json.System; - -public sealed class InheritanceConverter : InheritanceConverterBase where T : notnull -{ - private readonly TypeNameRegistry typeNameRegistry; - - public InheritanceConverter(TypeNameRegistry typeNameRegistry) - : base("$type") - { - this.typeNameRegistry = typeNameRegistry; - } - - public override Type GetDiscriminatorType(string name, Type typeToConvert) - { - var typeInfo = typeNameRegistry.GetTypeOrNull(name); - - if (typeInfo == null) - { - typeInfo = Type.GetType(name); - } - - if (typeInfo == null) - { - ThrowHelper.JsonException($"Object has invalid discriminator '{name}'."); - return default!; - } - - return typeInfo; - } - - public override string GetDiscriminatorValue(Type type) - { - var typeName = typeNameRegistry.GetNameOrNull(type); - - if (typeName == null) - { - // Use the type name as a fallback. - typeName = type.AssemblyQualifiedName!; - } - - return typeName; - } -} diff --git a/backend/src/Squidex.Infrastructure/Json/System/InheritanceConverterBase.cs b/backend/src/Squidex.Infrastructure/Json/System/InheritanceConverterBase.cs deleted file mode 100644 index 53c7147b8..000000000 --- a/backend/src/Squidex.Infrastructure/Json/System/InheritanceConverterBase.cs +++ /dev/null @@ -1,94 +0,0 @@ -// ========================================================================== -// Squidex Headless CMS -// ========================================================================== -// Copyright (c) Squidex UG (haftungsbeschraenkt) -// All rights reserved. Licensed under the MIT license. -// ========================================================================== - -using System.Text.Json; -using System.Text.Json.Serialization; -using Squidex.Infrastructure.ObjectPool; - -namespace Squidex.Infrastructure.Json.System; - -public abstract class InheritanceConverterBase : JsonConverter where T : notnull -{ - private readonly JsonEncodedText discriminatorProperty; - - public string DiscriminatorName { get; } - - protected InheritanceConverterBase(string discriminatorName) - { - discriminatorProperty = JsonEncodedText.Encode(discriminatorName); - - DiscriminatorName = discriminatorName; - } - - public abstract Type GetDiscriminatorType(string name, Type typeToConvert); - - public abstract string GetDiscriminatorValue(Type type); - - public override T? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - // Creating a copy of the reader (The derived deserialisation has to be done from the start) - Utf8JsonReader typeReader = reader; - - if (typeReader.TokenType != JsonTokenType.StartObject) - { - throw new JsonException(); - } - - if (!typeReader.Read() || typeReader.TokenType != JsonTokenType.PropertyName) - { - throw new JsonException(); - } - - var propertyName = typeReader.GetString(); - - if (typeReader.Read() && typeReader.TokenType == JsonTokenType.String && propertyName == DiscriminatorName) - { - var type = GetDiscriminatorType(typeReader.GetString()!, typeToConvert); - - return (T?)JsonSerializer.Deserialize(ref reader, type, options); - } - else - { - using var document = JsonDocument.ParseValue(ref reader); - - if (!document.RootElement.TryGetProperty(DiscriminatorName, out var discriminator)) - { - ThrowHelper.JsonException($"Object has no discriminator '{DiscriminatorName}."); - return default!; - } - - var type = GetDiscriminatorType(discriminator.GetString()!, typeToConvert); - - using var bufferWriter = DefaultPools.MemoryStream.GetStream(); - - using (var writer = new Utf8JsonWriter(bufferWriter)) - { - document.RootElement.WriteTo(writer); - } - - return (T?)JsonSerializer.Deserialize(bufferWriter.ToArray(), type, options); - } - } - - public override void Write(Utf8JsonWriter writer, T value, JsonSerializerOptions options) - { - var name = GetDiscriminatorValue(value.GetType()); - - writer.WriteStartObject(); - writer.WriteString(discriminatorProperty, name); - - using (var document = JsonSerializer.SerializeToDocument(value, value.GetType(), options)) - { - foreach (var property in document.RootElement.EnumerateObject()) - { - property.WriteTo(writer); - } - } - - writer.WriteEndObject(); - } -} diff --git a/backend/src/Squidex.Infrastructure/Json/System/PolymorphicConverter.cs b/backend/src/Squidex.Infrastructure/Json/System/PolymorphicConverter.cs new file mode 100644 index 000000000..45b1f4236 --- /dev/null +++ b/backend/src/Squidex.Infrastructure/Json/System/PolymorphicConverter.cs @@ -0,0 +1,104 @@ +// ========================================================================== +// Squidex Headless CMS +// ========================================================================== +// Copyright (c) Squidex UG (haftungsbeschraenkt) +// All rights reserved. Licensed under the MIT license. +// ========================================================================== + +using System.Text.Json; +using System.Text.Json.Serialization; +using Squidex.Infrastructure.Reflection; + +namespace Squidex.Infrastructure.Json.System; + +public sealed class PolymorphicConverter : JsonConverter where T : class +{ + private readonly JsonEncodedText discriminatorProperty; + private readonly string discriminatorName; + private readonly TypeRegistry typeRegistry; + + public PolymorphicConverter(TypeRegistry typeRegistry) + { + this.typeRegistry = typeRegistry; + + typeRegistry.TryGetConfig(out var config); + + discriminatorName = config?.DiscriminatorProperty ?? Constants.DefaultDiscriminatorProperty; + discriminatorProperty = JsonEncodedText.Encode(discriminatorName); + } + + public override T? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + // Creating a copy of the reader (The derived deserialisation has to be done from the start) + Utf8JsonReader typeReader = reader; + + if (typeReader.TokenType != JsonTokenType.StartObject) + { + throw new JsonException(); + } + + while (typeReader.Read()) + { + if (typeReader.TokenType == JsonTokenType.PropertyName && IsDiscriminiator(typeReader)) + { + // Advance the reader to the property value + typeReader.Read(); + + if (typeReader.TokenType != JsonTokenType.String) + { + ThrowHelper.JsonException($"Expected string discriminator value, got '{reader.TokenType}'"); + return default!; + } + + // Resolve the type from the discriminator value. + var type = GetDiscriminatorType(typeReader.GetString()!); + + // Perform the actual deserialization with the original reader + return (T)JsonSerializer.Deserialize(ref reader, type, options)!; + } + else if (typeReader.TokenType == JsonTokenType.StartObject || typeReader.TokenType == JsonTokenType.StartArray) + { + if (!typeReader.TrySkip()) + { + typeReader.Skip(); + } + } + } + + ThrowHelper.JsonException($"Object has no discriminator '{discriminatorName}."); + return default!; + } + + private bool IsDiscriminiator(Utf8JsonReader typeReader) + { + return + typeReader.ValueTextEquals(discriminatorProperty.EncodedUtf8Bytes) || + typeReader.ValueTextEquals(Constants.DefaultDiscriminatorProperty); + } + + public override void Write(Utf8JsonWriter writer, T value, JsonSerializerOptions options) + { + EnsureTypeResolver(options); + + JsonSerializer.Serialize(writer, value!, options); + } + + private static void EnsureTypeResolver(JsonSerializerOptions options) + { + if (options.TypeInfoResolver is not PolymorphicTypeResolver) + { + ThrowHelper.JsonException($"TypeInfoResolver must be of type PolymorphicTypeResolver."); + } + } + + private Type GetDiscriminatorType(string name) + { + if (!typeRegistry.TryGetType(name, out var type)) + { + ThrowHelper.JsonException($"Object has invalid discriminator '{name}'."); + return default!; + } + + return type; + } +} diff --git a/backend/src/Squidex.Infrastructure/Json/System/PolymorphicTypeResolver.cs b/backend/src/Squidex.Infrastructure/Json/System/PolymorphicTypeResolver.cs new file mode 100644 index 000000000..d9c87461b --- /dev/null +++ b/backend/src/Squidex.Infrastructure/Json/System/PolymorphicTypeResolver.cs @@ -0,0 +1,51 @@ +// ========================================================================== +// Squidex Headless CMS +// ========================================================================== +// Copyright (c) Squidex UG (haftungsbeschraenkt) +// All rights reserved. Licensed under the MIT license. +// ========================================================================== + +using System.Text.Json; +using System.Text.Json.Serialization.Metadata; +using Squidex.Infrastructure.Reflection; + +namespace Squidex.Infrastructure.Json.System; + +public sealed class PolymorphicTypeResolver : DefaultJsonTypeInfoResolver +{ + private readonly TypeRegistry typeRegistry; + + public PolymorphicTypeResolver(TypeRegistry typeRegistry) + { + Guard.NotNull(typeRegistry); + + this.typeRegistry = typeRegistry; + } + + public override JsonTypeInfo GetTypeInfo(Type type, JsonSerializerOptions options) + { + var typeInfo = base.GetTypeInfo(type, options); + + var baseType = type.BaseType; + + while (baseType != null) + { + if (typeRegistry.TryGetConfig(baseType, out var config) && config.TryGetName(type, out var typeName)) + { + var discriminiatorName = config.DiscriminatorProperty ?? Constants.DefaultDiscriminatorProperty; + var discriminatorField = typeInfo.CreateJsonPropertyInfo(typeof(string), discriminiatorName); + + discriminatorField.Get = x => + { + return typeName; + }; + + typeInfo.Properties.Insert(0, discriminatorField); + } + + baseType = baseType.BaseType; + } + + return typeInfo; + } +} diff --git a/backend/src/Squidex.Infrastructure/Json/System/ReflectionHelper.cs b/backend/src/Squidex.Infrastructure/Json/System/ReflectionHelper.cs index 4b706b910..56262748d 100644 --- a/backend/src/Squidex.Infrastructure/Json/System/ReflectionHelper.cs +++ b/backend/src/Squidex.Infrastructure/Json/System/ReflectionHelper.cs @@ -42,4 +42,9 @@ internal static class ReflectionHelper return dynamicMethod; } + + public static string GetShortTypeName(this Type type) + { + return $"{type.FullName}, {type.Assembly.GetName().Name}"; + } } diff --git a/backend/src/Squidex.Infrastructure/Json/System/StringConverter.cs b/backend/src/Squidex.Infrastructure/Json/System/StringConverter.cs index 85129586e..18c6a1989 100644 --- a/backend/src/Squidex.Infrastructure/Json/System/StringConverter.cs +++ b/backend/src/Squidex.Infrastructure/Json/System/StringConverter.cs @@ -6,6 +6,7 @@ // ========================================================================== using System.ComponentModel; +using System.Runtime.CompilerServices; using System.Text.Json; using System.Text.Json.Serialization; @@ -47,10 +48,7 @@ public sealed class StringConverter : JsonConverter where T : notnull } case JsonTokenType.StartObject: - var optionsWithoutSelf = new JsonSerializerOptions(options); - - // Remove the current converter, otherwise we would create a stackoverflow exception. - optionsWithoutSelf.Converters.Remove(this); + var optionsWithoutSelf = OptionClones.GetOptionsWithoutConverter(options, this); return JsonSerializer.Deserialize(ref reader, optionsWithoutSelf); @@ -75,3 +73,30 @@ public sealed class StringConverter : JsonConverter where T : notnull writer.WritePropertyName(convertToString(value)!); } } + +#pragma warning disable MA0048 // File name must match type name +internal static class OptionClones +#pragma warning restore MA0048 // File name must match type name +{ + private static readonly ConditionalWeakTable Clones = new ConditionalWeakTable(); + + public static JsonSerializerOptions GetOptionsWithoutConverter(JsonSerializerOptions source, JsonConverter converter) + { + if (!source.Converters.Contains(converter)) + { + return source; + } + + if (!Clones.TryGetValue(source, out var clone)) + { + clone = new JsonSerializerOptions(source); + + // Remove the current converter, otherwise we would create a stackoverflow exception. + clone.Converters.Remove(converter); + + Clones.TryAdd(source, clone); + } + + return clone; + } +} diff --git a/backend/src/Squidex.Infrastructure/NamedId{T}.cs b/backend/src/Squidex.Infrastructure/NamedId{T}.cs index 7725bafd3..08145c9d9 100644 --- a/backend/src/Squidex.Infrastructure/NamedId{T}.cs +++ b/backend/src/Squidex.Infrastructure/NamedId{T}.cs @@ -9,29 +9,18 @@ using System.ComponentModel; using System.Diagnostics.CodeAnalysis; #pragma warning disable MA0048 // File name must match type name +#pragma warning disable SA1313 // Parameter names should begin with lower-case letter namespace Squidex.Infrastructure; public delegate bool Parser(ReadOnlySpan input, out T result); [TypeConverter(typeof(NamedIdTypeConverter))] -public sealed record NamedId where T : notnull +public sealed record NamedId(T Id, string Name) where T : notnull { private static readonly int GuidLength = Guid.Empty.ToString().Length; - public T Id { get; } - - public string Name { get; } - - public NamedId(T id, string name) - { - Guard.NotNull(id); - Guard.NotNull(name); - - Id = id; - - Name = name; - } + public string Name { get; init; } = Guard.NotNullOrEmpty(Name); public override string ToString() { diff --git a/backend/src/Squidex.Infrastructure/RandomHash.cs b/backend/src/Squidex.Infrastructure/RandomHash.cs index 5506d22b8..983dff5c7 100644 --- a/backend/src/Squidex.Infrastructure/RandomHash.cs +++ b/backend/src/Squidex.Infrastructure/RandomHash.cs @@ -34,14 +34,11 @@ public static class RandomHash public static string ToSha256Base64(this byte[] bytes) { - using (var sha = SHA256.Create()) - { - var bytesHash = sha.ComputeHash(bytes); + var hashBytes = SHA256.HashData(bytes); - var result = Convert.ToBase64String(bytesHash); + var result = Convert.ToBase64String(hashBytes); - return result; - } + return result; } public static string ToSha256(this string value) diff --git a/backend/src/Squidex.Infrastructure/Reflection/AssemblyTypeProvider.cs b/backend/src/Squidex.Infrastructure/Reflection/AssemblyTypeProvider.cs new file mode 100644 index 000000000..c4dd0a326 --- /dev/null +++ b/backend/src/Squidex.Infrastructure/Reflection/AssemblyTypeProvider.cs @@ -0,0 +1,53 @@ +// ========================================================================== +// Squidex Headless CMS +// ========================================================================== +// Copyright (c) Squidex UG (haftungsbeschraenkt) +// All rights reserved. Licensed under the MIT license. +// ========================================================================== + +using System.Reflection; + +namespace Squidex.Infrastructure.Reflection; + +public sealed class AssemblyTypeProvider : ITypeProvider where T : class +{ + private readonly Assembly assembly; + + public string? DiscriminatorProperty { get; } + + public AssemblyTypeProvider(string? discriminatorProperty = null) + : this(typeof(T).Assembly, discriminatorProperty) + { + } + + public AssemblyTypeProvider(Assembly assembly, string? discriminatorProperty = null) + { + Guard.NotNull(assembly); + + this.assembly = assembly; + + DiscriminatorProperty = discriminatorProperty; + } + + public void Map(TypeRegistry typeRegistry) + { + var baseType = typeof(T); + + foreach (var derivedType in assembly.GetTypes()) + { + if (derivedType.IsAssignableTo(baseType) && !derivedType.IsAbstract) + { + var typeName = derivedType.GetCustomAttribute()?.TypeName; + + if (string.IsNullOrWhiteSpace(typeName)) + { + typeName = derivedType.TypeName(false, baseType.Name); + } + + typeRegistry.Add(derivedType, typeName); + } + } + + typeRegistry.Discriminator(DiscriminatorProperty); + } +} diff --git a/backend/src/Squidex.Infrastructure/Reflection/ITypeProvider.cs b/backend/src/Squidex.Infrastructure/Reflection/ITypeProvider.cs index ecedf67ca..7a85ad67b 100644 --- a/backend/src/Squidex.Infrastructure/Reflection/ITypeProvider.cs +++ b/backend/src/Squidex.Infrastructure/Reflection/ITypeProvider.cs @@ -9,5 +9,5 @@ namespace Squidex.Infrastructure.Reflection; public interface ITypeProvider { - void Map(TypeNameRegistry typeNameRegistry); + void Map(TypeRegistry typeRegistry); } diff --git a/backend/src/Squidex.Infrastructure/Reflection/IgnoreEqualsAttribute.cs b/backend/src/Squidex.Infrastructure/Reflection/IgnoreEqualsAttribute.cs deleted file mode 100644 index 635135dc4..000000000 --- a/backend/src/Squidex.Infrastructure/Reflection/IgnoreEqualsAttribute.cs +++ /dev/null @@ -1,13 +0,0 @@ -// ========================================================================== -// Squidex Headless CMS -// ========================================================================== -// Copyright (c) Squidex UG (haftungsbeschraenkt) -// All rights reserved. Licensed under the MIT license. -// ========================================================================== - -namespace Squidex.Infrastructure.Reflection; - -[AttributeUsage(AttributeTargets.Property)] -public sealed class IgnoreEqualsAttribute : Attribute -{ -} diff --git a/backend/src/Squidex.Infrastructure/Reflection/TypeConfig.cs b/backend/src/Squidex.Infrastructure/Reflection/TypeConfig.cs new file mode 100644 index 000000000..860a88552 --- /dev/null +++ b/backend/src/Squidex.Infrastructure/Reflection/TypeConfig.cs @@ -0,0 +1,83 @@ +// ========================================================================== +// Squidex Headless CMS +// ========================================================================== +// Copyright (c) Squidex UG (haftungsbeschraenkt) +// All rights reserved. Licensed under the MIT license. +// ========================================================================== + +using System.Diagnostics.CodeAnalysis; + +namespace Squidex.Infrastructure.Reflection; + +public sealed class TypeConfig +{ + private readonly List<(Type DerivedType, string TypeName)> derivedTypes = new List<(Type DervicedType, string TypeName)>(); + private Dictionary? mapByName; + private Dictionary? mapByType; + + public string? DiscriminatorProperty { get; set; } + + public IReadOnlyList<(Type DerivedType, string TypeName)> DerivedTypes + { + get => derivedTypes; + } + + internal void Add(Type derivedType, string typeName) + { + Guard.NotNull(derivedType); + Guard.NotNullOrEmpty(typeName); + + if (!derivedTypes.Contains((derivedType, typeName))) + { + derivedTypes.Add((derivedType, typeName)); + } + + var (conflict, _) = derivedTypes.Find(x => x.TypeName == typeName && x.DerivedType != derivedType); + + if (conflict != null) + { + ThrowHelper.ArgumentException($"Type name '{typeName}' is already used by type '{conflict}", nameof(typeName)); + } + + mapByName = null; + mapByType = null; + } + + public bool TryGetType(string typeName, [MaybeNullWhen(false)] out Type derivedType) + { + var map = mapByName ??= BuildMapByName(); + + return map.TryGetValue(typeName, out derivedType); + } + + public bool TryGetName(Type derivedType, [MaybeNullWhen(false)] out string typeName) + { + var map = mapByType ??= BuildMapByType(); + + return map.TryGetValue(derivedType, out typeName); + } + + private Dictionary BuildMapByName() + { + var result = new Dictionary(StringComparer.OrdinalIgnoreCase); + + foreach (var (derivedType, typeName) in derivedTypes) + { + result[typeName] = derivedType; + } + + return result; + } + + private Dictionary BuildMapByType() + { + var result = new Dictionary(); + + foreach (var (derivedType, typeName) in derivedTypes) + { + result[derivedType] = typeName; + } + + return result; + } +} diff --git a/backend/src/Squidex.Infrastructure/Reflection/TypeNameBuilder.cs b/backend/src/Squidex.Infrastructure/Reflection/TypeNameBuilder.cs index 09fdcfa77..1085e38a7 100644 --- a/backend/src/Squidex.Infrastructure/Reflection/TypeNameBuilder.cs +++ b/backend/src/Squidex.Infrastructure/Reflection/TypeNameBuilder.cs @@ -22,7 +22,6 @@ public static class TypeNameBuilder if (typeName.EndsWith(suffix, StringComparison.Ordinal)) { typeName = typeName[..^suffix.Length]; - break; } } diff --git a/backend/src/Squidex.Infrastructure/Reflection/TypeNameNotFoundException.cs b/backend/src/Squidex.Infrastructure/Reflection/TypeNameNotFoundException.cs deleted file mode 100644 index 49c09143e..000000000 --- a/backend/src/Squidex.Infrastructure/Reflection/TypeNameNotFoundException.cs +++ /dev/null @@ -1,24 +0,0 @@ -// ========================================================================== -// Squidex Headless CMS -// ========================================================================== -// Copyright (c) Squidex UG (haftungsbeschraenkt) -// All rights reserved. Licensed under the MIT license. -// ========================================================================== - -using System.Runtime.Serialization; - -namespace Squidex.Infrastructure.Reflection; - -[Serializable] -public class TypeNameNotFoundException : Exception -{ - public TypeNameNotFoundException(string? message = null, Exception? inner = null) - : base(message, inner) - { - } - - protected TypeNameNotFoundException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } -} diff --git a/backend/src/Squidex.Infrastructure/Reflection/TypeNameRegistry.cs b/backend/src/Squidex.Infrastructure/Reflection/TypeNameRegistry.cs deleted file mode 100644 index fc5cb2073..000000000 --- a/backend/src/Squidex.Infrastructure/Reflection/TypeNameRegistry.cs +++ /dev/null @@ -1,156 +0,0 @@ -// ========================================================================== -// Squidex Headless CMS -// ========================================================================== -// Copyright (c) Squidex UG (haftungsbeschraenkt) -// All rights reserved. Licensed under the MIT license. -// ========================================================================== - -using System.Reflection; - -namespace Squidex.Infrastructure.Reflection; - -public sealed class TypeNameRegistry -{ - private readonly Dictionary namesByType = new Dictionary(); - private readonly Dictionary typesByName = new Dictionary(StringComparer.OrdinalIgnoreCase); - - public TypeNameRegistry(IEnumerable? providers = null) - { - if (providers != null) - { - foreach (var provider in providers) - { - Map(provider); - } - } - } - - public TypeNameRegistry MapObsolete(Type type, string name) - { - Guard.NotNull(type); - Guard.NotNull(name); - - lock (namesByType) - { - if (typesByName.TryGetValue(name, out var existingType) && existingType != type) - { - var message = $"The name '{name}' is already registered with type '{typesByName[name]}'"; - - ThrowHelper.ArgumentException(message, nameof(type)); - } - - typesByName[name] = type; - } - - return this; - } - - public TypeNameRegistry Map(ITypeProvider provider) - { - Guard.NotNull(provider); - - provider.Map(this); - - return this; - } - - public TypeNameRegistry Map(Type type) - { - Guard.NotNull(type); - - var typeNameAttribute = type.GetCustomAttribute(); - - if (!string.IsNullOrWhiteSpace(typeNameAttribute?.TypeName)) - { - Map(type, typeNameAttribute.TypeName); - } - - return this; - } - - public TypeNameRegistry Map(Type type, string name) - { - Guard.NotNull(type); - Guard.NotNull(name); - - lock (namesByType) - { - if (namesByType.TryGetValue(type, out var existingName) && existingName != name) - { - var message = $"The type '{type}' is already registered with name '{namesByType[type]}'"; - - ThrowHelper.ArgumentException(message, nameof(type)); - } - - namesByType[type] = name; - - if (typesByName.TryGetValue(name, out var existingType) && existingType != type) - { - var message = $"The name '{name}' is already registered with type '{typesByName[name]}'"; - - ThrowHelper.ArgumentException(message, nameof(type)); - } - - typesByName[name] = type; - } - - return this; - } - - public TypeNameRegistry MapUnmapped(Assembly assembly) - { - foreach (var type in assembly.GetTypes()) - { - if (!namesByType.ContainsKey(type)) - { - Map(type); - } - } - - return this; - } - - public string GetName() - { - return GetName(typeof(T)); - } - - public string? GetNameOrNull() - { - return GetNameOrNull(typeof(T)); - } - - public string? GetNameOrNull(Type type) - { - return namesByType.GetValueOrDefault(type); - } - - public Type? GetTypeOrNull(string name) - { - return typesByName.GetValueOrDefault(name); - } - - public string GetName(Type type) - { - var result = namesByType.GetValueOrDefault(type); - - if (result == null) - { - throw new TypeNameNotFoundException($"There is no name for type '{type}"); - } - - return result; - } - - public Type GetType(string name) - { - var result = typesByName.GetValueOrDefault(name); - - if (result == null) - { - throw new TypeNameNotFoundException($"There is no type for name '{name}"); - } - - return result; - } -} diff --git a/backend/src/Squidex.Infrastructure/Reflection/TypeRegistry.cs b/backend/src/Squidex.Infrastructure/Reflection/TypeRegistry.cs new file mode 100644 index 000000000..2347a9401 --- /dev/null +++ b/backend/src/Squidex.Infrastructure/Reflection/TypeRegistry.cs @@ -0,0 +1,111 @@ +// ========================================================================== +// Squidex Headless CMS +// ========================================================================== +// Copyright (c) Squidex UG (haftungsbeschraenkt) +// All rights reserved. Licensed under the MIT license. +// ========================================================================== + +using System.Diagnostics.CodeAnalysis; + +namespace Squidex.Infrastructure.Reflection; + +public sealed class TypeRegistry +{ + private readonly Dictionary configs = new Dictionary(); + + public TypeRegistry(IEnumerable? providers = null) + { + if (providers != null) + { + foreach (var provider in providers) + { + Map(provider); + } + } + } + + public TypeRegistry Map(ITypeProvider provider) + { + Guard.NotNull(provider); + + provider.Map(this); + + return this; + } + + public TypeRegistry Add(string typeName) where TDerived : TBase where TBase : class + { + return Add(typeof(TDerived), typeName); + } + + public TypeRegistry Add(Type derivedType, string typeName) where T : class + { + lock (configs) + { + configs.GetOrAddNew(typeof(T)).Add(derivedType, typeName); + } + + return this; + } + + public TypeRegistry Discriminator(string? discriminiatorProperty) + { + lock (configs) + { + configs.GetOrAddNew(typeof(T)).DiscriminatorProperty ??= discriminiatorProperty; + } + + return this; + } + + public string GetName() where TDerived : TBase where TBase : class + { + return GetName(typeof(TDerived)); + } + + public string GetName(Type derivedType) where T : class + { + if (!TryGetName(derivedType, out var name)) + { + ThrowHelper.ArgumentException($"Unknown derived type {derivedType}.", nameof(derivedType)); + return default!; + } + + return name; + } + + public Type GetType(string typeName) where T : class + { + if (!TryGetType(typeName, out var name)) + { + ThrowHelper.ArgumentException($"Unknown derived type {typeName}.", nameof(typeName)); + return default!; + } + + return name; + } + + public bool TryGetName(Type derivedType, [MaybeNullWhen(false)] out string typeName) where T : class + { + typeName = null!; + + return TryGetConfig(out var config) && config.TryGetName(derivedType, out typeName); + } + + public bool TryGetType(string typeName, [MaybeNullWhen(false)] out Type derivedType) where T : class + { + derivedType = null!; + + return TryGetConfig(out var config) && config.TryGetType(typeName, out derivedType); + } + + public bool TryGetConfig([MaybeNullWhen(false)] out TypeConfig config) where T : class + { + return TryGetConfig(typeof(T), out config); + } + + public bool TryGetConfig(Type baseType, [MaybeNullWhen(false)] out TypeConfig config) + { + return configs.TryGetValue(baseType, out config); + } +} diff --git a/backend/src/Squidex.Infrastructure/Squidex.Infrastructure.csproj b/backend/src/Squidex.Infrastructure/Squidex.Infrastructure.csproj index 671068360..94a9b8800 100644 --- a/backend/src/Squidex.Infrastructure/Squidex.Infrastructure.csproj +++ b/backend/src/Squidex.Infrastructure/Squidex.Infrastructure.csproj @@ -1,6 +1,6 @@  - net6.0 + net7.0 10.0 enable en @@ -11,33 +11,33 @@ True - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - + + + + + + - - - - - - + + + + + + - + - + diff --git a/backend/src/Squidex.Infrastructure/UsageTracking/CachingUsageTracker.cs b/backend/src/Squidex.Infrastructure/UsageTracking/CachingUsageTracker.cs index 4de675b53..93a969229 100644 --- a/backend/src/Squidex.Infrastructure/UsageTracking/CachingUsageTracker.cs +++ b/backend/src/Squidex.Infrastructure/UsageTracking/CachingUsageTracker.cs @@ -67,7 +67,7 @@ public sealed class CachingUsageTracker : IUsageTracker entry.AbsoluteExpirationRelativeToNow = CacheDuration; return inner.GetForMonthAsync(key, date, category, ct); - }); + })!; } public Task GetAsync(string key, DateTime fromDate, DateTime toDate, string? category, @@ -82,6 +82,6 @@ public sealed class CachingUsageTracker : IUsageTracker entry.AbsoluteExpirationRelativeToNow = CacheDuration; return inner.GetAsync(key, fromDate, toDate, category, ct); - }); + })!; } } diff --git a/backend/src/Squidex.Shared/Squidex.Shared.csproj b/backend/src/Squidex.Shared/Squidex.Shared.csproj index b08d4696a..ae6a92a2f 100644 --- a/backend/src/Squidex.Shared/Squidex.Shared.csproj +++ b/backend/src/Squidex.Shared/Squidex.Shared.csproj @@ -1,6 +1,6 @@  - net6.0 + net7.0 9.0 enable @@ -9,7 +9,7 @@ True - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/backend/src/Squidex.Web/Extensions.cs b/backend/src/Squidex.Web/Extensions.cs index d7b171cf4..4ffaffa73 100644 --- a/backend/src/Squidex.Web/Extensions.cs +++ b/backend/src/Squidex.Web/Extensions.cs @@ -8,7 +8,6 @@ using System.Diagnostics.CodeAnalysis; using System.Security.Claims; using Microsoft.AspNetCore.Http; -using Microsoft.Extensions.Primitives; using Squidex.Infrastructure.Security; namespace Squidex.Web; @@ -62,11 +61,13 @@ public static class Extensions { result = null!; - if (headers.TryGetValue(header, out var value) && value != StringValues.Empty) + if (headers.TryGetValue(header, out var value)) { - if (!string.IsNullOrWhiteSpace(value)) + string? valueString = value; + + if (!string.IsNullOrWhiteSpace(valueString)) { - result = value; + result = valueString; return true; } } diff --git a/backend/src/Squidex.Web/Json/JsonInheritanceConverter.cs b/backend/src/Squidex.Web/Json/JsonInheritanceConverter.cs deleted file mode 100644 index 49615d7bc..000000000 --- a/backend/src/Squidex.Web/Json/JsonInheritanceConverter.cs +++ /dev/null @@ -1,108 +0,0 @@ -// ========================================================================== -// Squidex Headless CMS -// ========================================================================== -// Copyright (c) Squidex UG (haftungsbeschraenkt) -// All rights reserved. Licensed under the MIT license. -// ========================================================================== - -using System.Reflection; -using System.Runtime.Serialization; -using Squidex.Infrastructure; -using Squidex.Infrastructure.Json.System; - -#pragma warning disable RECS0108 // Warns about static fields in generic types - -namespace Squidex.Web.Json; - -public class JsonInheritanceConverter : InheritanceConverterBase where T : notnull -{ - private static readonly Lazy> DefaultMapping = new Lazy>(() => - { - var baseName = typeof(T).Name; - - var result = new Dictionary(); - - void AddType(Type type) - { - var typeName = type.Name; - - if (typeName.EndsWith(baseName, StringComparison.CurrentCulture)) - { - typeName = typeName[..^baseName.Length]; - } - - result[typeName] = type; - } - - foreach (var attribute in typeof(T).GetCustomAttributes()) - { - if (attribute.Type != null) - { - if (!attribute.Type.IsAbstract) - { - AddType(attribute.Type); - } - } - else if (!string.IsNullOrWhiteSpace(attribute.MethodName)) - { - var method = typeof(T).GetMethod(attribute.MethodName); - - if (method != null && method.IsStatic) - { - var types = (IEnumerable)method.Invoke(null, Array.Empty())!; - - foreach (var type in types) - { - if (!type.IsAbstract) - { - AddType(type); - } - } - } - } - } - - return result; - }); - - private readonly IReadOnlyDictionary mapping; - - public JsonInheritanceConverter() - : this(null, DefaultMapping.Value) - { - } - - public JsonInheritanceConverter(string? discriminatorName) - : this(discriminatorName, DefaultMapping.Value) - { - } - - public JsonInheritanceConverter(string? discriminatorName, IReadOnlyDictionary mapping) - : base(GetDiscriminatorName(discriminatorName)) - { - this.mapping = mapping ?? DefaultMapping.Value; - } - - private static string GetDiscriminatorName(string? discriminatorName) - { - var attribute = typeof(T).GetCustomAttribute(); - - return attribute?.DiscriminatorName ?? discriminatorName ?? "discriminator"; - } - - public override Type GetDiscriminatorType(string name, Type typeToConvert) - { - if (!mapping.TryGetValue(name, out var type)) - { - ThrowHelper.JsonException($"Could not find subtype of '{typeToConvert.Name}' with discriminator '{name}'."); - return default!; - } - - return type; - } - - public override string GetDiscriminatorValue(Type type) - { - return mapping.FirstOrDefault(x => x.Value == type).Key ?? type.Name; - } -} diff --git a/backend/src/Squidex.Web/Json/JsonInheritanceConverterAttribute.cs b/backend/src/Squidex.Web/Json/JsonInheritanceConverterAttribute.cs deleted file mode 100644 index 7194d465b..000000000 --- a/backend/src/Squidex.Web/Json/JsonInheritanceConverterAttribute.cs +++ /dev/null @@ -1,21 +0,0 @@ -// ========================================================================== -// Squidex Headless CMS -// ========================================================================== -// Copyright (c) Squidex UG (haftungsbeschraenkt) -// All rights reserved. Licensed under the MIT license. -// ========================================================================== - -using System.Text.Json.Serialization; - -namespace Squidex.Web.Json; - -public sealed class JsonInheritanceConverterAttribute : JsonConverterAttribute -{ - public string DiscriminatorName { get; } - - public JsonInheritanceConverterAttribute(Type baseType, string discriminatorName = "$type") - : base(typeof(JsonInheritanceConverter<>).MakeGenericType(baseType)) - { - DiscriminatorName = discriminatorName; - } -} diff --git a/backend/src/Squidex.Web/Squidex.Web.csproj b/backend/src/Squidex.Web/Squidex.Web.csproj index 3bda29ec0..c6d0b31a3 100644 --- a/backend/src/Squidex.Web/Squidex.Web.csproj +++ b/backend/src/Squidex.Web/Squidex.Web.csproj @@ -1,6 +1,6 @@  - net6.0 + net7.0 10.0 enable enable @@ -16,7 +16,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/backend/src/Squidex/Areas/Api/Config/OpenApi/CommonProcessor.cs b/backend/src/Squidex/Areas/Api/Config/OpenApi/CommonProcessor.cs index f06c833d0..c40f9867c 100644 --- a/backend/src/Squidex/Areas/Api/Config/OpenApi/CommonProcessor.cs +++ b/backend/src/Squidex/Areas/Api/Config/OpenApi/CommonProcessor.cs @@ -16,14 +16,9 @@ namespace Squidex.Areas.Api.Config.OpenApi; public sealed class CommonProcessor : IDocumentProcessor { private readonly string version; - private readonly string logoBackground = "#3f83df"; + private readonly string logoColor = "#3f83df"; private readonly string logoUrl; - private readonly OpenApiExternalDocumentation documentation = new OpenApiExternalDocumentation - { - Url = "https://docs.squidex.io" - }; - public CommonProcessor(ExposedValues exposedValues, IUrlGenerator urlGenerator) { logoUrl = urlGenerator.BuildUrl("images/logo-white.png", false); @@ -36,6 +31,7 @@ public sealed class CommonProcessor : IDocumentProcessor public void Process(DocumentProcessorContext context) { + context.Document.Info.Title = "Squidex API"; context.Document.Info.Version = version; context.Document.Info.ExtensionData = new Dictionary { @@ -43,10 +39,13 @@ public sealed class CommonProcessor : IDocumentProcessor { url = logoUrl, backgroundStyle = string.Empty, - backgroundColor = logoBackground + backgroundColor = logoColor } }; - context.Document.ExternalDocumentation = documentation; + context.Document.ExternalDocumentation = new OpenApiExternalDocumentation + { + Url = "https://docs.squidex.io" + }; } } diff --git a/backend/src/Squidex/Areas/Api/Config/OpenApi/DiscriminatorProcessor.cs b/backend/src/Squidex/Areas/Api/Config/OpenApi/DiscriminatorProcessor.cs new file mode 100644 index 000000000..5f63842f4 --- /dev/null +++ b/backend/src/Squidex/Areas/Api/Config/OpenApi/DiscriminatorProcessor.cs @@ -0,0 +1,67 @@ +// ========================================================================== +// Squidex Headless CMS +// ========================================================================== +// Copyright (c) Squidex UG (haftungsbeschraenkt) +// All rights reserved. Licensed under the MIT license. +// ========================================================================== + +using NJsonSchema; +using NJsonSchema.Generation; +using Squidex.Infrastructure.Reflection; + +namespace Squidex.Areas.Api.Config.OpenApi; + +public sealed class DiscriminatorProcessor : ISchemaProcessor +{ + private readonly TypeRegistry typeRegistry; + + public DiscriminatorProcessor(TypeRegistry typeRegistry) + { + this.typeRegistry = typeRegistry; + } + + public void Process(SchemaProcessorContext context) + { + if (context.Schema.DiscriminatorObject != null) + { + return; + } + + if (!typeRegistry.TryGetConfig(context.ContextualType.Type, out var config) || + config.DerivedTypes.Count <= 0 || + config.DiscriminatorProperty == null) + { + return; + } + + var discriminatorName = config.DiscriminatorProperty; + var discriminatorObject = new OpenApiDiscriminator + { + PropertyName = discriminatorName + }; + + var schema = context.Schema; + + foreach (var (derivedType, typeName) in config.DerivedTypes) + { + var derivedSchema = context.Generator.Generate(derivedType, context.Resolver); + + discriminatorObject.Mapping[typeName] = new JsonSchema + { + Reference = derivedSchema + }; + } + + schema.DiscriminatorObject = discriminatorObject; + + if (!schema.Properties.TryGetValue(discriminatorName, out var existingProperty)) + { + schema.Properties[discriminatorName] = existingProperty = new JsonSchemaProperty + { + Type = JsonObjectType.String + }; + } + + existingProperty.IsRequired = true; + } +} diff --git a/backend/src/Squidex/Areas/Api/Config/OpenApi/ErrorDtoProcessor.cs b/backend/src/Squidex/Areas/Api/Config/OpenApi/ErrorDtoProcessor.cs index 96505be81..06a2e1920 100644 --- a/backend/src/Squidex/Areas/Api/Config/OpenApi/ErrorDtoProcessor.cs +++ b/backend/src/Squidex/Areas/Api/Config/OpenApi/ErrorDtoProcessor.cs @@ -5,6 +5,7 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== +using System.Xml.Linq; using Namotion.Reflection; using NJsonSchema; using NSwag; @@ -14,54 +15,68 @@ using Squidex.Web; namespace Squidex.Areas.Api.Config.OpenApi; -public sealed class ErrorDtoProcessor : IDocumentProcessor +public sealed class ErrorDtoProcessor : IOperationProcessor { - public void Process(DocumentProcessorContext context) + public bool Process(OperationProcessorContext context) { - var errorSchema = GetErrorSchema(context); + var operation = context.OperationDescription.Operation; - foreach (var operation in context.Document.Paths.Values.SelectMany(x => x.Values)) + void AddResponse(string code, string description) { - AddErrorResponses(operation, errorSchema); + if (!IsErrorCode(code)) + { + return; + } - CleanupResponses(operation); + if (!operation.Responses.ContainsKey(code)) + { + operation.Responses.Add(code, new OpenApiResponse + { + Description = description + }); + } } - } - private static void AddErrorResponses(OpenApiOperation operation, JsonSchema errorSchema) - { - if (!operation.Responses.ContainsKey("500")) - { - const string description = "Operation failed."; + var responses = + context.MethodInfo.GetXmlDocsElement(null)? + .Nodes() + .OfType() + .Where(x => x.Name == "response") + .Where(x => x.Attribute("code") != null) + ?? Enumerable.Empty(); - var response = new OpenApiResponse { Description = description, Schema = errorSchema }; + foreach (var response in responses) + { + AddResponse(response.Attribute("code")!.Value, response.Value); + } - operation.Responses["500"] = response; + if (!string.Equals(context.OperationDescription.Method, HttpMethods.Get, StringComparison.OrdinalIgnoreCase)) + { + AddResponse("400", "Validation error."); } + AddResponse("500", "Operation failed."); + foreach (var (code, response) in operation.Responses) { - if (code != "404" && code.StartsWith("4", StringComparison.OrdinalIgnoreCase) && response.Schema == null) + if (response.Schema == null) { - response.Schema = errorSchema; + if (IsErrorCode(code) && code != "404") + { + response.Schema = GetErrorSchema(context); + } } } + + return true; } - private static void CleanupResponses(OpenApiOperation operation) + private static bool IsErrorCode(string code) { - foreach (var (code, response) in operation.Responses.ToList()) - { - if (string.IsNullOrWhiteSpace(response.Description) || - response.Description?.Contains("=>", StringComparison.Ordinal) == true || - response.Description?.Contains("=>", StringComparison.Ordinal) == true) - { - operation.Responses.Remove(code); - } - } + return !code.StartsWith("2", StringComparison.OrdinalIgnoreCase); } - private static JsonSchema GetErrorSchema(DocumentProcessorContext context) + private static JsonSchema GetErrorSchema(OperationProcessorContext context) { var errorType = typeof(ErrorDto).ToContextualType(); diff --git a/backend/src/Squidex/Areas/Api/Config/OpenApi/FixProcessor.cs b/backend/src/Squidex/Areas/Api/Config/OpenApi/FixProcessor.cs deleted file mode 100644 index 446ad1778..000000000 --- a/backend/src/Squidex/Areas/Api/Config/OpenApi/FixProcessor.cs +++ /dev/null @@ -1,30 +0,0 @@ -// ========================================================================== -// Squidex Headless CMS -// ========================================================================== -// Copyright (c) Squidex UG (haftungsbeschraenkt) -// All rights reserved. Licensed under the MIT license. -// ========================================================================== - -using NJsonSchema; -using NSwag.Generation.Processors; -using NSwag.Generation.Processors.Contexts; - -namespace Squidex.Areas.Api.Config.OpenApi; - -public sealed class FixProcessor : IOperationProcessor -{ - private static readonly JsonSchema StringSchema = new JsonSchema { Type = JsonObjectType.String }; - - public bool Process(OperationProcessorContext context) - { - foreach (var (_, parameter) in context.Parameters) - { - if (parameter.IsRequired && parameter.Schema is { Type: JsonObjectType.String }) - { - parameter.Schema = StringSchema; - } - } - - return true; - } -} diff --git a/backend/src/Squidex/Areas/Api/Config/OpenApi/OpenApiServices.cs b/backend/src/Squidex/Areas/Api/Config/OpenApi/OpenApiServices.cs index 869c10aeb..9bb6364f8 100644 --- a/backend/src/Squidex/Areas/Api/Config/OpenApi/OpenApiServices.cs +++ b/backend/src/Squidex/Areas/Api/Config/OpenApi/OpenApiServices.cs @@ -12,13 +12,13 @@ using NJsonSchema.Generation.TypeMappers; using NodaTime; using NSwag.Generation; using NSwag.Generation.Processors; -using Squidex.Areas.Api.Controllers.Rules.Models; using Squidex.Domain.Apps.Core.Assets; using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Infrastructure; using Squidex.Infrastructure.Json.Objects; using Squidex.Infrastructure.Queries; +using Squidex.Infrastructure.Reflection; namespace Squidex.Areas.Api.Config.OpenApi; @@ -27,15 +27,12 @@ public static class OpenApiServices public static void AddSquidexOpenApiSettings(this IServiceCollection services) { services.AddSingletonAs() - .As(); - - services.AddSingletonAs() - .As(); + .As(); services.AddSingletonAs() .As(); - services.AddSingletonAs() + services.AddSingletonAs() .As(); services.AddSingletonAs() @@ -44,14 +41,11 @@ public static class OpenApiServices services.AddSingletonAs() .As(); - services.AddSingletonAs() - .As(); - services.AddSingletonAs() .As(); - services.AddSingletonAs() - .As(); + services.AddSingletonAs() + .As(); services.AddSingletonAs() .AsSelf(); @@ -63,7 +57,7 @@ public static class OpenApiServices { var settings = new JsonSchemaGeneratorSettings(); - ConfigureSchemaSettings(settings, true); + ConfigureSchemaSettings(settings, c.GetRequiredService(), true); return settings; }); @@ -72,7 +66,7 @@ public static class OpenApiServices { var settings = new OpenApiDocumentGeneratorSettings(); - ConfigureSchemaSettings(settings, true); + ConfigureSchemaSettings(settings, c.GetRequiredService(), true); foreach (var processor in c.GetRequiredService>()) { @@ -82,56 +76,42 @@ public static class OpenApiServices return settings; }); - services.AddOpenApiDocument(settings => + services.AddOpenApiDocument((settings, services) => { - settings.Title = "Squidex API"; - - ConfigureSchemaSettings(settings); + ConfigureSchemaSettings(settings, services.GetRequiredService(), false); settings.OperationProcessors.Add(new QueryParamsProcessor("/api/apps/{app}/assets")); }); } - private static void ConfigureSchemaSettings(JsonSchemaGeneratorSettings settings, bool flatten = false) + private static void ConfigureSchemaSettings(JsonSchemaGeneratorSettings settings, TypeRegistry typeRegistry, bool flatten) { - settings.AllowReferencesWithProperties = true; - - settings.ReflectionService = new ReflectionServices(); - settings.TypeMappers = new List { + CreateAnyMap>(), + CreateAnyMap(), + CreateAnyMap(), + CreateArrayMap(JsonObjectType.String), + CreateObjectMap(), + CreateObjectMap(), CreateStringMap(), CreateStringMap(JsonFormatStrings.DateTime), + CreateStringMap(), CreateStringMap(JsonFormatStrings.Date), CreateStringMap(JsonFormatStrings.DateTime), - CreateStringMap(), CreateStringMap>(), CreateStringMap>(), CreateStringMap>(), CreateStringMap(), CreateStringMap(), - - CreateObjectMap(), - CreateObjectMap(), - - CreateAnyMap(), - CreateAnyMap(), - CreateAnyMap>(), - - new PrimitiveTypeMapper(typeof(FieldNames), schema => - { - schema.Type = JsonObjectType.Array; - - schema.Item = new JsonSchema - { - Type = JsonObjectType.String - }; - }), }; - settings.SchemaType = NJsonSchema.SchemaType.OpenApi3; - + settings.AllowReferencesWithProperties = true; settings.FlattenInheritanceHierarchy = flatten; + settings.SchemaNameGenerator = new SchemaNameGenerator(); + settings.SchemaProcessors.Add(new DiscriminatorProcessor(typeRegistry)); + settings.SchemaType = NJsonSchema.SchemaType.OpenApi3; + settings.ReflectionService = new ReflectionServices(); } private static ITypeMapper CreateObjectMap() @@ -147,6 +127,19 @@ public static class OpenApiServices }); } + private static ITypeMapper CreateArrayMap(JsonObjectType itemType) + { + return new PrimitiveTypeMapper(typeof(T), schema => + { + schema.Type = JsonObjectType.Array; + + schema.Item = new JsonSchema + { + Type = itemType + }; + }); + } + private static ITypeMapper CreateStringMap(string? format = null) { return new PrimitiveTypeMapper(typeof(T), schema => diff --git a/backend/src/Squidex/Areas/Api/Config/OpenApi/SchemaNameGenerator.cs b/backend/src/Squidex/Areas/Api/Config/OpenApi/SchemaNameGenerator.cs new file mode 100644 index 000000000..a119b9453 --- /dev/null +++ b/backend/src/Squidex/Areas/Api/Config/OpenApi/SchemaNameGenerator.cs @@ -0,0 +1,30 @@ +// ========================================================================== +// Squidex Headless CMS +// ========================================================================== +// Copyright (c) Squidex UG (haftungsbeschraenkt) +// All rights reserved. Licensed under the MIT license. +// ========================================================================== + +using NJsonSchema.Generation; +using Squidex.Domain.Apps.Core.Rules; +using Squidex.Infrastructure.Reflection; + +namespace Squidex.Areas.Api.Config.OpenApi; + +public sealed class SchemaNameGenerator : DefaultSchemaNameGenerator +{ + public override string Generate(Type type) + { + if (type.BaseType == typeof(RuleAction)) + { + return $"{type.TypeName(false, "Action")}RuleActionDto"; + } + + if (type == typeof(RuleAction)) + { + return $"RuleActionDto"; + } + + return base.Generate(type); + } +} diff --git a/backend/src/Squidex/Areas/Api/Config/OpenApi/SecurityProcessor.cs b/backend/src/Squidex/Areas/Api/Config/OpenApi/SecurityProcessor.cs index eca5c110d..a62598bd2 100644 --- a/backend/src/Squidex/Areas/Api/Config/OpenApi/SecurityProcessor.cs +++ b/backend/src/Squidex/Areas/Api/Config/OpenApi/SecurityProcessor.cs @@ -15,45 +15,28 @@ namespace Squidex.Areas.Api.Config.OpenApi; public sealed class SecurityProcessor : SecurityDefinitionAppender { public SecurityProcessor(IUrlGenerator urlGenerator) - : base(Constants.SecurityDefinition, Enumerable.Empty(), CreateOAuthSchema(urlGenerator)) + : base(Constants.SecurityDefinition, new[] { Constants.ScopeApi }, CreateOAuthSchema(urlGenerator)) { } private static OpenApiSecurityScheme CreateOAuthSchema(IUrlGenerator urlGenerator) { - var security = new OpenApiSecurityScheme + string BuildUrl(string endpoint) { - Type = OpenApiSecuritySchemeType.OAuth2 - }; - - var tokenUrl = urlGenerator.BuildUrl($"/{Constants.PrefixIdentityServer}/connect/token", false); + return urlGenerator.BuildUrl($"/{Constants.PrefixIdentityServer}/{endpoint}", false); + } - security.TokenUrl = tokenUrl; - - SetupDescription(security, tokenUrl); - SetupFlow(security); - SetupScopes(security); + var security = new OpenApiSecurityScheme + { + Type = OpenApiSecuritySchemeType.OpenIdConnect, - return security; - } + // The discovery endpoint + OpenIdConnectUrl = BuildUrl(".well-known/openid-configuration"), - private static void SetupFlow(OpenApiSecurityScheme security) - { - security.Flow = OpenApiOAuth2Flow.Application; - } - - private static void SetupScopes(OpenApiSecurityScheme security) - { - security.Scopes = new Dictionary - { - [Constants.ScopeApi] = "Read and write access to the API" + // Just described the token URL again. + Description = Properties.Resources.OpenApiSecurity.Replace("", BuildUrl($"connect/token"), StringComparison.Ordinal) }; - } - - private static void SetupDescription(OpenApiSecurityScheme securityScheme, string tokenUrl) - { - var securityText = Properties.Resources.OpenApiSecurity.Replace("", tokenUrl, StringComparison.Ordinal); - securityScheme.Description = securityText; + return security; } } diff --git a/backend/src/Squidex/Areas/Api/Config/OpenApi/XmlTagProcessor.cs b/backend/src/Squidex/Areas/Api/Config/OpenApi/TagXmlProcessor.cs similarity index 96% rename from backend/src/Squidex/Areas/Api/Config/OpenApi/XmlTagProcessor.cs rename to backend/src/Squidex/Areas/Api/Config/OpenApi/TagXmlProcessor.cs index 083b1ec81..1c281d8fa 100644 --- a/backend/src/Squidex/Areas/Api/Config/OpenApi/XmlTagProcessor.cs +++ b/backend/src/Squidex/Areas/Api/Config/OpenApi/TagXmlProcessor.cs @@ -13,7 +13,7 @@ using NSwag.Generation.Processors.Contexts; namespace Squidex.Areas.Api.Config.OpenApi; -public sealed class XmlTagProcessor : IDocumentProcessor +public sealed class TagXmlProcessor : IDocumentProcessor { public void Process(DocumentProcessorContext context) { diff --git a/backend/src/Squidex/Areas/Api/Config/OpenApi/XmlResponseTypesProcessor.cs b/backend/src/Squidex/Areas/Api/Config/OpenApi/XmlResponseTypesProcessor.cs deleted file mode 100644 index 9e739b214..000000000 --- a/backend/src/Squidex/Areas/Api/Config/OpenApi/XmlResponseTypesProcessor.cs +++ /dev/null @@ -1,54 +0,0 @@ -// ========================================================================== -// Squidex Headless CMS -// ========================================================================== -// Copyright (c) Squidex UG (haftungsbeschraenkt) -// All rights reserved. Licensed under the MIT license. -// ========================================================================== - -using System.Text.RegularExpressions; -using Namotion.Reflection; -using NSwag; -using NSwag.Generation.Processors; -using NSwag.Generation.Processors.Contexts; -using Squidex.Infrastructure; - -namespace Squidex.Areas.Api.Config.OpenApi; - -public sealed class XmlResponseTypesProcessor : IOperationProcessor -{ - private static readonly Regex ResponseRegex = new Regex("(?[0-9]{3})[\\s]*=((>)|>)[\\s]*(?.*)", RegexOptions.Compiled | RegexOptions.ExplicitCapture); - - public bool Process(OperationProcessorContext context) - { - var operation = context.OperationDescription.Operation; - - var returnsDescription = context.MethodInfo.GetXmlDocsTag("returns"); - - if (!string.IsNullOrWhiteSpace(returnsDescription)) - { - foreach (var match in ResponseRegex.Matches(returnsDescription).OfType()) - { - var statusCode = match.Groups["Code"].Value; - - if (!operation.Responses.TryGetValue(statusCode, out var response)) - { - response = new OpenApiResponse(); - - operation.Responses[statusCode] = response; - } - - var description = match.Groups["Description"].Value; - - if (description.Contains("=>", StringComparison.Ordinal)) - { - ThrowHelper.InvalidOperationException("Description not formatted correcly."); - return default!; - } - - response.Description = description; - } - } - - return true; - } -} diff --git a/backend/src/Squidex/Areas/Api/Controllers/Apps/AppAssetsController.cs b/backend/src/Squidex/Areas/Api/Controllers/Apps/AppAssetsController.cs index 8c8225f81..71f924b53 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Apps/AppAssetsController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Apps/AppAssetsController.cs @@ -29,10 +29,8 @@ public sealed class AppAssetsController : ApiController /// Get the app asset scripts. /// /// The name of the app to get the asset scripts for. - /// - /// 200 => Asset scripts returned. - /// 404 => App not found. - /// + /// Asset scripts returned.. + /// App not found.. [HttpGet] [Route("apps/{app}/assets/scripts")] [ProducesResponseType(typeof(AssetScriptsDto), StatusCodes.Status200OK)] @@ -53,11 +51,9 @@ public sealed class AppAssetsController : ApiController /// /// The name of the app to update. /// The values to update. - /// - /// 200 => Asset scripts updated. - /// 400 => Asset request not valid. - /// 404 => App not found. - /// + /// Asset scripts updated.. + /// Asset request not valid.. + /// App not found.. [HttpPut] [Route("apps/{app}/assets/scripts")] [ProducesResponseType(typeof(AssetScriptsDto), StatusCodes.Status200OK)] diff --git a/backend/src/Squidex/Areas/Api/Controllers/Apps/AppClientsController.cs b/backend/src/Squidex/Areas/Api/Controllers/Apps/AppClientsController.cs index 241524aba..42a06c553 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Apps/AppClientsController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Apps/AppClientsController.cs @@ -31,10 +31,8 @@ public sealed class AppClientsController : ApiController /// Get app clients. /// /// The name of the app. - /// - /// 200 => Clients returned. - /// 404 => App not found. - /// + /// Clients returned.. + /// App not found.. /// /// Gets all configured clients for the app with the specified name. /// @@ -60,11 +58,9 @@ public sealed class AppClientsController : ApiController /// /// The name of the app. /// Client object that needs to be added to the app. - /// - /// 201 => Client created. - /// 400 => Client request not valid. - /// 404 => App not found. - /// + /// Client created.. + /// Client request not valid.. + /// App not found.. /// /// Create a new client for the app with the specified name. /// The client secret is auto generated on the server and returned. The client does not expire, the access token is valid for 30 days. @@ -89,11 +85,9 @@ public sealed class AppClientsController : ApiController /// The name of the app. /// The ID of the client that must be updated. /// Client object that needs to be updated. - /// - /// 200 => Client updated. - /// 400 => Client request not valid. - /// 404 => Client or app not found. - /// + /// Client updated.. + /// Client request not valid.. + /// Client or app not found.. /// /// Only the display name can be changed, create a new client if necessary. /// @@ -116,10 +110,8 @@ public sealed class AppClientsController : ApiController /// /// The name of the app. /// The ID of the client that must be deleted. - /// - /// 200 => Client deleted. - /// 404 => Client or app not found. - /// + /// Client deleted.. + /// Client or app not found.. /// /// The application that uses this client credentials cannot access the API after it has been revoked. /// diff --git a/backend/src/Squidex/Areas/Api/Controllers/Apps/AppContributorsController.cs b/backend/src/Squidex/Areas/Api/Controllers/Apps/AppContributorsController.cs index 9d6885aad..17fd0c5ae 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Apps/AppContributorsController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Apps/AppContributorsController.cs @@ -38,10 +38,8 @@ public sealed class AppContributorsController : ApiController /// Get app contributors. /// /// The name of the app. - /// - /// 200 => Contributors returned. - /// 404 => App not found. - /// + /// Contributors returned.. + /// App not found.. [HttpGet] [Route("apps/{app}/contributors/")] [ProducesResponseType(typeof(ContributorsDto), StatusCodes.Status200OK)] @@ -59,11 +57,9 @@ public sealed class AppContributorsController : ApiController /// /// The name of the app. /// Contributor object that needs to be added to the app. - /// - /// 201 => Contributor assigned to app. - /// 400 => Contributor request not valid. - /// 404 => App not found. - /// + /// Contributor assigned to app.. + /// Contributor request not valid.. + /// App not found.. [HttpPost] [Route("apps/{app}/contributors/")] [ProducesResponseType(typeof(ContributorsDto), StatusCodes.Status201Created)] @@ -82,10 +78,8 @@ public sealed class AppContributorsController : ApiController /// Remove yourself. /// /// The name of the app. - /// - /// 200 => Contributor removed. - /// 404 => Contributor or app not found. - /// + /// Contributor removed.. + /// Contributor or app not found.. [HttpDelete] [Route("apps/{app}/contributors/me/")] [ProducesResponseType(typeof(ContributorsDto), StatusCodes.Status200OK)] @@ -105,10 +99,8 @@ public sealed class AppContributorsController : ApiController /// /// The name of the app. /// The ID of the contributor. - /// - /// 200 => Contributor removed. - /// 404 => Contributor or app not found. - /// + /// Contributor removed.. + /// Contributor or app not found.. [HttpDelete] [Route("apps/{app}/contributors/{id}/")] [ProducesResponseType(typeof(ContributorsDto), StatusCodes.Status200OK)] diff --git a/backend/src/Squidex/Areas/Api/Controllers/Apps/AppImageController.cs b/backend/src/Squidex/Areas/Api/Controllers/Apps/AppImageController.cs index 1a13b3bbc..96b3fedc9 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Apps/AppImageController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Apps/AppImageController.cs @@ -41,10 +41,8 @@ public sealed class AppImageController : ApiController /// Get the app image. /// /// The name of the app. - /// - /// 200 => App image found and content or (resized) image returned. - /// 404 => App not found. - /// + /// App image found and content or (resized) image returned.. + /// App not found.. [HttpGet] [Route("apps/{app}/image")] [ProducesResponseType(typeof(FileResult), StatusCodes.Status200OK)] diff --git a/backend/src/Squidex/Areas/Api/Controllers/Apps/AppLanguagesController.cs b/backend/src/Squidex/Areas/Api/Controllers/Apps/AppLanguagesController.cs index 4750bb40c..b68e2c0d0 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Apps/AppLanguagesController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Apps/AppLanguagesController.cs @@ -32,10 +32,8 @@ public sealed class AppLanguagesController : ApiController /// Get app languages. /// /// The name of the app. - /// - /// 200 => Languages returned. - /// 404 => App not found. - /// + /// Languages returned.. + /// App not found.. [HttpGet] [Route("apps/{app}/languages/")] [ProducesResponseType(typeof(AppLanguagesDto), StatusCodes.Status200OK)] @@ -58,11 +56,9 @@ public sealed class AppLanguagesController : ApiController /// /// The name of the app. /// The language to add to the app. - /// - /// 201 => Language created. - /// 400 => Language request not valid. - /// 404 => App not found. - /// + /// Language created.. + /// Language request not valid.. + /// App not found.. [HttpPost] [Route("apps/{app}/languages/")] [ProducesResponseType(typeof(AppLanguagesDto), 201)] @@ -83,11 +79,9 @@ public sealed class AppLanguagesController : ApiController /// The name of the app. /// The language to update. /// The language object. - /// - /// 200 => Language updated. - /// 400 => Language request not valid. - /// 404 => Language or app not found. - /// + /// Language updated.. + /// Language request not valid.. + /// Language or app not found.. [HttpPut] [Route("apps/{app}/languages/{language}/")] [ProducesResponseType(typeof(AppLanguagesDto), StatusCodes.Status200OK)] @@ -107,11 +101,9 @@ public sealed class AppLanguagesController : ApiController /// /// The name of the app. /// The language to delete from the app. - /// - /// 200 => Language deleted. - /// 400 => Language is master language. - /// 404 => Language or app not found. - /// + /// Language deleted.. + /// Language is master language.. + /// Language or app not found.. [HttpDelete] [Route("apps/{app}/languages/{language}/")] [ProducesResponseType(typeof(AppLanguagesDto), StatusCodes.Status200OK)] diff --git a/backend/src/Squidex/Areas/Api/Controllers/Apps/AppRolesController.cs b/backend/src/Squidex/Areas/Api/Controllers/Apps/AppRolesController.cs index c62f0d6ec..7e48adad0 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Apps/AppRolesController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Apps/AppRolesController.cs @@ -35,10 +35,8 @@ public sealed class AppRolesController : ApiController /// Get app roles. /// /// The name of the app. - /// - /// 200 => Roles returned. - /// 404 => App not found. - /// + /// Roles returned.. + /// App not found.. [HttpGet] [Route("apps/{app}/roles/")] [ProducesResponseType(typeof(RolesDto), StatusCodes.Status200OK)] @@ -60,10 +58,8 @@ public sealed class AppRolesController : ApiController /// Get app permissions. /// /// The name of the app. - /// - /// 200 => App permissions returned. - /// 404 => App not found. - /// + /// App permissions returned.. + /// App not found.. [HttpGet] [Route("apps/{app}/roles/permissions")] [ProducesResponseType(typeof(string[]), StatusCodes.Status200OK)] @@ -86,11 +82,9 @@ public sealed class AppRolesController : ApiController /// /// The name of the app. /// Role object that needs to be added to the app. - /// - /// 201 => Role created. - /// 400 => Role request not valid. - /// 404 => App not found. - /// + /// Role created.. + /// Role request not valid.. + /// App not found.. [HttpPost] [Route("apps/{app}/roles/")] [ProducesResponseType(typeof(RolesDto), 201)] @@ -111,11 +105,9 @@ public sealed class AppRolesController : ApiController /// The name of the app. /// The name of the role to be updated. /// Role to be updated for the app. - /// - /// 200 => Role updated. - /// 400 => Role request not valid. - /// 404 => Role or app not found. - /// + /// Role updated.. + /// Role request not valid.. + /// Role or app not found.. [HttpPut] [Route("apps/{app}/roles/{roleName}/")] [ProducesResponseType(typeof(RolesDto), StatusCodes.Status200OK)] @@ -136,11 +128,9 @@ public sealed class AppRolesController : ApiController /// /// The name of the app. /// The name of the role. - /// - /// 200 => Role deleted. - /// 400 => Role is in use by contributor or client or a default role. - /// 404 => Role or app not found. - /// + /// Role deleted.. + /// Role is in use by contributor or client or a default role.. + /// Role or app not found.. [HttpDelete] [Route("apps/{app}/roles/{roleName}/")] [ProducesResponseType(typeof(RolesDto), StatusCodes.Status200OK)] diff --git a/backend/src/Squidex/Areas/Api/Controllers/Apps/AppSettingsController.cs b/backend/src/Squidex/Areas/Api/Controllers/Apps/AppSettingsController.cs index ff0dd8434..50a504bcd 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Apps/AppSettingsController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Apps/AppSettingsController.cs @@ -29,10 +29,8 @@ public sealed class AppSettingsController : ApiController /// Get the app settings. /// /// The name of the app to get the settings for. - /// - /// 200 => App settings returned. - /// 404 => App not found. - /// + /// App settings returned.. + /// App not found.. [HttpGet] [Route("apps/{app}/settings")] [ProducesResponseType(typeof(AppSettingsDto), StatusCodes.Status200OK)] @@ -53,11 +51,9 @@ public sealed class AppSettingsController : ApiController /// /// The name of the app to update. /// The values to update. - /// - /// 200 => App updated. - /// 400 => App request not valid. - /// 404 => App not found. - /// + /// App updated.. + /// App request not valid.. + /// App not found.. [HttpPut] [Route("apps/{app}/settings")] [ProducesResponseType(typeof(AppSettingsDto), StatusCodes.Status200OK)] diff --git a/backend/src/Squidex/Areas/Api/Controllers/Apps/AppWorkflowsController.cs b/backend/src/Squidex/Areas/Api/Controllers/Apps/AppWorkflowsController.cs index 26ebf8e84..8e3714bd4 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Apps/AppWorkflowsController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Apps/AppWorkflowsController.cs @@ -36,10 +36,8 @@ public sealed class AppWorkflowsController : ApiController /// Get app workflow. /// /// The name of the app. - /// - /// 200 => Workflows returned. - /// 404 => App not found. - /// + /// Workflows returned.. + /// App not found.. [HttpGet] [Route("apps/{app}/workflows/")] [ProducesResponseType(typeof(WorkflowsDto), StatusCodes.Status200OK)] @@ -62,11 +60,9 @@ public sealed class AppWorkflowsController : ApiController /// /// The name of the app. /// The new workflow. - /// - /// 200 => Workflow created. - /// 400 => Workflow request not valid. - /// 404 => Workflow or app not found. - /// + /// Workflow created.. + /// Workflow request not valid.. + /// Workflow or app not found.. [HttpPost] [Route("apps/{app}/workflows/")] [ProducesResponseType(typeof(WorkflowsDto), StatusCodes.Status200OK)] @@ -87,11 +83,9 @@ public sealed class AppWorkflowsController : ApiController /// The name of the app. /// The ID of the workflow to update. /// The new workflow. - /// - /// 200 => Workflow updated. - /// 400 => Workflow request not valid. - /// 404 => Workflow or app not found. - /// + /// Workflow updated.. + /// Workflow request not valid.. + /// Workflow or app not found.. [HttpPut] [Route("apps/{app}/workflows/{id}")] [ProducesResponseType(typeof(WorkflowsDto), StatusCodes.Status200OK)] @@ -111,10 +105,8 @@ public sealed class AppWorkflowsController : ApiController /// /// The name of the app. /// The ID of the workflow to update. - /// - /// 200 => Workflow deleted. - /// 404 => Workflow or app not found. - /// + /// Workflow deleted.. + /// Workflow or app not found.. [HttpDelete] [Route("apps/{app}/workflows/{id}")] [ProducesResponseType(typeof(WorkflowsDto), StatusCodes.Status200OK)] diff --git a/backend/src/Squidex/Areas/Api/Controllers/Apps/AppsController.cs b/backend/src/Squidex/Areas/Api/Controllers/Apps/AppsController.cs index 164851699..f6a66b6cc 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Apps/AppsController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Apps/AppsController.cs @@ -37,9 +37,7 @@ public sealed class AppsController : ApiController /// /// Get your apps. /// - /// - /// 200 => Apps returned. - /// + /// Apps returned.. /// /// You can only retrieve the list of apps when you are authenticated as a user (OpenID implicit flow). /// You will retrieve all apps, where you are assigned as a contributor. @@ -70,9 +68,7 @@ public sealed class AppsController : ApiController /// Get team apps. /// /// The ID of the team. - /// - /// 200 => Apps returned. - /// + /// Apps returned.. /// /// You can only retrieve the list of apps when you are authenticated as a user (OpenID implicit flow). /// You will retrieve all apps, where you are assigned as a contributor. @@ -100,10 +96,8 @@ public sealed class AppsController : ApiController /// Get an app by name. /// /// The name of the app. - /// - /// 200 => Apps returned. - /// 404 => App not found. - /// + /// Apps returned.. + /// App not found.. [HttpGet] [Route("apps/{app}")] [ProducesResponseType(typeof(AppDto), StatusCodes.Status200OK)] @@ -127,11 +121,9 @@ public sealed class AppsController : ApiController /// Create a new app. /// /// The app object that needs to be added to Squidex. - /// - /// 201 => App created. - /// 400 => App request not valid. - /// 409 => App name is already in use. - /// + /// App created.. + /// App request not valid.. + /// App name is already in use.. /// /// You can only create an app when you are authenticated as a user (OpenID implicit flow). /// You will be assigned as owner of the new app automatically. @@ -153,11 +145,9 @@ public sealed class AppsController : ApiController /// /// The name of the app to update. /// The values to update. - /// - /// 200 => App updated. - /// 400 => App request not valid. - /// 404 => App not found. - /// + /// App updated.. + /// App request not valid.. + /// App not found.. [HttpPut] [Route("apps/{app}/")] [ProducesResponseType(typeof(AppDto), StatusCodes.Status200OK)] @@ -175,11 +165,9 @@ public sealed class AppsController : ApiController /// /// The name of the app to update. /// The team information. - /// - /// 200 => App transferred. - /// 400 => App request not valid. - /// 404 => App not found. - /// + /// App transferred.. + /// App request not valid.. + /// App not found.. [HttpPut] [Route("apps/{app}/team")] [ProducesResponseType(typeof(AppDto), StatusCodes.Status200OK)] @@ -197,11 +185,9 @@ public sealed class AppsController : ApiController /// /// The name of the app to update. /// The file to upload. - /// - /// 200 => App image uploaded. - /// 400 => App request not valid. - /// 404 => App not found. - /// + /// App image uploaded.. + /// App request not valid.. + /// App not found.. [HttpPost] [Route("apps/{app}/image")] [ProducesResponseType(typeof(AppDto), StatusCodes.Status200OK)] @@ -218,10 +204,8 @@ public sealed class AppsController : ApiController /// Remove the app image. /// /// The name of the app to update. - /// - /// 200 => App image removed. - /// 404 => App not found. - /// + /// App image removed.. + /// App not found.. [HttpDelete] [Route("apps/{app}/image")] [ProducesResponseType(typeof(AppDto), StatusCodes.Status200OK)] @@ -238,12 +222,11 @@ public sealed class AppsController : ApiController /// Delete the app. /// /// The name of the app to delete. - /// - /// 204 => App deleted. - /// 404 => App not found. - /// + /// App deleted.. + /// App not found.. [HttpDelete] [Route("apps/{app}/")] + [ProducesResponseType(StatusCodes.Status204NoContent)] [ApiPermission(PermissionIds.AppDelete)] [ApiCosts(0)] public async Task DeleteApp(string app) diff --git a/backend/src/Squidex/Areas/Api/Controllers/Assets/AssetContentController.cs b/backend/src/Squidex/Areas/Api/Controllers/Assets/AssetContentController.cs index d8ff8cf5c..f11176e92 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Assets/AssetContentController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Assets/AssetContentController.cs @@ -52,10 +52,8 @@ public sealed class AssetContentController : ApiController /// The id or slug of the asset. /// The request parameters. /// Optional suffix that can be used to seo-optimize the link to the image Has not effect. - /// - /// 200 => Asset found and content or (resized) image returned. - /// 404 => Asset or app not found. - /// + /// Asset found and content or (resized) image returned.. + /// Asset or app not found.. [HttpGet] [Route("assets/{app}/{idOrSlug}/{*more}")] [ProducesResponseType(typeof(FileResult), StatusCodes.Status200OK)] @@ -81,10 +79,8 @@ public sealed class AssetContentController : ApiController /// /// The ID of the asset. /// The request parameters. - /// - /// 200 => Asset found and content or (resized) image returned. - /// 404 => Asset or app not found. - /// + /// Asset found and content or (resized) image returned.. + /// Asset or app not found.. [HttpGet] [Route("assets/{id}/")] [ProducesResponseType(typeof(FileResult), StatusCodes.Status200OK)] diff --git a/backend/src/Squidex/Areas/Api/Controllers/Assets/AssetFoldersController.cs b/backend/src/Squidex/Areas/Api/Controllers/Assets/AssetFoldersController.cs index 4e05d1b75..6ebc61815 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Assets/AssetFoldersController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Assets/AssetFoldersController.cs @@ -39,10 +39,8 @@ public sealed class AssetFoldersController : ApiController /// The name of the app. /// The optional parent folder id. /// The scope of the query. - /// - /// 200 => Asset folders returned. - /// 404 => App not found. - /// + /// Asset folders returned.. + /// App not found.. /// /// Get all asset folders for the app. /// @@ -72,11 +70,9 @@ public sealed class AssetFoldersController : ApiController /// /// The name of the app. /// The asset folder object that needs to be added to the App. - /// - /// 201 => Asset folder created. - /// 400 => Asset folder request not valid. - /// 404 => App not found. - /// + /// Asset folder created.. + /// Asset folder request not valid.. + /// App not found.. [HttpPost] [Route("apps/{app}/assets/folders", Order = -1)] [ProducesResponseType(typeof(AssetFolderDto), StatusCodes.Status201Created)] @@ -98,11 +94,9 @@ public sealed class AssetFoldersController : ApiController /// The name of the app. /// The ID of the asset folder. /// The asset folder object that needs to updated. - /// - /// 200 => Asset folder updated. - /// 400 => Asset folder request not valid. - /// 404 => Asset folder or app not found. - /// + /// Asset folder updated.. + /// Asset folder request not valid.. + /// Asset folder or app not found.. [HttpPut] [Route("apps/{app}/assets/folders/{id}/", Order = -1)] [ProducesResponseType(typeof(AssetFolderDto), StatusCodes.Status200OK)] @@ -124,11 +118,9 @@ public sealed class AssetFoldersController : ApiController /// The name of the app. /// The ID of the asset folder. /// The asset folder object that needs to updated. - /// - /// 200 => Asset folder moved. - /// 400 => Asset folder request not valid. - /// 404 => Asset folder or app not found. - /// + /// Asset folder moved.. + /// Asset folder request not valid.. + /// Asset folder or app not found.. [HttpPut] [Route("apps/{app}/assets/folders/{id}/parent", Order = -1)] [ProducesResponseType(typeof(AssetFolderDto), StatusCodes.Status200OK)] @@ -149,12 +141,11 @@ public sealed class AssetFoldersController : ApiController /// /// The name of the app. /// The ID of the asset folder to delete. - /// - /// 204 => Asset folder deleted. - /// 404 => Asset folder or app not found. - /// + /// Asset folder deleted.. + /// Asset folder or app not found.. [HttpDelete] [Route("apps/{app}/assets/folders/{id}/", Order = -1)] + [ProducesResponseType(StatusCodes.Status204NoContent)] [ApiPermissionOrAnonymous(PermissionIds.AppAssetsUpdate)] [ApiCosts(1)] public async Task DeleteAssetFolder(string app, DomainId id) diff --git a/backend/src/Squidex/Areas/Api/Controllers/Assets/AssetsController.cs b/backend/src/Squidex/Areas/Api/Controllers/Assets/AssetsController.cs index fc1d6592f..f949f8a2f 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Assets/AssetsController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Assets/AssetsController.cs @@ -8,7 +8,6 @@ using System.Globalization; using Microsoft.AspNetCore.Mvc; using Microsoft.Net.Http.Headers; -using NSwag.Annotations; using Squidex.Areas.Api.Controllers.Assets.Models; using Squidex.Assets; using Squidex.Domain.Apps.Core.Scripting; @@ -58,10 +57,8 @@ public sealed class AssetsController : ApiController /// Get assets tags. /// /// The name of the app. - /// - /// 200 => Assets tags returned. - /// 404 => App not found. - /// + /// Assets tags returned.. + /// App not found.. /// /// Get all tags for assets. /// @@ -85,10 +82,8 @@ public sealed class AssetsController : ApiController /// The name of the app. /// The tag to return. /// The required request object. - /// - /// 200 => Asset tag renamed and new tags returned. - /// 404 => App not found. - /// + /// Asset tag renamed and new tags returned.. + /// App not found.. [HttpPut] [Route("apps/{app}/assets/tags/{name}")] [ProducesResponseType(typeof(Dictionary), StatusCodes.Status200OK)] @@ -108,10 +103,8 @@ public sealed class AssetsController : ApiController /// The optional parent folder id. /// The optional asset ids. /// The optional json query. - /// - /// 200 => Assets returned. - /// 404 => App not found. - /// + /// Assets returned.. + /// App not found.. /// /// Get all assets for the app. /// @@ -137,10 +130,8 @@ public sealed class AssetsController : ApiController /// /// The name of the app. /// The required query object. - /// - /// 200 => Assets returned. - /// 404 => App not found. - /// + /// Assets returned.. + /// App not found.. /// /// Get all assets for the app. /// @@ -166,10 +157,8 @@ public sealed class AssetsController : ApiController /// /// The name of the app. /// The ID of the asset to retrieve. - /// - /// 200 => Asset found. - /// 404 => Asset or app not found. - /// + /// Asset found.. + /// Asset or app not found.. [HttpGet] [Route("apps/{app}/assets/{id}/")] [ProducesResponseType(typeof(AssetDto), StatusCodes.Status200OK)] @@ -197,12 +186,10 @@ public sealed class AssetsController : ApiController /// /// The name of the app. /// The request parameters. - /// - /// 201 => Asset created. - /// 400 => Asset request not valid. - /// 413 => Asset exceeds the maximum upload size. - /// 404 => App not found. - /// + /// Asset created.. + /// Asset request not valid.. + /// Asset exceeds the maximum upload size.. + /// App not found.. /// /// You can only upload one file at a time. The mime type of the file is not calculated by Squidex and is required correctly. /// @@ -225,16 +212,14 @@ public sealed class AssetsController : ApiController /// Upload a new asset using tus.io. /// /// The name of the app. - /// - /// 201 => Asset created. - /// 400 => Asset request not valid. - /// 413 => Asset exceeds the maximum upload size. - /// 404 => App not found. - /// + /// Asset created.. + /// Asset request not valid.. + /// Asset exceeds the maximum upload size.. + /// App not found.. /// /// Use the tus protocol to upload an asset. /// - [OpenApiIgnore] + [ApiExplorerSettings(IgnoreApi = true)] [Route("apps/{app}/assets/tus/{**fileId}")] [ProducesResponseType(typeof(AssetDto), StatusCodes.Status201Created)] [AssetRequestSizeLimit] @@ -263,11 +248,9 @@ public sealed class AssetsController : ApiController /// /// The name of the app. /// The bulk update request. - /// - /// 200 => Assets created, update or delete. - /// 400 => Assets request not valid. - /// 404 => App not found. - /// + /// Assets created, update or delete.. + /// Assets request not valid.. + /// App not found.. [HttpPost] [Route("apps/{app}/assets/bulk")] [ProducesResponseType(typeof(BulkResultDto[]), StatusCodes.Status200OK)] @@ -291,12 +274,10 @@ public sealed class AssetsController : ApiController /// The name of the app. /// The optional custom asset id. /// The request parameters. - /// - /// 200 => Asset created or updated. - /// 400 => Asset request not valid. - /// 413 => Asset exceeds the maximum upload size. - /// 404 => App not found. - /// + /// Asset created or updated.. + /// Asset request not valid.. + /// Asset exceeds the maximum upload size.. + /// App not found.. /// /// You can only upload one file at a time. The mime type of the file is not calculated by Squidex and is required correctly. /// @@ -321,12 +302,10 @@ public sealed class AssetsController : ApiController /// The name of the app. /// The ID of the asset. /// The file to upload. - /// - /// 200 => Asset updated. - /// 400 => Asset request not valid. - /// 413 => Asset exceeds the maximum upload size. - /// 404 => Asset or app not found. - /// + /// Asset updated.. + /// Asset request not valid.. + /// Asset exceeds the maximum upload size.. + /// Asset or app not found.. /// /// Use multipart request to upload an asset. /// @@ -351,11 +330,9 @@ public sealed class AssetsController : ApiController /// The name of the app. /// The ID of the asset. /// The asset object that needs to updated. - /// - /// 200 => Asset updated. - /// 400 => Asset request not valid. - /// 404 => Asset or app not found. - /// + /// Asset updated.. + /// Asset request not valid.. + /// Asset or app not found.. [HttpPut] [Route("apps/{app}/assets/{id}/")] [ProducesResponseType(typeof(AssetDto), StatusCodes.Status200OK)] @@ -377,11 +354,9 @@ public sealed class AssetsController : ApiController /// The name of the app. /// The ID of the asset. /// The asset object that needs to updated. - /// - /// 200 => Asset moved. - /// 400 => Asset request not valid. - /// 404 => Asset or app not found. - /// + /// Asset moved.. + /// Asset request not valid.. + /// Asset or app not found.. [HttpPut] [Route("apps/{app}/assets/{id}/parent")] [ProducesResponseType(typeof(AssetDto), StatusCodes.Status200OK)] @@ -403,12 +378,11 @@ public sealed class AssetsController : ApiController /// The name of the app. /// The ID of the asset to delete. /// The request parameters. - /// - /// 204 => Asset deleted. - /// 404 => Asset or app not found. - /// + /// Asset deleted.. + /// Asset or app not found.. [HttpDelete] [Route("apps/{app}/assets/{id}/")] + [ProducesResponseType(StatusCodes.Status204NoContent)] [ApiPermissionOrAnonymous(PermissionIds.AppAssetsDelete)] [ApiCosts(1)] public async Task DeleteAsset(string app, DomainId id, DeleteAssetDto request) @@ -424,7 +398,7 @@ public sealed class AssetsController : ApiController [Route("apps/{app}/assets/completion")] [ApiPermissionOrAnonymous] [ApiCosts(1)] - [OpenApiIgnore] + [ApiExplorerSettings(IgnoreApi = true)] public IActionResult GetScriptCompletion(string app, string schema, [FromServices] ScriptingCompleter completer) { @@ -437,7 +411,7 @@ public sealed class AssetsController : ApiController [Route("apps/{app}/assets/completion/trigger")] [ApiPermissionOrAnonymous] [ApiCosts(1)] - [OpenApiIgnore] + [ApiExplorerSettings(IgnoreApi = true)] public IActionResult GetScriptTriggerCompletion(string app, string schema, [FromServices] ScriptingCompleter completer) { diff --git a/backend/src/Squidex/Areas/Api/Controllers/Assets/Models/AssetContentQueryDto.cs b/backend/src/Squidex/Areas/Api/Controllers/Assets/Models/AssetContentQueryDto.cs index 1140d9d4b..c2daa2e74 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Assets/Models/AssetContentQueryDto.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Assets/Models/AssetContentQueryDto.cs @@ -132,7 +132,7 @@ public sealed class AssetContentQueryDto request.Headers.TryGetValue("Accept", out var accept); - return accept.Any(x => x.Contains(mimeType, StringComparison.OrdinalIgnoreCase)) && assetThumbnailGenerator.CanReadAndWrite(mimeType); + return accept.Any(x => x?.Contains(mimeType, StringComparison.OrdinalIgnoreCase) == true) && assetThumbnailGenerator.CanReadAndWrite(mimeType); } #if ENABLE_AVIF if (Accepts("image/avif")) diff --git a/backend/src/Squidex/Areas/Api/Controllers/Backups/BackupContentController.cs b/backend/src/Squidex/Areas/Api/Controllers/Backups/BackupContentController.cs index 066e1c42f..77cb1644f 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Backups/BackupContentController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Backups/BackupContentController.cs @@ -37,10 +37,8 @@ public class BackupContentController : ApiController /// /// The name of the app. /// The ID of the backup. - /// - /// 200 => Backup found and content returned. - /// 404 => Backup or app not found. - /// + /// Backup found and content returned.. + /// Backup or app not found.. [HttpGet] [Route("apps/{app}/backups/{id}")] [ResponseCache(Duration = 3600 * 24 * 30)] @@ -58,10 +56,8 @@ public class BackupContentController : ApiController /// The ID of the backup. /// The ID of the app. /// The name of the app. - /// - /// 200 => Backup found and content returned. - /// 404 => Backup or app not found. - /// + /// Backup found and content returned.. + /// Backup or app not found.. [HttpGet] [Route("apps/backups/{id}")] [ResponseCache(Duration = 3600 * 24 * 30)] diff --git a/backend/src/Squidex/Areas/Api/Controllers/Backups/BackupsController.cs b/backend/src/Squidex/Areas/Api/Controllers/Backups/BackupsController.cs index 2df6b8447..080611e0e 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Backups/BackupsController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Backups/BackupsController.cs @@ -34,10 +34,8 @@ public class BackupsController : ApiController /// Get all backup jobs. /// /// The name of the app. - /// - /// 200 => Backups returned. - /// 404 => App not found. - /// + /// Backups returned.. + /// App not found.. [HttpGet] [Route("apps/{app}/backups/")] [ProducesResponseType(typeof(BackupJobsDto), StatusCodes.Status200OK)] @@ -56,14 +54,12 @@ public class BackupsController : ApiController /// Start a new backup. /// /// The name of the app. - /// - /// 204 => Backup started. - /// 400 => Backup contingent reached. - /// 404 => App not found. - /// + /// Backup started.. + /// Backup contingent reached.. + /// App not found.. [HttpPost] [Route("apps/{app}/backups/")] - [ProducesResponseType(typeof(BackupJobDto[]), StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status204NoContent)] [ApiPermissionOrAnonymous(PermissionIds.AppBackupsCreate)] [ApiCosts(0)] public async Task PostBackup(string app) @@ -78,13 +74,11 @@ public class BackupsController : ApiController /// /// The name of the app. /// The ID of the backup to delete. - /// - /// 204 => Backup deleted. - /// 404 => Backup or app not found. - /// + /// Backup deleted.. + /// Backup or app not found.. [HttpDelete] [Route("apps/{app}/backups/{id}")] - [ProducesResponseType(typeof(BackupJobDto[]), StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status204NoContent)] [ApiPermissionOrAnonymous(PermissionIds.AppBackupsDelete)] [ApiCosts(0)] public async Task DeleteBackup(string app, DomainId id) diff --git a/backend/src/Squidex/Areas/Api/Controllers/Backups/RestoreController.cs b/backend/src/Squidex/Areas/Api/Controllers/Backups/RestoreController.cs index aed62a568..09bf5ad81 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Backups/RestoreController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Backups/RestoreController.cs @@ -33,9 +33,7 @@ public class RestoreController : ApiController /// /// Get current restore status. /// - /// - /// 200 => Status returned. - /// + /// Status returned.. [HttpGet] [Route("apps/restore/")] [ProducesResponseType(typeof(RestoreJobDto), StatusCodes.Status200OK)] @@ -58,11 +56,10 @@ public class RestoreController : ApiController /// Restore a backup. /// /// The backup to restore. - /// - /// 204 => Restore operation started. - /// + /// Restore operation started.. [HttpPost] [Route("apps/restore/")] + [ProducesResponseType(StatusCodes.Status204NoContent)] [ApiPermission(PermissionIds.AdminRestore)] public async Task PostRestoreJob([FromBody] RestoreRequestDto request) { diff --git a/backend/src/Squidex/Areas/Api/Controllers/Comments/CommentsController.cs b/backend/src/Squidex/Areas/Api/Controllers/Comments/CommentsController.cs index ad19cc437..8fbada1be 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Comments/CommentsController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Comments/CommentsController.cs @@ -41,10 +41,8 @@ public sealed class CommentsController : ApiController /// /// The name of the app. /// The path to the resource. - /// - /// 200 => Watching users returned. - /// 404 => App not found. - /// + /// Watching users returned.. + /// App not found.. [HttpGet] [Route("apps/{app}/watching/{*resource}")] [ProducesResponseType(typeof(string[]), StatusCodes.Status200OK)] @@ -66,10 +64,8 @@ public sealed class CommentsController : ApiController /// /// When passing in a version you can retrieve all updates since then. /// - /// - /// 200 => Comments returned. - /// 404 => App not found. - /// + /// Comments returned.. + /// App not found.. [HttpGet] [Route("apps/{app}/comments/{commentsId}")] [ProducesResponseType(typeof(CommentsDto), StatusCodes.Status200OK)] @@ -95,11 +91,9 @@ public sealed class CommentsController : ApiController /// The name of the app. /// The ID of the comments. /// The comment object that needs to created. - /// - /// 201 => Comment created. - /// 400 => Comment request not valid. - /// 404 => App not found. - /// + /// Comment created.. + /// Comment request not valid.. + /// App not found.. [HttpPost] [Route("apps/{app}/comments/{commentsId}")] [ProducesResponseType(typeof(CommentDto), 201)] @@ -123,13 +117,12 @@ public sealed class CommentsController : ApiController /// The ID of the comments. /// The ID of the comment. /// The comment object that needs to updated. - /// - /// 204 => Comment updated. - /// 400 => Comment request not valid. - /// 404 => Comment or app not found. - /// + /// Comment updated.. + /// Comment request not valid.. + /// Comment or app not found.. [HttpPut] [Route("apps/{app}/comments/{commentsId}/{commentId}")] + [ProducesResponseType(StatusCodes.Status204NoContent)] [ApiPermissionOrAnonymous(PermissionIds.AppCommentsUpdate)] [ApiCosts(0)] public async Task PutComment(string app, DomainId commentsId, DomainId commentId, [FromBody] UpsertCommentDto request) @@ -147,12 +140,11 @@ public sealed class CommentsController : ApiController /// The name of the app. /// The ID of the comments. /// The ID of the comment. - /// - /// 204 => Comment deleted. - /// 404 => Comment or app not found. - /// + /// Comment deleted.. + /// Comment or app not found.. [HttpDelete] [Route("apps/{app}/comments/{commentsId}/{commentId}")] + [ProducesResponseType(StatusCodes.Status204NoContent)] [ApiPermissionOrAnonymous(PermissionIds.AppCommentsDelete)] [ApiCosts(0)] public async Task DeleteComment(string app, DomainId commentsId, DomainId commentId) diff --git a/backend/src/Squidex/Areas/Api/Controllers/Comments/Notifications/UserNotificationsController.cs b/backend/src/Squidex/Areas/Api/Controllers/Comments/Notifications/UserNotificationsController.cs index b10aa5b55..bb07151b9 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Comments/Notifications/UserNotificationsController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Comments/Notifications/UserNotificationsController.cs @@ -41,9 +41,7 @@ public sealed class UserNotificationsController : ApiController /// /// When passing in a version you can retrieve all updates since then. /// - /// - /// 200 => All comments returned. - /// + /// All comments returned.. [HttpGet] [Route("users/{userId}/notifications")] [ProducesResponseType(typeof(CommentsDto), StatusCodes.Status200OK)] @@ -69,12 +67,11 @@ public sealed class UserNotificationsController : ApiController /// /// The user id. /// The ID of the comment. - /// - /// 204 => Comment deleted. - /// 404 => Comment not found. - /// + /// Comment deleted.. + /// Comment not found.. [HttpDelete] [Route("users/{userId}/notifications/{commentId}")] + [ProducesResponseType(StatusCodes.Status204NoContent)] [ApiPermission] public async Task DeleteComment(DomainId userId, DomainId commentId) { diff --git a/backend/src/Squidex/Areas/Api/Controllers/Contents/ContentsController.cs b/backend/src/Squidex/Areas/Api/Controllers/Contents/ContentsController.cs index 1ea706f43..3238af0f5 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Contents/ContentsController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Contents/ContentsController.cs @@ -40,10 +40,8 @@ public sealed class ContentsController : ApiController /// The name of the schema. /// The optional ids of the content to fetch. /// The optional json query. - /// - /// 200 => Contents retunred. - /// 404 => Schema or app not found. - /// + /// Contents retunred.. + /// Schema or app not found.. /// /// You can read the generated documentation for your app at /api/content/{appName}/docs. /// @@ -70,10 +68,8 @@ public sealed class ContentsController : ApiController /// The name of the app. /// The name of the schema. /// The required query object. - /// - /// 200 => Contents returned. - /// 404 => Schema or app not found. - /// + /// Contents returned.. + /// Schema or app not found.. /// /// You can read the generated documentation for your app at /api/content/{appName}/docs. /// @@ -101,10 +97,8 @@ public sealed class ContentsController : ApiController /// The name of the schema. /// The ID of the content to fetch. /// The optional version. - /// - /// 200 => Content returned. - /// 404 => Content, schema or app not found. - /// + /// Content returned.. + /// Content, schema or app not found.. /// /// You can read the generated documentation for your app at /api/content/{appName}/docs. /// @@ -136,16 +130,15 @@ public sealed class ContentsController : ApiController /// The name of the app. /// The name of the schema. /// The ID of the content to fetch. - /// - /// 204 => Content is valid. - /// 400 => Content not valid. - /// 404 => Content, schema or app not found. - /// + /// Content is valid.. + /// Content not valid.. + /// Content, schema or app not found.. /// /// You can read the generated documentation for your app at /api/content/{appName}/docs. /// [HttpGet] [Route("content/{app}/{schema}/{id}/validity")] + [ProducesResponseType(StatusCodes.Status204NoContent)] [ApiPermissionOrAnonymous] [ApiCosts(1)] public async Task GetContentValidity(string app, string schema, DomainId id) @@ -164,10 +157,8 @@ public sealed class ContentsController : ApiController /// The name of the schema. /// The ID of the content to fetch. /// The optional json query. - /// - /// 200 => Contents returned. - /// 404 => Content, schema or app not found. - /// + /// Contents returned.. + /// Content, schema or app not found.. /// /// You can read the generated documentation for your app at /api/content/{appName}/docs. /// @@ -195,10 +186,8 @@ public sealed class ContentsController : ApiController /// The name of the schema. /// The ID of the content to fetch. /// The optional json query. - /// - /// 200 => Content returned. - /// 404 => Content, schema or app not found. - /// + /// Content returned.. + /// Content, schema or app not found.. /// /// You can read the generated documentation for your app at /api/content/{appName}/docs. /// @@ -226,10 +215,8 @@ public sealed class ContentsController : ApiController /// The name of the schema. /// The ID of the content to fetch. /// The version fo the content to fetch. - /// - /// 200 => Content version returned. - /// 404 => Content, schema or app not found. - /// + /// Content version returned.. + /// Content, schema or app not found.. /// /// You can read the generated documentation for your app at /api/content/{appName}/docs. /// @@ -261,11 +248,9 @@ public sealed class ContentsController : ApiController /// The name of the app. /// The name of the schema. /// The request parameters. - /// - /// 201 => Content created. - /// 400 => Content request not valid. - /// 404 => Content, schema or app not found. - /// + /// Content created.. + /// Content request not valid.. + /// Content, schema or app not found.. /// /// You can read the generated documentation for your app at /api/content/{appName}/docs. /// @@ -289,11 +274,9 @@ public sealed class ContentsController : ApiController /// The name of the app. /// The name of the schema. /// The import request. - /// - /// 200 => Contents created. - /// 400 => Content request not valid. - /// 404 => Content references, schema or app not found. - /// + /// Contents created.. + /// Content request not valid.. + /// Content references, schema or app not found.. /// /// You can read the generated documentation for your app at /api/content/{appName}/docs. /// @@ -321,11 +304,9 @@ public sealed class ContentsController : ApiController /// The name of the app. /// The name of the schema. /// The bulk update request. - /// - /// 201 => Contents created, update or delete. - /// 400 => Contents request not valid. - /// 404 => Contents references, schema or app not found. - /// + /// Contents created, update or delete.. + /// Contents request not valid.. + /// Contents references, schema or app not found.. /// /// You can read the generated documentation for your app at /api/content/{appName}/docs. /// @@ -353,11 +334,9 @@ public sealed class ContentsController : ApiController /// The name of the schema. /// The ID of the content item to update. /// The request parameters. - /// - /// 200 => Content created or updated. - /// 400 => Content request not valid. - /// 404 => Content references, schema or app not found. - /// + /// Content created or updated.. + /// Content request not valid.. + /// Content references, schema or app not found.. /// /// You can read the generated documentation for your app at /api/content/{appName}/docs. /// @@ -382,11 +361,9 @@ public sealed class ContentsController : ApiController /// The name of the schema. /// The ID of the content item to update. /// The full data for the content item. - /// - /// 200 => Content updated. - /// 400 => Content request not valid. - /// 404 => Content references, schema or app not found. - /// + /// Content updated.. + /// Content request not valid.. + /// Content references, schema or app not found.. /// /// You can read the generated documentation for your app at /api/content/{appName}/docs. /// @@ -411,11 +388,9 @@ public sealed class ContentsController : ApiController /// The name of the schema. /// The ID of the content item to patch. /// The patch for the content item. - /// - /// 200 => Content patched. - /// 400 => Content request not valid. - /// 404 => Content, schema or app not found. - /// + /// Content patched.. + /// Content request not valid.. + /// Content, schema or app not found.. /// /// You can read the generated documentation for your app at /api/content/{appName}/docs. /// @@ -440,11 +415,9 @@ public sealed class ContentsController : ApiController /// The name of the schema. /// The ID of the content item to change. /// The status request. - /// - /// 200 => Content status changed. - /// 400 => Content request not valid. - /// 404 => Content, schema or app not found. - /// + /// Content status changed.. + /// Content request not valid.. + /// Content, schema or app not found.. /// /// You can read the generated documentation for your app at /api/content/{appName}/docs. /// @@ -468,11 +441,9 @@ public sealed class ContentsController : ApiController /// The name of the app. /// The name of the schema. /// The ID of the content item to cancel. - /// - /// 200 => Content status change cancelled. - /// 400 => Content request not valid. - /// 404 => Content, schema or app not found. - /// + /// Content status change cancelled.. + /// Content request not valid.. + /// Content, schema or app not found.. /// /// You can read the generated documentation for your app at /api/content/{appName}/docs. /// @@ -496,10 +467,8 @@ public sealed class ContentsController : ApiController /// The name of the app. /// The name of the schema. /// The ID of the content item to create the draft for. - /// - /// 200 => Content draft created. - /// 404 => Content, schema or app not found. - /// + /// Content draft created.. + /// Content, schema or app not found.. /// /// You can read the generated documentation for your app at /api/content/{appName}/docs. /// @@ -523,10 +492,8 @@ public sealed class ContentsController : ApiController /// The name of the app. /// The name of the schema. /// The ID of the content item to delete the draft from. - /// - /// 200 => Content draft deleted. - /// 404 => Content, schema or app not found. - /// + /// Content draft deleted.. + /// Content, schema or app not found.. /// /// You can read the generated documentation for your app at /api/content/{appName}/docs. /// @@ -551,16 +518,15 @@ public sealed class ContentsController : ApiController /// The name of the schema. /// The ID of the content item to delete. /// The request parameters. - /// - /// 204 => Content deleted. - /// 400 => Content cannot be deleted. - /// 404 => Content, schema or app not found. - /// + /// Content deleted.. + /// Content cannot be deleted.. + /// Content, schema or app not found.. /// /// You can create an generated documentation for your app at /api/content/{appName}/docs. /// [HttpDelete] [Route("content/{app}/{schema}/{id}/")] + [ProducesResponseType(StatusCodes.Status204NoContent)] [ApiPermissionOrAnonymous(PermissionIds.AppContentsDeleteOwn)] [ApiCosts(1)] public async Task DeleteContent(string app, string schema, DomainId id, DeleteContentDto request) diff --git a/backend/src/Squidex/Areas/Api/Controllers/Contents/ContentsSharedController.cs b/backend/src/Squidex/Areas/Api/Controllers/Contents/ContentsSharedController.cs index c22fd94f6..d70edfd7a 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Contents/ContentsSharedController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Contents/ContentsSharedController.cs @@ -38,10 +38,8 @@ public sealed class ContentsSharedController : ApiController /// GraphQL endpoint. /// /// The name of the app. - /// - /// 200 => Contents returned or mutated. - /// 404 => App not found. - /// + /// Contents returned or mutated.. + /// App not found.. /// /// You can read the generated documentation for your app at /api/content/{appName}/docs. /// @@ -61,10 +59,8 @@ public sealed class ContentsSharedController : ApiController /// /// The name of the app. /// The required query object. - /// - /// 200 => Contents returned. - /// 404 => App not found. - /// + /// Contents returned.. + /// App not found.. /// /// You can read the generated documentation for your app at /api/content/{appName}/docs. /// @@ -90,10 +86,8 @@ public sealed class ContentsSharedController : ApiController /// /// The name of the app. /// The required query object. - /// - /// 200 => Contents returned. - /// 404 => App not found. - /// + /// Contents returned.. + /// App not found.. /// /// You can read the generated documentation for your app at /api/content/{appName}/docs. /// @@ -120,11 +114,9 @@ public sealed class ContentsSharedController : ApiController /// The name of the app. /// The name of the schema. /// The bulk update request. - /// - /// 201 => Contents created, update or delete. - /// 400 => Contents request not valid. - /// 404 => Contents references, schema or app not found. - /// + /// Contents created, update or delete.. + /// Contents request not valid.. + /// Contents references, schema or app not found.. /// /// You can read the generated documentation for your app at /api/content/{appName}/docs. /// diff --git a/backend/src/Squidex/Areas/Api/Controllers/Diagnostics/DiagnosticsController.cs b/backend/src/Squidex/Areas/Api/Controllers/Diagnostics/DiagnosticsController.cs index c1f9e6269..371a0c185 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Diagnostics/DiagnosticsController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Diagnostics/DiagnosticsController.cs @@ -30,12 +30,11 @@ public sealed class DiagnosticsController : ApiController /// /// Creates a dump and writes it into storage.. /// - /// - /// 204 => Dump created successful. - /// 501 => Not configured. - /// + /// Dump created successful.. + /// Not configured.. [HttpGet] [Route("diagnostics/dump")] + [ProducesResponseType(StatusCodes.Status204NoContent)] [ApiPermissionOrAnonymous(PermissionIds.Admin)] public async Task GetDump() { @@ -52,12 +51,11 @@ public sealed class DiagnosticsController : ApiController /// /// Creates a gc dump and writes it into storage. /// - /// - /// 204 => Dump created successful. - /// 501 => Not configured. - /// + /// Dump created successful.. + /// Not configured.. [HttpGet] [Route("diagnostics/gcdump")] + [ProducesResponseType(StatusCodes.Status204NoContent)] [ApiPermissionOrAnonymous(PermissionIds.Admin)] public async Task GetGCDump() { diff --git a/backend/src/Squidex/Areas/Api/Controllers/EventConsumers/EventConsumersController.cs b/backend/src/Squidex/Areas/Api/Controllers/EventConsumers/EventConsumersController.cs index cfc3e498f..df5058cb9 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/EventConsumers/EventConsumersController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/EventConsumers/EventConsumersController.cs @@ -31,9 +31,7 @@ public sealed class EventConsumersController : ApiController /// /// Get event consumers. /// - /// - /// 200 => Event consumers returned. - /// + /// Event consumers returned.. [HttpGet] [Route("event-consumers/")] [ProducesResponseType(typeof(EventConsumersDto), StatusCodes.Status200OK)] @@ -51,10 +49,8 @@ public sealed class EventConsumersController : ApiController /// Start an event consumer. /// /// The name of the event consumer. - /// - /// 200 => Event consumer started asynchronously. - /// 404 => Event consumer not found. - /// + /// Event consumer started asynchronously.. + /// Event consumer not found.. [HttpPut] [Route("event-consumers/{consumerName}/start/")] [ProducesResponseType(typeof(EventConsumerDto), StatusCodes.Status200OK)] @@ -72,10 +68,8 @@ public sealed class EventConsumersController : ApiController /// Stop an event consumer. /// /// The name of the event consumer. - /// - /// 200 => Event consumer stopped asynchronously. - /// 404 => Event consumer not found. - /// + /// Event consumer stopped asynchronously.. + /// Event consumer not found.. [HttpPut] [Route("event-consumers/{consumerName}/stop/")] [ProducesResponseType(typeof(EventConsumerDto), StatusCodes.Status200OK)] @@ -93,10 +87,8 @@ public sealed class EventConsumersController : ApiController /// Reset an event consumer. /// /// The name of the event consumer. - /// - /// 200 => Event consumer resetted asynchronously. - /// 404 => Event consumer not found. - /// + /// Event consumer resetted asynchronously.. + /// Event consumer not found.. [HttpPut] [Route("event-consumers/{consumerName}/reset/")] [ProducesResponseType(typeof(EventConsumerDto), StatusCodes.Status200OK)] diff --git a/backend/src/Squidex/Areas/Api/Controllers/History/HistoryController.cs b/backend/src/Squidex/Areas/Api/Controllers/History/HistoryController.cs index 7c0830644..675078c98 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/History/HistoryController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/History/HistoryController.cs @@ -33,10 +33,8 @@ public sealed class HistoryController : ApiController /// /// The name of the app. /// The name of the channel. - /// - /// 200 => Events returned. - /// 404 => App not found. - /// + /// Events returned.. + /// App not found.. [HttpGet] [Route("apps/{app}/history/")] [ProducesResponseType(typeof(HistoryEventDto[]), StatusCodes.Status200OK)] @@ -56,10 +54,8 @@ public sealed class HistoryController : ApiController /// /// The ID of the team. /// The name of the channel. - /// - /// 200 => Events returned. - /// 404 => Team not found. - /// + /// Events returned.. + /// Team not found.. [HttpGet] [Route("teams/{team}/history/")] [ProducesResponseType(typeof(HistoryEventDto[]), StatusCodes.Status200OK)] diff --git a/backend/src/Squidex/Areas/Api/Controllers/Languages/LanguagesController.cs b/backend/src/Squidex/Areas/Api/Controllers/Languages/LanguagesController.cs index 94cbfc60f..fd30e5e80 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Languages/LanguagesController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Languages/LanguagesController.cs @@ -30,9 +30,7 @@ public sealed class LanguagesController : ApiController /// /// Provide a list of supported language codes, following the ISO2Code standard. /// - /// - /// 200 => Supported language codes returned. - /// + /// Supported language codes returned.. [HttpGet] [Route("languages/")] [ProducesResponseType(typeof(LanguageDto[]), StatusCodes.Status200OK)] diff --git a/backend/src/Squidex/Areas/Api/Controllers/News/NewsController.cs b/backend/src/Squidex/Areas/Api/Controllers/News/NewsController.cs index 9bdb06642..01a827364 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/News/NewsController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/News/NewsController.cs @@ -31,9 +31,7 @@ public sealed class NewsController : ApiController /// Get features since version. /// /// The latest received version. - /// - /// 200 => Latest features returned. - /// + /// Latest features returned.. [HttpGet] [Route("news/features/")] [ProducesResponseType(typeof(FeaturesDto), StatusCodes.Status200OK)] diff --git a/backend/src/Squidex/Areas/Api/Controllers/Ping/PingController.cs b/backend/src/Squidex/Areas/Api/Controllers/Ping/PingController.cs index bb7e5467b..feb38ba74 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Ping/PingController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Ping/PingController.cs @@ -29,12 +29,10 @@ public sealed class PingController : ApiController /// /// Get API information. /// - /// - /// 200 => Infos returned. - /// + /// Infos returned.. [HttpGet] - [ProducesResponseType(typeof(ExposedValues), StatusCodes.Status200OK)] [Route("info/")] + [ProducesResponseType(typeof(ExposedValues), StatusCodes.Status200OK)] public IActionResult GetInfo() { return Ok(exposedValues); @@ -43,14 +41,13 @@ public sealed class PingController : ApiController /// /// Get ping status of the API. /// - /// - /// 204 => Service ping successful. - /// + /// Service ping successful.. /// /// Can be used to test, if the Squidex API is alive and responding. /// [HttpGet] [Route("ping/")] + [ProducesResponseType(StatusCodes.Status204NoContent)] public IActionResult GetPing() { return NoContent(); @@ -60,14 +57,13 @@ public sealed class PingController : ApiController /// Get ping status. /// /// The name of the app. - /// - /// 204 => Service ping successful. - /// + /// Service ping successful.. /// /// Can be used to test, if the Squidex API is alive and responding. /// [HttpGet] [Route("ping/{app}/")] + [ProducesResponseType(StatusCodes.Status204NoContent)] [ApiPermissionOrAnonymous(PermissionIds.AppPing)] [ApiCosts(0)] public IActionResult GetAppPing(string app) diff --git a/backend/src/Squidex/Areas/Api/Controllers/Plans/AppPlansController.cs b/backend/src/Squidex/Areas/Api/Controllers/Plans/AppPlansController.cs index 32ed27c67..8f8335ec8 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Plans/AppPlansController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Plans/AppPlansController.cs @@ -43,10 +43,8 @@ public sealed class AppPlansController : ApiController /// Get app plan information. /// /// The name of the app. - /// - /// 200 => App plan information returned. - /// 404 => App not found. - /// + /// App plan information returned.. + /// App not found.. [HttpGet] [Route("apps/{app}/plans/")] [ProducesResponseType(typeof(PlansDto), StatusCodes.Status200OK)] @@ -103,11 +101,9 @@ public sealed class AppPlansController : ApiController /// /// The name of the app. /// Plan object that needs to be changed. - /// - /// 200 => Plan changed or redirect url returned. - /// 400 => Plan not owned by user. - /// 404 => App not found. - /// + /// Plan changed or redirect url returned.. + /// Plan not owned by user.. + /// App not found.. [HttpPut] [Route("apps/{app}/plan/")] [ProducesResponseType(typeof(PlanChangedDto), StatusCodes.Status200OK)] diff --git a/backend/src/Squidex/Areas/Api/Controllers/Plans/TeamPlansController.cs b/backend/src/Squidex/Areas/Api/Controllers/Plans/TeamPlansController.cs index 7fb516ad6..3cacfe48d 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Plans/TeamPlansController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Plans/TeamPlansController.cs @@ -43,10 +43,8 @@ public sealed class TeamPlansController : ApiController /// Get team plan information. /// /// The name of the team. - /// - /// 200 => Team plan information returned. - /// 404 => Team not found. - /// + /// Team plan information returned.. + /// Team not found.. [HttpGet] [Route("teams/{team}/plans/")] [ProducesResponseType(typeof(PlansDto), StatusCodes.Status200OK)] @@ -92,10 +90,8 @@ public sealed class TeamPlansController : ApiController /// /// The name of the team. /// Plan object that needs to be changed. - /// - /// 200 => Plan changed or redirect url returned. - /// 404 => Team not found. - /// + /// Plan changed or redirect url returned.. + /// Team not found.. [HttpPut] [Route("teams/{team}/plan/")] [ProducesResponseType(typeof(PlanChangedDto), StatusCodes.Status200OK)] diff --git a/backend/src/Squidex/Areas/Api/Controllers/Rules/Models/CreateRuleDto.cs b/backend/src/Squidex/Areas/Api/Controllers/Rules/Models/CreateRuleDto.cs index 0aca4035a..0bc991074 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Rules/Models/CreateRuleDto.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Rules/Models/CreateRuleDto.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using System.Text.Json.Serialization; using Squidex.Domain.Apps.Core.Rules; using Squidex.Domain.Apps.Entities.Rules.Commands; using Squidex.Infrastructure.Validation; @@ -24,7 +23,6 @@ public sealed class CreateRuleDto /// The action properties. /// [LocalizedRequired] - [JsonConverter(typeof(RuleActionConverter))] public RuleAction Action { get; set; } public Rule ToRule() diff --git a/backend/src/Squidex/Areas/Api/Controllers/Rules/Models/RuleActionConverter.cs b/backend/src/Squidex/Areas/Api/Controllers/Rules/Models/RuleActionConverter.cs deleted file mode 100644 index 8270e3119..000000000 --- a/backend/src/Squidex/Areas/Api/Controllers/Rules/Models/RuleActionConverter.cs +++ /dev/null @@ -1,21 +0,0 @@ -// ========================================================================== -// Squidex Headless CMS -// ========================================================================== -// Copyright (c) Squidex UG (haftungsbeschraenkt) -// All rights reserved. Licensed under the MIT license. -// ========================================================================== - -using Squidex.Domain.Apps.Core.Rules; -using Squidex.Web.Json; - -namespace Squidex.Areas.Api.Controllers.Rules.Models; - -public sealed class RuleActionConverter : JsonInheritanceConverter -{ - public static IReadOnlyDictionary Mapping { get; set; } - - public RuleActionConverter() - : base("actionType", Mapping) - { - } -} diff --git a/backend/src/Squidex/Areas/Api/Controllers/Rules/Models/RuleActionProcessor.cs b/backend/src/Squidex/Areas/Api/Controllers/Rules/Models/RuleActionProcessor.cs deleted file mode 100644 index c5f5deba2..000000000 --- a/backend/src/Squidex/Areas/Api/Controllers/Rules/Models/RuleActionProcessor.cs +++ /dev/null @@ -1,80 +0,0 @@ -// ========================================================================== -// Squidex Headless CMS -// ========================================================================== -// Copyright (c) Squidex UG (haftungsbeschraenkt) -// All rights reserved. Licensed under the MIT license. -// ========================================================================== - -using Namotion.Reflection; -using NJsonSchema; -using NSwag.Generation.Processors; -using NSwag.Generation.Processors.Contexts; -using Squidex.Domain.Apps.Core.HandleRules; -using Squidex.Domain.Apps.Core.Rules; - -namespace Squidex.Areas.Api.Controllers.Rules.Models; - -public sealed class RuleActionProcessor : IDocumentProcessor -{ - private readonly RuleTypeProvider ruleRegistry; - - public RuleActionProcessor(RuleTypeProvider ruleRegistry) - { - this.ruleRegistry = ruleRegistry; - } - - public void Process(DocumentProcessorContext context) - { - try - { - var schema = context.SchemaResolver.GetSchema(typeof(RuleAction), false); - - if (schema != null) - { - var converter = new RuleActionConverter(); - - schema.DiscriminatorObject = new OpenApiDiscriminator - { - PropertyName = converter.DiscriminatorName, - - // The converter must be set so that NJsonSchema can get the allowed types for that. - JsonInheritanceConverter = converter, - }; - - schema.Properties[converter.DiscriminatorName] = new JsonSchemaProperty - { - Type = JsonObjectType.String, - IsRequired = true, - IsNullableRaw = true - }; - - // The types come from another assembly so we have to fix it here. - foreach (var (key, value) in ruleRegistry.Actions) - { - var derivedSchema = context.SchemaGenerator.Generate(value.Type.ToContextualType(), context.SchemaResolver); - - var oldName = context.Document.Definitions.FirstOrDefault(x => x.Value == derivedSchema).Key; - - if (oldName != null) - { - context.Document.Definitions.Remove(oldName); - context.Document.Definitions.Add($"{key}RuleActionDto", derivedSchema); - } - } - - RemoveFreezable(context, schema); - } - } - catch (KeyNotFoundException) - { - return; - } - } - - private static void RemoveFreezable(DocumentProcessorContext context, JsonSchema schema) - { - context.Document.Definitions.Remove("Freezable"); - - schema.AllOf.Clear(); - } -} diff --git a/backend/src/Squidex/Areas/Api/Controllers/Rules/Models/RuleDto.cs b/backend/src/Squidex/Areas/Api/Controllers/Rules/Models/RuleDto.cs index 314025b56..df748a43d 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Rules/Models/RuleDto.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Rules/Models/RuleDto.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using System.Text.Json.Serialization; using NodaTime; using Squidex.Areas.Api.Controllers.Rules.Models.Converters; using Squidex.Domain.Apps.Core.Rules; @@ -72,7 +71,6 @@ public sealed class RuleDto : Resource /// The action properties. /// [LocalizedRequired] - [JsonConverter(typeof(RuleActionConverter))] public RuleAction Action { get; set; } /// diff --git a/backend/src/Squidex/Areas/Api/Controllers/Rules/Models/RuleTriggerDto.cs b/backend/src/Squidex/Areas/Api/Controllers/Rules/Models/RuleTriggerDto.cs index f3695c083..fb70efc80 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Rules/Models/RuleTriggerDto.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Rules/Models/RuleTriggerDto.cs @@ -5,22 +5,11 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using System.Runtime.Serialization; using Squidex.Domain.Apps.Core.Rules; -using Squidex.Web.Json; namespace Squidex.Areas.Api.Controllers.Rules.Models; -[JsonInheritanceConverter(typeof(RuleTriggerDto), "triggerType")] -[KnownType(nameof(Subtypes))] public abstract class RuleTriggerDto { public abstract RuleTrigger ToTrigger(); - - public static Type[] Subtypes() - { - var type = typeof(RuleTriggerDto); - - return type.Assembly.GetTypes().Where(type.IsAssignableFrom).ToArray(); - } } diff --git a/backend/src/Squidex/Areas/Api/Controllers/Rules/Models/UpdateRuleDto.cs b/backend/src/Squidex/Areas/Api/Controllers/Rules/Models/UpdateRuleDto.cs index e2c86f5a8..db94debde 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Rules/Models/UpdateRuleDto.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Rules/Models/UpdateRuleDto.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using System.Text.Json.Serialization; using Squidex.Domain.Apps.Core.Rules; using Squidex.Domain.Apps.Entities.Rules.Commands; using Squidex.Infrastructure; @@ -28,7 +27,6 @@ public sealed class UpdateRuleDto /// /// The action properties. /// - [JsonConverter(typeof(RuleActionConverter))] public RuleAction? Action { get; set; } /// diff --git a/backend/src/Squidex/Areas/Api/Controllers/Rules/RulesController.cs b/backend/src/Squidex/Areas/Api/Controllers/Rules/RulesController.cs index 4ab53ca88..2ecd938dc 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Rules/RulesController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Rules/RulesController.cs @@ -9,7 +9,6 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Net.Http.Headers; using NodaTime; -using NSwag.Annotations; using Squidex.Areas.Api.Controllers.Rules.Models; using Squidex.Domain.Apps.Core.HandleRules; using Squidex.Domain.Apps.Core.Scripting; @@ -59,9 +58,7 @@ public sealed class RulesController : ApiController /// /// Get supported rule actions. /// - /// - /// 200 => Rule actions returned. - /// + /// Rule actions returned.. [HttpGet] [Route("rules/actions/")] [ProducesResponseType(typeof(Dictionary), StatusCodes.Status200OK)] @@ -85,10 +82,8 @@ public sealed class RulesController : ApiController /// Get rules. /// /// The name of the app. - /// - /// 200 => Rules returned. - /// 404 => App not found. - /// + /// Rules returned.. + /// App not found.. [HttpGet] [Route("apps/{app}/rules/")] [ProducesResponseType(typeof(RulesDto), StatusCodes.Status200OK)] @@ -111,11 +106,9 @@ public sealed class RulesController : ApiController /// /// The name of the app. /// The rule object that needs to be added to the app. - /// - /// 201 => Rule created. - /// 400 => Rule request not valid. - /// 404 => App not found. - /// + /// Rule created.. + /// Rule request not valid.. + /// App not found.. [HttpPost] [Route("apps/{app}/rules/")] [ProducesResponseType(typeof(RuleDto), 201)] @@ -134,9 +127,7 @@ public sealed class RulesController : ApiController /// Cancel the current run. /// /// The name of the app. - /// - /// 204 => Rule run cancelled. - /// + /// Rule run cancelled.. [HttpDelete] [Route("apps/{app}/rules/run")] [ProducesResponseType(StatusCodes.Status204NoContent)] @@ -155,11 +146,9 @@ public sealed class RulesController : ApiController /// The name of the app. /// The ID of the rule to update. /// The rule object that needs to be added to the app. - /// - /// 200 => Rule updated. - /// 400 => Rule request not valid. - /// 404 => Rule or app not found. - /// + /// Rule updated.. + /// Rule request not valid.. + /// Rule or app not found.. [HttpPut] [Route("apps/{app}/rules/{id}/")] [ProducesResponseType(typeof(RuleDto), StatusCodes.Status200OK)] @@ -179,10 +168,8 @@ public sealed class RulesController : ApiController /// /// The name of the app. /// The ID of the rule to enable. - /// - /// 200 => Rule enabled. - /// 404 => Rule or app not found. - /// + /// Rule enabled.. + /// Rule or app not found.. [HttpPut] [Route("apps/{app}/rules/{id}/enable/")] [ProducesResponseType(typeof(RuleDto), StatusCodes.Status200OK)] @@ -202,10 +189,8 @@ public sealed class RulesController : ApiController /// /// The name of the app. /// The ID of the rule to disable. - /// - /// 200 => Rule disabled. - /// 404 => Rule or app not found. - /// + /// Rule disabled.. + /// Rule or app not found.. [HttpPut] [Route("apps/{app}/rules/{id}/disable/")] [ProducesResponseType(typeof(RuleDto), StatusCodes.Status200OK)] @@ -225,12 +210,11 @@ public sealed class RulesController : ApiController /// /// The name of the app. /// The ID of the rule to disable. - /// - /// 204 => Rule triggered. - /// 404 => Rule or app not found. - /// + /// Rule triggered.. + /// Rule or app not found.. [HttpPut] [Route("apps/{app}/rules/{id}/trigger/")] + [ProducesResponseType(StatusCodes.Status204NoContent)] [ApiPermissionOrAnonymous(PermissionIds.AppRulesEventsRun)] [ApiCosts(1)] public async Task TriggerRule(string app, DomainId id) @@ -248,9 +232,7 @@ public sealed class RulesController : ApiController /// The name of the app. /// The ID of the rule to run. /// Runs the rule from snapeshots if possible. - /// - /// 204 => Rule started. - /// + /// Rule started.. [HttpPut] [Route("apps/{app}/rules/{id}/run")] [ProducesResponseType(StatusCodes.Status204NoContent)] @@ -268,9 +250,7 @@ public sealed class RulesController : ApiController /// /// The name of the app. /// The ID of the rule to cancel. - /// - /// 204 => Rule events cancelled. - /// + /// Rule events cancelled.. [HttpDelete] [Route("apps/{app}/rules/{id}/events/")] [ProducesResponseType(StatusCodes.Status204NoContent)] @@ -288,10 +268,8 @@ public sealed class RulesController : ApiController /// /// The name of the app. /// The rule to simulate. - /// - /// 200 => Rule simulated. - /// 404 => Rule or app not found. - /// + /// Rule simulated.. + /// Rule or app not found.. [HttpPost] [Route("apps/{app}/rules/simulate/")] [ProducesResponseType(typeof(SimulatedRuleEventsDto), StatusCodes.Status200OK)] @@ -313,10 +291,8 @@ public sealed class RulesController : ApiController /// /// The name of the app. /// The ID of the rule to simulate. - /// - /// 200 => Rule simulated. - /// 404 => Rule or app not found. - /// + /// Rule simulated.. + /// Rule or app not found.. [HttpGet] [Route("apps/{app}/rules/{id}/simulate/")] [ProducesResponseType(typeof(SimulatedRuleEventsDto), StatusCodes.Status200OK)] @@ -343,12 +319,11 @@ public sealed class RulesController : ApiController /// /// The name of the app. /// The ID of the rule to delete. - /// - /// 204 => Rule deleted. - /// 404 => Rule or app not found. - /// + /// Rule deleted.. + /// Rule or app not found.. [HttpDelete] [Route("apps/{app}/rules/{id}/")] + [ProducesResponseType(StatusCodes.Status204NoContent)] [ApiPermissionOrAnonymous(PermissionIds.AppRulesDelete)] [ApiCosts(1)] public async Task DeleteRule(string app, DomainId id) @@ -367,10 +342,8 @@ public sealed class RulesController : ApiController /// The optional rule id to filter to events. /// The number of events to skip. /// The number of events to take. - /// - /// 200 => Rule events returned. - /// 404 => App not found. - /// + /// Rule events returned.. + /// App not found.. [HttpGet] [Route("apps/{app}/rules/events/")] [ProducesResponseType(typeof(RuleEventsDto), StatusCodes.Status200OK)] @@ -390,12 +363,11 @@ public sealed class RulesController : ApiController /// /// The name of the app. /// The event to enqueue. - /// - /// 204 => Rule enqueued. - /// 404 => App or rule event not found. - /// + /// Rule enqueued.. + /// App or rule event not found.. [HttpPut] [Route("apps/{app}/rules/events/{id}/")] + [ProducesResponseType(StatusCodes.Status204NoContent)] [ApiPermissionOrAnonymous(PermissionIds.AppRulesEventsUpdate)] [ApiCosts(0)] public async Task PutEvent(string app, DomainId id) @@ -416,9 +388,7 @@ public sealed class RulesController : ApiController /// Cancels all events. /// /// The name of the app. - /// - /// 204 => Events cancelled. - /// + /// Events cancelled.. [HttpDelete] [Route("apps/{app}/rules/events/")] [ProducesResponseType(StatusCodes.Status204NoContent)] @@ -436,12 +406,11 @@ public sealed class RulesController : ApiController /// /// The name of the app. /// The event to enqueue. - /// - /// 204 => Rule deqeued. - /// 404 => App or rule event not found. - /// + /// Rule deqeued.. + /// App or rule event not found.. [HttpDelete] [Route("apps/{app}/rules/events/{id}/")] + [ProducesResponseType(StatusCodes.Status204NoContent)] [ApiPermissionOrAnonymous(PermissionIds.AppRulesEventsDelete)] [ApiCosts(0)] public async Task DeleteEvent(string app, DomainId id) @@ -461,9 +430,7 @@ public sealed class RulesController : ApiController /// /// Provide a list of all event types that are used in rules. /// - /// - /// 200 => Rule events returned. - /// + /// Rule events returned.. [HttpGet] [Route("rules/eventtypes")] [ProducesResponseType(typeof(string[]), StatusCodes.Status200OK)] @@ -479,10 +446,8 @@ public sealed class RulesController : ApiController /// Provide the json schema for the event with the specified name. /// /// The type name of the event. - /// - /// 200 => Rule event type found. - /// 404 => Rule event not found. - /// + /// Rule event type found.. + /// Rule event not found.. [HttpGet] [Route("rules/eventtypes/{type}")] [ProducesResponseType(typeof(object), StatusCodes.Status200OK)] @@ -503,7 +468,7 @@ public sealed class RulesController : ApiController [Route("apps/{app}/rules/completion/{triggerType}")] [ApiPermissionOrAnonymous] [ApiCosts(1)] - [OpenApiIgnore] + [ApiExplorerSettings(IgnoreApi = true)] public IActionResult GetScriptCompletion(string app, string triggerType, [FromServices] ScriptingCompleter completer) { diff --git a/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/FieldPropertiesDto.cs b/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/FieldPropertiesDto.cs index 409d48744..2fab0fe83 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/FieldPropertiesDto.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Schemas/Models/FieldPropertiesDto.cs @@ -5,16 +5,12 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using System.Runtime.Serialization; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Infrastructure.Collections; using Squidex.Infrastructure.Validation; -using Squidex.Web.Json; namespace Squidex.Areas.Api.Controllers.Schemas.Models; -[JsonInheritanceConverter(typeof(FieldPropertiesDto), "fieldType")] -[KnownType(nameof(Subtypes))] public abstract class FieldPropertiesDto { /// @@ -61,11 +57,4 @@ public abstract class FieldPropertiesDto public ReadonlyList? Tags { get; set; } public abstract FieldProperties ToProperties(); - - public static Type[] Subtypes() - { - var type = typeof(FieldPropertiesDto); - - return type.Assembly.GetTypes().Where(type.IsAssignableFrom).ToArray(); - } } diff --git a/backend/src/Squidex/Areas/Api/Controllers/Schemas/SchemaFieldsController.cs b/backend/src/Squidex/Areas/Api/Controllers/Schemas/SchemaFieldsController.cs index 408d7fd38..0cb24c17d 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Schemas/SchemaFieldsController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Schemas/SchemaFieldsController.cs @@ -32,12 +32,10 @@ public sealed class SchemaFieldsController : ApiController /// The name of the app. /// The name of the schema. /// The field object that needs to be added to the schema. - /// - /// 201 => Schema field created. - /// 400 => Schema request not valid. - /// 404 => Schema or app not found. - /// 409 => Schema field name already in use. - /// + /// Schema field created.. + /// Schema request not valid.. + /// Schema or app not found.. + /// Schema field name already in use.. [HttpPost] [Route("apps/{app}/schemas/{schema}/fields/")] [ProducesResponseType(typeof(SchemaDto), 201)] @@ -59,12 +57,10 @@ public sealed class SchemaFieldsController : ApiController /// The name of the schema. /// The parent field id. /// The field object that needs to be added to the schema. - /// - /// 201 => Schema field created. - /// 400 => Schema request not valid. - /// 409 => Schema field name already in use. - /// 404 => Schema, field or app not found. - /// + /// Schema field created.. + /// Schema request not valid.. + /// Schema field name already in use.. + /// Schema, field or app not found.. [HttpPost] [Route("apps/{app}/schemas/{schema}/fields/{parentId:long}/nested/")] [ProducesResponseType(typeof(SchemaDto), 201)] @@ -85,11 +81,9 @@ public sealed class SchemaFieldsController : ApiController /// The name of the app. /// The name of the schema. /// The request that contains the field names. - /// - /// 200 => Schema UI fields defined. - /// 400 => Schema request not valid. - /// 404 => Schema or app not found. - /// + /// Schema UI fields defined.. + /// Schema request not valid.. + /// Schema or app not found.. [HttpPut] [Route("apps/{app}/schemas/{schema}/fields/ui/")] [ProducesResponseType(typeof(SchemaDto), StatusCodes.Status200OK)] @@ -110,11 +104,9 @@ public sealed class SchemaFieldsController : ApiController /// The name of the app. /// The name of the schema. /// The request that contains the field ids. - /// - /// 200 => Schema fields reordered. - /// 400 => Schema request not valid. - /// 404 => Schema or app not found. - /// + /// Schema fields reordered.. + /// Schema request not valid.. + /// Schema or app not found.. [HttpPut] [Route("apps/{app}/schemas/{schema}/fields/ordering/")] [ProducesResponseType(typeof(SchemaDto), StatusCodes.Status200OK)] @@ -136,11 +128,9 @@ public sealed class SchemaFieldsController : ApiController /// The name of the schema. /// The parent field id. /// The request that contains the field ids. - /// - /// 200 => Schema fields reordered. - /// 400 => Schema field request not valid. - /// 404 => Schema, field or app not found. - /// + /// Schema fields reordered.. + /// Schema field request not valid.. + /// Schema, field or app not found.. [HttpPut] [Route("apps/{app}/schemas/{schema}/fields/{parentId:long}/nested/ordering/")] [ProducesResponseType(typeof(SchemaDto), StatusCodes.Status200OK)] @@ -162,11 +152,9 @@ public sealed class SchemaFieldsController : ApiController /// The name of the schema. /// The ID of the field to update. /// The field object that needs to be added to the schema. - /// - /// 200 => Schema field updated. - /// 400 => Schema field request not valid. - /// 404 => Schema, field or app not found. - /// + /// Schema field updated.. + /// Schema field request not valid.. + /// Schema, field or app not found.. [HttpPut] [Route("apps/{app}/schemas/{schema}/fields/{id:long}/")] [ProducesResponseType(typeof(SchemaDto), StatusCodes.Status200OK)] @@ -189,11 +177,9 @@ public sealed class SchemaFieldsController : ApiController /// The parent field id. /// The ID of the field to update. /// The field object that needs to be added to the schema. - /// - /// 200 => Schema field updated. - /// 400 => Schema field request not valid or field locked. - /// 404 => Schema, field or app not found. - /// + /// Schema field updated.. + /// Schema field request not valid or field locked.. + /// Schema, field or app not found.. [HttpPut] [Route("apps/{app}/schemas/{schema}/fields/{parentId:long}/nested/{id:long}/")] [ProducesResponseType(typeof(SchemaDto), StatusCodes.Status200OK)] @@ -214,11 +200,9 @@ public sealed class SchemaFieldsController : ApiController /// The name of the app. /// The name of the schema. /// The ID of the field to lock. - /// - /// 200 => Schema field shown. - /// 400 => Schema field request not valid or field locked. - /// 404 => Schema, field or app not found. - /// + /// Schema field shown.. + /// Schema field request not valid or field locked.. + /// Schema, field or app not found.. /// /// A locked field cannot be updated or deleted. /// @@ -243,11 +227,9 @@ public sealed class SchemaFieldsController : ApiController /// The name of the schema. /// The parent field id. /// The ID of the field to lock. - /// - /// 200 => Schema field hidden. - /// 400 => Schema field request not valid or field locked. - /// 404 => Field, schema, or app not found. - /// + /// Schema field hidden.. + /// Schema field request not valid or field locked.. + /// Field, schema, or app not found.. /// /// A locked field cannot be edited or deleted. /// @@ -271,11 +253,9 @@ public sealed class SchemaFieldsController : ApiController /// The name of the app. /// The name of the schema. /// The ID of the field to hide. - /// - /// 200 => Schema field hidden. - /// 400 => Schema field request not valid or field locked. - /// 404 => Schema, field or app not found. - /// + /// Schema field hidden.. + /// Schema field request not valid or field locked.. + /// Schema, field or app not found.. /// /// A hidden field is not part of the API response, but can still be edited in the portal. /// @@ -300,11 +280,9 @@ public sealed class SchemaFieldsController : ApiController /// The name of the schema. /// The parent field id. /// The ID of the field to hide. - /// - /// 200 => Schema field hidden. - /// 400 => Schema field request not valid or field locked. - /// 404 => Field, schema, or app not found. - /// + /// Schema field hidden.. + /// Schema field request not valid or field locked.. + /// Field, schema, or app not found.. /// /// A hidden field is not part of the API response, but can still be edited in the portal. /// @@ -328,11 +306,9 @@ public sealed class SchemaFieldsController : ApiController /// The name of the app. /// The name of the schema. /// The ID of the field to show. - /// - /// 200 => Schema field shown. - /// 400 => Schema field request not valid or field locked. - /// 404 => Schema, field or app not found. - /// + /// Schema field shown.. + /// Schema field request not valid or field locked.. + /// Schema, field or app not found.. /// /// A hidden field is not part of the API response, but can still be edited in the portal. /// @@ -357,11 +333,9 @@ public sealed class SchemaFieldsController : ApiController /// The name of the schema. /// The parent field id. /// The ID of the field to show. - /// - /// 200 => Schema field shown. - /// 400 => Schema field request not valid or field locked. - /// 404 => Schema, field or app not found. - /// + /// Schema field shown.. + /// Schema field request not valid or field locked.. + /// Schema, field or app not found.. /// /// A hidden field is not part of the API response, but can still be edited in the portal. /// @@ -385,11 +359,9 @@ public sealed class SchemaFieldsController : ApiController /// The name of the app. /// The name of the schema. /// The ID of the field to enable. - /// - /// 200 => Schema field enabled. - /// 400 => Schema field request not valid or field locked. - /// 404 => Schema, field or app not found. - /// + /// Schema field enabled.. + /// Schema field request not valid or field locked.. + /// Schema, field or app not found.. /// /// A disabled field cannot not be edited in the squidex portal anymore, but will be part of the API response. /// @@ -414,11 +386,9 @@ public sealed class SchemaFieldsController : ApiController /// The name of the schema. /// The parent field id. /// The ID of the field to enable. - /// - /// 200 => Schema field enabled. - /// 400 => Schema field request not valid or field locked. - /// 404 => Schema, field or app not found. - /// + /// Schema field enabled.. + /// Schema field request not valid or field locked.. + /// Schema, field or app not found.. /// /// A disabled field cannot not be edited in the squidex portal anymore, but will be part of the API response. /// @@ -442,11 +412,9 @@ public sealed class SchemaFieldsController : ApiController /// The name of the app. /// The name of the schema. /// The ID of the field to disable. - /// - /// 200 => Schema field disabled. - /// 400 => Schema field request not valid or field locked. - /// 404 => Schema, field or app not found. - /// + /// Schema field disabled.. + /// Schema field request not valid or field locked.. + /// Schema, field or app not found.. /// /// A disabled field cannot not be edited in the squidex portal anymore, but will be part of the API response. /// @@ -471,11 +439,9 @@ public sealed class SchemaFieldsController : ApiController /// The name of the schema. /// The parent field id. /// The ID of the field to disable. - /// - /// 200 => Schema field disabled. - /// 400 => Schema field request not valid or field locked. - /// 404 => Schema, field or app not found. - /// + /// Schema field disabled.. + /// Schema field request not valid or field locked.. + /// Schema, field or app not found.. /// /// A disabled field cannot not be edited in the squidex portal anymore, but will be part of the API response. /// @@ -499,11 +465,9 @@ public sealed class SchemaFieldsController : ApiController /// The name of the app. /// The name of the schema. /// The ID of the field to disable. - /// - /// 200 => Schema field deleted. - /// 400 => Schema field request not valid or field locked. - /// 404 => Schema, field or app not found. - /// + /// Schema field deleted.. + /// Schema field request not valid or field locked.. + /// Schema, field or app not found.. [HttpDelete] [Route("apps/{app}/schemas/{schema}/fields/{id:long}/")] [ProducesResponseType(typeof(SchemaDto), StatusCodes.Status200OK)] @@ -525,11 +489,9 @@ public sealed class SchemaFieldsController : ApiController /// The name of the schema. /// The parent field id. /// The ID of the field to disable. - /// - /// 200 => Schema field deleted. - /// 400 => Schema field request not valid or field locked. - /// 404 => Schema, field or app not found. - /// + /// Schema field deleted.. + /// Schema field request not valid or field locked.. + /// Schema, field or app not found.. [HttpDelete] [Route("apps/{app}/schemas/{schema}/fields/{parentId:long}/nested/{id:long}/")] [ProducesResponseType(typeof(SchemaDto), StatusCodes.Status200OK)] diff --git a/backend/src/Squidex/Areas/Api/Controllers/Schemas/SchemasController.cs b/backend/src/Squidex/Areas/Api/Controllers/Schemas/SchemasController.cs index 916b3ebf2..83ca9c36a 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Schemas/SchemasController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Schemas/SchemasController.cs @@ -7,7 +7,6 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Net.Http.Headers; -using NSwag.Annotations; using Squidex.Areas.Api.Controllers.Schemas.Models; using Squidex.Domain.Apps.Core.GenerateFilters; using Squidex.Domain.Apps.Core.Scripting; @@ -41,10 +40,8 @@ public sealed class SchemasController : ApiController /// Get schemas. /// /// The name of the app. - /// - /// 200 => Schemas returned. - /// 404 => App not found. - /// + /// Schemas returned.. + /// App not found.. [HttpGet] [Route("apps/{app}/schemas/")] [ProducesResponseType(typeof(SchemasDto), StatusCodes.Status200OK)] @@ -69,10 +66,8 @@ public sealed class SchemasController : ApiController /// /// The name of the app. /// The name of the schema to retrieve. - /// - /// 200 => Schema found. - /// 404 => Schema or app not found. - /// + /// Schema found.. + /// Schema or app not found.. [HttpGet] [Route("apps/{app}/schemas/{schema}/")] [ProducesResponseType(typeof(SchemaDto), StatusCodes.Status200OK)] @@ -95,11 +90,9 @@ public sealed class SchemasController : ApiController /// /// The name of the app. /// The schema object that needs to be added to the app. - /// - /// 201 => Schema created. - /// 400 => Schema request not valid. - /// 409 => Schema name already in use. - /// + /// Schema created.. + /// Schema request not valid.. + /// Schema name already in use.. [HttpPost] [Route("apps/{app}/schemas/")] [ProducesResponseType(typeof(SchemaDto), 201)] @@ -120,11 +113,9 @@ public sealed class SchemasController : ApiController /// The name of the app. /// The name of the schema. /// The schema object that needs to updated. - /// - /// 200 => Schema updated. - /// 400 => Schema request not valid. - /// 404 => Schema or app not found. - /// + /// Schema updated.. + /// Schema request not valid.. + /// Schema or app not found.. [HttpPut] [Route("apps/{app}/schemas/{schema}/")] [ProducesResponseType(typeof(SchemaDto), StatusCodes.Status200OK)] @@ -145,11 +136,9 @@ public sealed class SchemasController : ApiController /// The name of the app. /// The name of the schema. /// The schema object that needs to updated. - /// - /// 200 => Schema updated. - /// 400 => Schema request not valid. - /// 404 => Schema or app not found. - /// + /// Schema updated.. + /// Schema request not valid.. + /// Schema or app not found.. [HttpPut] [Route("apps/{app}/schemas/{schema}/sync")] [ProducesResponseType(typeof(SchemaDto), StatusCodes.Status200OK)] @@ -170,11 +159,9 @@ public sealed class SchemasController : ApiController /// The name of the app. /// The name of the schema. /// The schema object that needs to updated. - /// - /// 200 => Schema updated. - /// 400 => Schema request not valid. - /// 404 => Schema or app not found. - /// + /// Schema updated.. + /// Schema request not valid.. + /// Schema or app not found.. [HttpPut] [Route("apps/{app}/schemas/{schema}/category")] [ProducesResponseType(typeof(SchemaDto), StatusCodes.Status200OK)] @@ -195,11 +182,9 @@ public sealed class SchemasController : ApiController /// The name of the app. /// The name of the schema. /// The preview urls for the schema. - /// - /// 200 => Schema updated. - /// 400 => Schema request not valid. - /// 404 => Schema or app not found. - /// + /// Schema updated.. + /// Schema request not valid.. + /// Schema or app not found.. [HttpPut] [Route("apps/{app}/schemas/{schema}/preview-urls")] [ProducesResponseType(typeof(SchemaDto), StatusCodes.Status200OK)] @@ -220,11 +205,9 @@ public sealed class SchemasController : ApiController /// The name of the app. /// The name of the schema. /// The schema scripts object that needs to updated. - /// - /// 200 => Schema updated. - /// 400 => Schema request not valid. - /// 404 => Schema or app not found. - /// + /// Schema updated.. + /// Schema request not valid.. + /// Schema or app not found.. [HttpPut] [Route("apps/{app}/schemas/{schema}/scripts/")] [ProducesResponseType(typeof(SchemaDto), StatusCodes.Status200OK)] @@ -245,11 +228,9 @@ public sealed class SchemasController : ApiController /// The name of the app. /// The name of the schema. /// The schema rules object that needs to updated. - /// - /// 200 => Schema updated. - /// 400 => Schema request not valid. - /// 404 => Schema or app not found. - /// + /// Schema updated.. + /// Schema request not valid.. + /// Schema or app not found.. [HttpPut] [Route("apps/{app}/schemas/{schema}/rules/")] [ProducesResponseType(typeof(SchemaDto), StatusCodes.Status200OK)] @@ -269,10 +250,8 @@ public sealed class SchemasController : ApiController /// /// The name of the app. /// The name of the schema to publish. - /// - /// 200 => Schema published. - /// 404 => Schema or app not found. - /// + /// Schema published.. + /// Schema or app not found.. [HttpPut] [Route("apps/{app}/schemas/{schema}/publish/")] [ProducesResponseType(typeof(SchemaDto), StatusCodes.Status200OK)] @@ -292,10 +271,8 @@ public sealed class SchemasController : ApiController /// /// The name of the app. /// The name of the schema to unpublish. - /// - /// 200 => Schema unpublished. - /// 404 => Schema or app not found. - /// + /// Schema unpublished.. + /// Schema or app not found.. [HttpPut] [Route("apps/{app}/schemas/{schema}/unpublish/")] [ProducesResponseType(typeof(SchemaDto), StatusCodes.Status200OK)] @@ -315,12 +292,11 @@ public sealed class SchemasController : ApiController /// /// The name of the app. /// The name of the schema to delete. - /// - /// 204 => Schema deleted. - /// 404 => Schema or app not found. - /// + /// Schema deleted.. + /// Schema or app not found.. [HttpDelete] [Route("apps/{app}/schemas/{schema}/")] + [ProducesResponseType(StatusCodes.Status204NoContent)] [ApiPermissionOrAnonymous(PermissionIds.AppSchemasDelete)] [ApiCosts(1)] public async Task DeleteSchema(string app, string schema) @@ -336,7 +312,7 @@ public sealed class SchemasController : ApiController [Route("apps/{app}/schemas/{schema}/completion")] [ApiPermissionOrAnonymous] [ApiCosts(1)] - [OpenApiIgnore] + [ApiExplorerSettings(IgnoreApi = true)] public async Task GetScriptCompletion(string app, string schema, [FromServices] ScriptingCompleter completer) { @@ -349,7 +325,7 @@ public sealed class SchemasController : ApiController [Route("apps/{app}/schemas/{schema}/completion/triggers")] [ApiPermissionOrAnonymous] [ApiCosts(1)] - [OpenApiIgnore] + [ApiExplorerSettings(IgnoreApi = true)] public async Task GetScriptTriggerCompletion(string app, string schema, [FromServices] ScriptingCompleter completer) { @@ -362,7 +338,7 @@ public sealed class SchemasController : ApiController [Route("apps/{app}/schemas/{schema}/filters")] [ApiPermissionOrAnonymous] [ApiCosts(1)] - [OpenApiIgnore] + [ApiExplorerSettings(IgnoreApi = true)] public async Task GetFilters(string app, string schema) { var components = await appProvider.GetComponentsAsync(Schema, HttpContext.RequestAborted); diff --git a/backend/src/Squidex/Areas/Api/Controllers/Search/SearchController.cs b/backend/src/Squidex/Areas/Api/Controllers/Search/SearchController.cs index d6dc997cf..8271cdd0a 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Search/SearchController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Search/SearchController.cs @@ -33,10 +33,8 @@ public class SearchController : ApiController /// /// The name of the app. /// The search query. - /// - /// 200 => Search results returned. - /// 404 => App not found. - /// + /// Search results returned.. + /// App not found.. [HttpGet] [Route("apps/{app}/search/")] [ProducesResponseType(typeof(SearchResultDto[]), StatusCodes.Status200OK)] diff --git a/backend/src/Squidex/Areas/Api/Controllers/Statistics/UsagesController.cs b/backend/src/Squidex/Areas/Api/Controllers/Statistics/UsagesController.cs index b6cfeac17..8a6ff14a1 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Statistics/UsagesController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Statistics/UsagesController.cs @@ -56,10 +56,8 @@ public sealed class UsagesController : ApiController /// Get api calls as log file. /// /// The name of the app. - /// - /// 200 => Usage tracking results returned. - /// 404 => App not found. - /// + /// Usage tracking results returned.. + /// App not found.. [HttpGet] [Route("apps/{app}/usages/log/")] [ProducesResponseType(typeof(LogDownloadDto), StatusCodes.Status200OK)] @@ -105,11 +103,9 @@ public sealed class UsagesController : ApiController /// The name of the app. /// The from date. /// The to date. - /// - /// 200 => API call returned. - /// 404 => App not found. - /// 400 => Range between from date and to date is not valid or has more than 100 days. - /// + /// API call returned.. + /// App not found.. + /// Range between from date and to date is not valid or has more than 100 days.. [HttpGet] [Route("apps/{app}/usages/calls/{fromDate}/{toDate}/")] [ProducesResponseType(typeof(CallsUsageDtoDto), StatusCodes.Status200OK)] @@ -139,11 +135,9 @@ public sealed class UsagesController : ApiController /// The name of the team. /// The from date. /// The to date. - /// - /// 200 => API call returned. - /// 400 => Range between from date and to date is not valid or has more than 100 days. - /// 404 => Team not found. - /// + /// API call returned.. + /// Range between from date and to date is not valid or has more than 100 days.. + /// Team not found.. [HttpGet] [Route("teams/{team}/usages/calls/{fromDate}/{toDate}/")] [ProducesResponseType(typeof(CallsUsageDtoDto), StatusCodes.Status200OK)] @@ -171,10 +165,8 @@ public sealed class UsagesController : ApiController /// Get total asset size. /// /// The name of the app. - /// - /// 200 => Storage usage returned. - /// 404 => App not found. - /// + /// Storage usage returned.. + /// App not found.. [HttpGet] [Route("apps/{app}/usages/storage/today/")] [ProducesResponseType(typeof(CurrentStorageDto), StatusCodes.Status200OK)] @@ -196,10 +188,8 @@ public sealed class UsagesController : ApiController /// Get total asset size by team. /// /// The ID of the team. - /// - /// 200 => Storage usage returned. - /// 404 => Team not found. - /// + /// Storage usage returned.. + /// Team not found.. [HttpGet] [Route("teams/{team}/usages/storage/today/")] [ProducesResponseType(typeof(CurrentStorageDto), StatusCodes.Status200OK)] @@ -223,11 +213,9 @@ public sealed class UsagesController : ApiController /// The name of the app. /// The from date. /// The to date. - /// - /// 200 => Storage usage returned. - /// 400 => Range between from date and to date is not valid or has more than 100 days. - /// 404 => App not found. - /// + /// Storage usage returned.. + /// Range between from date and to date is not valid or has more than 100 days.. + /// App not found.. [HttpGet] [Route("apps/{app}/usages/storage/{fromDate}/{toDate}/")] [ProducesResponseType(typeof(StorageUsagePerDateDto[]), StatusCodes.Status200OK)] @@ -253,11 +241,9 @@ public sealed class UsagesController : ApiController /// The ID of the team. /// The from date. /// The to date. - /// - /// 200 => Storage usage returned. - /// 400 => Range between from date and to date is not valid or has more than 100 days. - /// 404 => Team not found. - /// + /// Storage usage returned.. + /// Range between from date and to date is not valid or has more than 100 days.. + /// Team not found.. [HttpGet] [Route("teams/{team}/usages/storage/{fromDate}/{toDate}/")] [ProducesResponseType(typeof(StorageUsagePerDateDto[]), StatusCodes.Status200OK)] diff --git a/backend/src/Squidex/Areas/Api/Controllers/Teams/TeamContributorsController.cs b/backend/src/Squidex/Areas/Api/Controllers/Teams/TeamContributorsController.cs index b9b351f44..a8ae9959b 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Teams/TeamContributorsController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Teams/TeamContributorsController.cs @@ -36,10 +36,8 @@ public sealed class TeamContributorsController : ApiController /// Get team contributors. /// /// The ID of the team. - /// - /// 200 => Contributors returned. - /// 404 => Team not found. - /// + /// Contributors returned.. + /// Team not found.. [HttpGet] [Route("teams/{team}/contributors/")] [ProducesResponseType(typeof(ContributorsDto), StatusCodes.Status200OK)] @@ -62,11 +60,9 @@ public sealed class TeamContributorsController : ApiController /// /// The ID of the team. /// Contributor object that needs to be added to the team. - /// - /// 201 => Contributor assigned to team. - /// 400 => Contributor request not valid. - /// 404 => Team not found. - /// + /// Contributor assigned to team.. + /// Contributor request not valid.. + /// Team not found.. [HttpPost] [Route("teams/{team}/contributors/")] [ProducesResponseType(typeof(ContributorsDto), StatusCodes.Status201Created)] @@ -85,10 +81,8 @@ public sealed class TeamContributorsController : ApiController /// Remove yourself. /// /// The ID of the team. - /// - /// 200 => Contributor removed. - /// 404 => Contributor or team not found. - /// + /// Contributor removed.. + /// Contributor or team not found.. [HttpDelete] [Route("teams/{team}/contributors/me/")] [ProducesResponseType(typeof(ContributorsDto), StatusCodes.Status200OK)] @@ -108,10 +102,8 @@ public sealed class TeamContributorsController : ApiController /// /// The ID of the team. /// The ID of the contributor. - /// - /// 200 => Contributor removed. - /// 404 => Contributor or team not found. - /// + /// Contributor removed.. + /// Contributor or team not found.. [HttpDelete] [Route("teams/{team}/contributors/{id}/")] [ProducesResponseType(typeof(ContributorsDto), StatusCodes.Status200OK)] diff --git a/backend/src/Squidex/Areas/Api/Controllers/Teams/TeamsController.cs b/backend/src/Squidex/Areas/Api/Controllers/Teams/TeamsController.cs index ce32f1ed8..e414697f9 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Teams/TeamsController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Teams/TeamsController.cs @@ -33,9 +33,7 @@ public sealed class TeamsController : ApiController /// /// Get your teams. /// - /// - /// 200 => Teams returned. - /// + /// Teams returned.. /// /// You can only retrieve the list of teams when you are authenticated as a user (OpenID implicit flow). /// You will retrieve all teams, where you are assigned as a contributor. @@ -63,10 +61,8 @@ public sealed class TeamsController : ApiController /// Get an team by name. /// /// The name of the team. - /// - /// 200 => Teams returned. - /// 404 => Team not found. - /// + /// Teams returned.. + /// Team not found.. [HttpGet] [Route("teams/{team}")] [ProducesResponseType(typeof(TeamDto), StatusCodes.Status200OK)] @@ -88,11 +84,9 @@ public sealed class TeamsController : ApiController /// Create a new team. /// /// The team object that needs to be added to Squidex. - /// - /// 201 => Team created. - /// 400 => Team request not valid. - /// 409 => Team name is already in use. - /// + /// Team created.. + /// Team request not valid.. + /// Team name is already in use.. /// /// You can only create an team when you are authenticated as a user (OpenID implicit flow). /// You will be assigned as owner of the new team automatically. @@ -114,11 +108,9 @@ public sealed class TeamsController : ApiController /// /// The name of the team to update. /// The values to update. - /// - /// 200 => Team updated. - /// 400 => Team request not valid. - /// 404 => Team not found. - /// + /// Team updated.. + /// Team request not valid.. + /// Team not found.. [HttpPut] [Route("teams/{team}/")] [ProducesResponseType(typeof(TeamDto), StatusCodes.Status200OK)] diff --git a/backend/src/Squidex/Areas/Api/Controllers/Templates/TemplatesController.cs b/backend/src/Squidex/Areas/Api/Controllers/Templates/TemplatesController.cs index cdea2882c..4a531882b 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Templates/TemplatesController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Templates/TemplatesController.cs @@ -30,9 +30,7 @@ public sealed class TemplatesController : ApiController /// /// Get all templates. /// - /// - /// 200 => Templates returned. - /// + /// Templates returned.. [HttpGet] [Route("templates/")] [ProducesResponseType(typeof(TemplatesDto), StatusCodes.Status200OK)] @@ -50,10 +48,8 @@ public sealed class TemplatesController : ApiController /// Get template details. /// /// The name of the template. - /// - /// 200 => Template returned. - /// 404 => Template not found. - /// + /// Template returned.. + /// Template not found.. [HttpGet] [Route("templates/{name}")] [ProducesResponseType(typeof(TemplateDetailsDto), StatusCodes.Status200OK)] diff --git a/backend/src/Squidex/Areas/Api/Controllers/Translations/TranslationsController.cs b/backend/src/Squidex/Areas/Api/Controllers/Translations/TranslationsController.cs index 60fbdfff0..7540ba2cc 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Translations/TranslationsController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Translations/TranslationsController.cs @@ -33,9 +33,7 @@ public sealed class TranslationsController : ApiController /// /// The name of the app. /// The translation request. - /// - /// 200 => Text translated. - /// + /// Text translated.. [HttpPost] [Route("apps/{app}/translations/")] [ProducesResponseType(typeof(TranslationDto), StatusCodes.Status200OK)] diff --git a/backend/src/Squidex/Areas/Api/Controllers/UI/UIController.cs b/backend/src/Squidex/Areas/Api/Controllers/UI/UIController.cs index 997c565c4..414ae1c5f 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/UI/UIController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/UI/UIController.cs @@ -34,9 +34,7 @@ public sealed class UIController : ApiController /// /// Get ui settings. /// - /// - /// 200 => UI settings returned. - /// + /// UI settings returned.. [HttpGet] [Route("ui/settings/")] [ProducesResponseType(typeof(UISettingsDto), StatusCodes.Status200OK)] @@ -56,10 +54,8 @@ public sealed class UIController : ApiController /// Get ui settings. /// /// The name of the app. - /// - /// 200 => UI settings returned. - /// 404 => App not found. - /// + /// UI settings returned.. + /// App not found.. [HttpGet] [Route("apps/{app}/ui/settings/")] [ProducesResponseType(typeof(Dictionary), StatusCodes.Status200OK)] @@ -75,10 +71,8 @@ public sealed class UIController : ApiController /// Get my ui settings. /// /// The name of the app. - /// - /// 200 => UI settings returned. - /// 404 => App not found. - /// + /// UI settings returned.. + /// App not found.. [HttpGet] [Route("apps/{app}/ui/settings/me")] [ProducesResponseType(typeof(Dictionary), StatusCodes.Status200OK)] @@ -96,10 +90,8 @@ public sealed class UIController : ApiController /// The name of the app. /// The name of the setting. /// The request with the value to update. - /// - /// 200 => UI setting set. - /// 404 => App not found. - /// + /// UI setting set.. + /// App not found.. [HttpPut] [Route("apps/{app}/ui/settings/{key}")] [ApiPermission] @@ -116,10 +108,8 @@ public sealed class UIController : ApiController /// The name of the app. /// The name of the setting. /// The request with the value to update. - /// - /// 200 => UI setting set. - /// 404 => App not found. - /// + /// UI setting set.. + /// App not found.. [HttpPut] [Route("apps/{app}/ui/settings/me/{key}")] [ApiPermission] @@ -135,10 +125,8 @@ public sealed class UIController : ApiController /// /// The name of the app. /// The name of the setting. - /// - /// 200 => UI setting removed. - /// 404 => App not found. - /// + /// UI setting removed.. + /// App not found.. [HttpDelete] [Route("apps/{app}/ui/settings/{key}")] [ApiPermission] @@ -154,10 +142,8 @@ public sealed class UIController : ApiController /// /// The name of the app. /// The name of the setting. - /// - /// 200 => UI setting removed. - /// 404 => App not found. - /// + /// UI setting removed.. + /// App not found.. [HttpDelete] [Route("apps/{app}/ui/settings/me/{key}")] [ApiPermission] diff --git a/backend/src/Squidex/Areas/Api/Controllers/Users/UserManagementController.cs b/backend/src/Squidex/Areas/Api/Controllers/Users/UserManagementController.cs index aac01013b..364d240bc 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Users/UserManagementController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Users/UserManagementController.cs @@ -37,9 +37,7 @@ public sealed class UserManagementController : ApiController /// Optional query to search by email address or username. /// The number of users to skip. /// The number of users to return. - /// - /// 200 => Users returned. - /// + /// Users returned.. [HttpGet] [Route("user-management/")] [ProducesResponseType(typeof(UsersDto), StatusCodes.Status200OK)] @@ -57,10 +55,8 @@ public sealed class UserManagementController : ApiController /// Get a user by ID. /// /// The ID of the user. - /// - /// 200 => User returned. - /// 404 => User not found. - /// + /// User returned.. + /// User not found.. [HttpGet] [Route("user-management/{id}/")] [ProducesResponseType(typeof(UserDto), StatusCodes.Status200OK)] @@ -83,10 +79,8 @@ public sealed class UserManagementController : ApiController /// Create a new user. /// /// The user object that needs to be added. - /// - /// 201 => User created. - /// 400 => User request not valid. - /// + /// User created.. + /// User request not valid.. [HttpPost] [Route("user-management/")] [ProducesResponseType(typeof(UserDto), StatusCodes.Status201Created)] @@ -105,11 +99,9 @@ public sealed class UserManagementController : ApiController /// /// The ID of the user. /// The user object that needs to be updated. - /// - /// 200 => User created. - /// 400 => User request not valid. - /// 404 => User not found. - /// + /// User created.. + /// User request not valid.. + /// User not found.. [HttpPut] [Route("user-management/{id}/")] [ProducesResponseType(typeof(UserDto), StatusCodes.Status200OK)] @@ -127,11 +119,9 @@ public sealed class UserManagementController : ApiController /// Lock a user. /// /// The ID of the user to lock. - /// - /// 200 => User locked. - /// 403 => User is the current user. - /// 404 => User not found. - /// + /// User locked.. + /// User is the current user.. + /// User not found.. [HttpPut] [Route("user-management/{id}/lock/")] [ProducesResponseType(typeof(UserDto), StatusCodes.Status200OK)] @@ -154,11 +144,9 @@ public sealed class UserManagementController : ApiController /// Unlock a user. /// /// The ID of the user to unlock. - /// - /// 200 => User unlocked. - /// 403 => User is the current user. - /// 404 => User not found. - /// + /// User unlocked.. + /// User is the current user.. + /// User not found.. [HttpPut] [Route("user-management/{id}/unlock/")] [ProducesResponseType(typeof(UserDto), StatusCodes.Status200OK)] @@ -181,11 +169,9 @@ public sealed class UserManagementController : ApiController /// Delete a User. /// /// The ID of the user to delete. - /// - /// 204 => User deleted. - /// 403 => User is the current user. - /// 404 => User not found. - /// + /// User deleted.. + /// User is the current user.. + /// User not found.. [HttpDelete] [Route("user-management/{id}/")] [ProducesResponseType(StatusCodes.Status204NoContent)] diff --git a/backend/src/Squidex/Areas/Api/Controllers/Users/UsersController.cs b/backend/src/Squidex/Areas/Api/Controllers/Users/UsersController.cs index bfaef887a..d747cd5cf 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Users/UsersController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Users/UsersController.cs @@ -58,9 +58,7 @@ public sealed class UsersController : ApiController /// /// Get the user resources. /// - /// - /// 200 => User resources returned. - /// + /// User resources returned.. [HttpGet] [Route("")] [ProducesResponseType(typeof(ResourcesDto), StatusCodes.Status200OK)] @@ -79,9 +77,7 @@ public sealed class UsersController : ApiController /// /// Search the user by query that contains the email address or the part of the email address. /// - /// - /// 200 => Users returned. - /// + /// Users returned.. [HttpGet] [Route("users/")] [ProducesResponseType(typeof(UserDto[]), StatusCodes.Status200OK)] @@ -108,10 +104,8 @@ public sealed class UsersController : ApiController /// Get user by id. /// /// The ID of the user (GUID). - /// - /// 200 => User found. - /// 404 => User not found. - /// + /// User found.. + /// User not found.. [HttpGet] [Route("users/{id}/")] [ProducesResponseType(typeof(UserDto), StatusCodes.Status200OK)] @@ -141,10 +135,8 @@ public sealed class UsersController : ApiController /// Get user picture by id. /// /// The ID of the user (GUID). - /// - /// 200 => User found and image or fallback returned. - /// 404 => User not found. - /// + /// User found and image or fallback returned.. + /// User not found.. [HttpGet] [Route("users/{id}/picture/")] [ProducesResponseType(typeof(FileResult), StatusCodes.Status200OK)] diff --git a/backend/src/Squidex/Areas/IdentityServer/Views/Account/Consent.cshtml b/backend/src/Squidex/Areas/IdentityServer/Views/Account/Consent.cshtml index 59d181cc6..31b68dd47 100644 --- a/backend/src/Squidex/Areas/IdentityServer/Views/Account/Consent.cshtml +++ b/backend/src/Squidex/Areas/IdentityServer/Views/Account/Consent.cshtml @@ -7,7 +7,7 @@ @functions { public string ErrorClass(string error) { - return ViewData.ModelState[error]?.ValidationState == Microsoft.AspNetCore.Mvc.ModelBinding.ModelValidationState.Invalid ? "border-danger" : ""; +return ViewData.ModelState[error]?.ValidationState == Microsoft.AspNetCore.Mvc.ModelBinding.ModelValidationState.Invalid ? "border-danger" : ""; } } diff --git a/backend/src/Squidex/Areas/IdentityServer/Views/Account/Login.cshtml b/backend/src/Squidex/Areas/IdentityServer/Views/Account/Login.cshtml index ad145e38c..9fe5d6fda 100644 --- a/backend/src/Squidex/Areas/IdentityServer/Views/Account/Login.cshtml +++ b/backend/src/Squidex/Areas/IdentityServer/Views/Account/Login.cshtml @@ -11,36 +11,36 @@ ViewBag.Title = action;
@if (Model!.IsLogin) - { - @T.Get("common.login") - } - else - { - @T.Get("common.login") - } + { + @T.Get("common.login") + } + else + { + @T.Get("common.login") + } @if (!Model!.IsLogin) - { - @T.Get("common.signup") - } - else - { - @T.Get("common.signup") - } + { + @T.Get("common.signup") + } + else + { + @T.Get("common.signup") + }
@foreach (var provider in Model!.ExternalProviders) - { - var schema = provider.AuthenticationScheme.ToLowerInvariant(); +{ + var schema = provider.AuthenticationScheme.ToLowerInvariant(); -
+
- } +} @if (Model!.HasExternalLogin && Model!.HasPasswordAuth) @@ -52,14 +52,14 @@ ViewBag.Title = action; @if (Model!.HasPasswordAuth) { - if (Model!.IsLogin) +if (Model!.IsLogin) +{ + if (Model!.IsFailed) { - if (Model!.IsFailed) - { -
@T.Get("users.login.error")
- } +
@T.Get("users.login.error")
+ } -
+
@@ -70,11 +70,11 @@ ViewBag.Title = action;
- } - else - { - - } +} +else +{ + +} } @if (Model!.IsLogin) diff --git a/backend/src/Squidex/Areas/IdentityServer/Views/Profile/Profile.cshtml b/backend/src/Squidex/Areas/IdentityServer/Views/Profile/Profile.cshtml index c500534fe..737f930bf 100644 --- a/backend/src/Squidex/Areas/IdentityServer/Views/Profile/Profile.cshtml +++ b/backend/src/Squidex/Areas/IdentityServer/Views/Profile/Profile.cshtml @@ -6,11 +6,11 @@ void RenderValidation(string field) { @if (ViewContext.ViewData.ModelState[field]?.ValidationState == Microsoft.AspNetCore.Mvc.ModelBinding.ModelValidationState.Invalid) - { -
+{ +
@Html.ValidationMessage(field)
- } +} } } @@ -89,8 +89,8 @@ void RenderValidation(string field) @foreach (var login in Model!.ExternalLogins) - { - + { + @login.LoginProvider @@ -99,8 +99,8 @@ void RenderValidation(string field) @if (Model!.ExternalLogins.Count > 1 || Model!.HasPassword) - { -
+ { + @@ -108,21 +108,21 @@ void RenderValidation(string field) @T.Get("common.remove")
- } + } - } + }
@foreach (var provider in Model!.ExternalProviders.Where(x => Model!.ExternalLogins.All(y => x.AuthenticationScheme != y.LoginProvider))) - { - var schema = provider.AuthenticationScheme.ToLowerInvariant(); + { + var schema = provider.AuthenticationScheme.ToLowerInvariant(); - - } + }
} @@ -135,8 +135,8 @@ void RenderValidation(string field)

@T.Get("users.profile.passwordTitle")

@if (Model!.HasPassword) - { -
+{ +
@@ -165,10 +165,10 @@ void RenderValidation(string field)
- } - else - { -
+} +else +{ +
@@ -189,7 +189,7 @@ void RenderValidation(string field)
- } +}
} @@ -233,8 +233,8 @@ void RenderValidation(string field)
@for (var i = 0; i < Model!.Properties.Count; i++) - { -
+ { +
@{ RenderValidation($"Properties[{i}].Name"); } @@ -253,7 +253,7 @@ void RenderValidation(string field)
- } + }
diff --git a/backend/src/Squidex/Areas/IdentityServer/Views/Setup/Setup.cshtml b/backend/src/Squidex/Areas/IdentityServer/Views/Setup/Setup.cshtml index 700f16460..9ca2d036c 100644 --- a/backend/src/Squidex/Areas/IdentityServer/Views/Setup/Setup.cshtml +++ b/backend/src/Squidex/Areas/IdentityServer/Views/Setup/Setup.cshtml @@ -6,11 +6,11 @@ void RenderValidation(string field) { @if (ViewContext.ViewData.ModelState[field]?.ValidationState == Microsoft.AspNetCore.Mvc.ModelBinding.ModelValidationState.Invalid) - { -
+{ +
@Html.ValidationMessage(field)
- } +} } void RenderRuleAsSuccess(string message) @@ -78,48 +78,48 @@ void RenderRuleAsWarning(string message) @if (Model!.IsValidHttps) { - RenderRuleAsSuccess(T.Get("setup.ruleHttps.success")); +RenderRuleAsSuccess(T.Get("setup.ruleHttps.success")); } else { - RenderRuleAsCritical(T.Get("setup.ruleHttps.failure")); +RenderRuleAsCritical(T.Get("setup.ruleHttps.failure")); } @if (Model!.BaseUrlConfigured == Model!.BaseUrlCurrent) { - RenderRuleAsSuccess(T.Get("setup.ruleUrl.success")); +RenderRuleAsSuccess(T.Get("setup.ruleUrl.success")); } else { - RenderRuleAsCritical(T.Get("setup.ruleUrl.failure", new { actual = Model!.BaseUrlCurrent, configured = Model!.BaseUrlConfigured })); +RenderRuleAsCritical(T.Get("setup.ruleUrl.failure", new { actual = Model!.BaseUrlCurrent, configured = Model!.BaseUrlConfigured })); } @if (Model!.EverybodyCanCreateApps) { - RenderRuleAsWarning(T.Get("setup.ruleAppCreation.warningAdmins")); +RenderRuleAsWarning(T.Get("setup.ruleAppCreation.warningAdmins")); } else { - RenderRuleAsWarning(T.Get("setup.ruleAppCreation.warningAll")); +RenderRuleAsWarning(T.Get("setup.ruleAppCreation.warningAll")); } @if (Model!.EverybodyCanCreateTeams) { - RenderRuleAsWarning(T.Get("setup.ruleTeamCreation.warningAdmins")); +RenderRuleAsWarning(T.Get("setup.ruleTeamCreation.warningAdmins")); } else { - RenderRuleAsWarning(T.Get("setup.ruleTeamCreation.warningAll")); +RenderRuleAsWarning(T.Get("setup.ruleTeamCreation.warningAll")); } @if (Model!.IsAssetStoreFtp) { - RenderRuleAsWarning(T.Get("setup.ruleFtp.warning")); +RenderRuleAsWarning(T.Get("setup.ruleFtp.warning")); } @if (Model!.IsAssetStoreFile) { - RenderRuleAsWarning(T.Get("setup.ruleFolder.warning")); +RenderRuleAsWarning(T.Get("setup.ruleFolder.warning")); }
@@ -153,11 +153,11 @@ else

@T.Get("setup.createUser.headlineCreate")

@if (!string.IsNullOrWhiteSpace(Model!.ErrorMessage)) - { -
+{ +
@Model!.ErrorMessage
- } +}
diff --git a/backend/src/Squidex/Config/Domain/AssetServices.cs b/backend/src/Squidex/Config/Domain/AssetServices.cs index 1ce0918db..f422ac97c 100644 --- a/backend/src/Squidex/Config/Domain/AssetServices.cs +++ b/backend/src/Squidex/Config/Domain/AssetServices.cs @@ -164,12 +164,12 @@ public static class AssetServices var options = new FTPAssetOptions { - Path = config.GetOptionalValue("assetStore:ftp:path", "/") + Path = config.GetOptionalValue("assetStore:ftp:path", "/")! }; services.AddSingletonAs(c => { - var factory = new Func(() => new FtpClient(serverHost, serverPort, username, password)); + var factory = new Func(() => new AsyncFtpClient(serverHost, username, password, serverPort)); return new FTPAssetStore(factory, options, c.GetRequiredService>()); }) diff --git a/backend/src/Squidex/Config/Domain/EventPublishersServices.cs b/backend/src/Squidex/Config/Domain/EventPublishersServices.cs index b33589c19..95a85aa1b 100644 --- a/backend/src/Squidex/Config/Domain/EventPublishersServices.cs +++ b/backend/src/Squidex/Config/Domain/EventPublishersServices.cs @@ -29,7 +29,7 @@ public static class EventPublishersServices throw new ConfigurationException(error); } - var eventsFilter = child.GetValue("eventsFilter"); + var eventsFilter = child.GetValue("eventsFilter") ?? string.Empty; var enabled = child.GetValue("enabled"); diff --git a/backend/src/Squidex/Config/Domain/LoggingServices.cs b/backend/src/Squidex/Config/Domain/LoggingServices.cs index 3c14715a8..78bb830c3 100644 --- a/backend/src/Squidex/Config/Domain/LoggingServices.cs +++ b/backend/src/Squidex/Config/Domain/LoggingServices.cs @@ -63,6 +63,11 @@ public static class LoggingServices return false; } + if (category == null) + { + return true; + } + if (category.StartsWith("OpenIddict", StringComparison.OrdinalIgnoreCase)) { return level >= LogLevel.Warning; diff --git a/backend/src/Squidex/Config/Domain/RuleServices.cs b/backend/src/Squidex/Config/Domain/RuleServices.cs index c91021ade..30f2b28c1 100644 --- a/backend/src/Squidex/Config/Domain/RuleServices.cs +++ b/backend/src/Squidex/Config/Domain/RuleServices.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using Squidex.Areas.Api.Controllers.Rules.Models; using Squidex.Domain.Apps.Core.HandleRules; using Squidex.Domain.Apps.Core.HandleRules.Extensions; using Squidex.Domain.Apps.Core.Scripting; @@ -96,10 +95,5 @@ public static class RuleServices services.AddSingletonAs() .AsSelf(); - - services.AddInitializer("Serializer (Rules)", registry => - { - RuleActionConverter.Mapping = registry.Actions.ToDictionary(x => x.Key, x => x.Value.Type); - }, -1); } } diff --git a/backend/src/Squidex/Config/Domain/SerializationServices.cs b/backend/src/Squidex/Config/Domain/SerializationServices.cs index cff287daf..d2cb722fe 100644 --- a/backend/src/Squidex/Config/Domain/SerializationServices.cs +++ b/backend/src/Squidex/Config/Domain/SerializationServices.cs @@ -13,7 +13,8 @@ using Migrations; using NetTopologySuite.IO.Converters; using NodaTime; using NodaTime.Serialization.SystemTextJson; -using Squidex.Domain.Apps.Core; +using Squidex.Areas.Api.Controllers.Rules.Models; +using Squidex.Areas.Api.Controllers.Schemas.Models; using Squidex.Domain.Apps.Core.Apps; using Squidex.Domain.Apps.Core.Apps.Json; using Squidex.Domain.Apps.Core.Contents; @@ -36,18 +37,21 @@ namespace Squidex.Config.Domain; public static class SerializationServices { - private static JsonSerializerOptions ConfigureJson(TypeNameRegistry typeNameRegistry, JsonSerializerOptions? options = null) + private static JsonSerializerOptions ConfigureJson(TypeRegistry typeRegistry, JsonSerializerOptions? options = null) { options ??= new JsonSerializerOptions(JsonSerializerDefaults.Web); - options.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb); // It is also a readonly list, so we have to register it first, so that other converters do not pick this up. options.Converters.Add(new StringConverter(x => x)); + + options.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb); options.Converters.Add(new GeoJsonConverterFactory()); - options.Converters.Add(new InheritanceConverter(typeNameRegistry)); - options.Converters.Add(new InheritanceConverter(typeNameRegistry)); - options.Converters.Add(new InheritanceConverter(typeNameRegistry)); - options.Converters.Add(new InheritanceConverter(typeNameRegistry)); + options.Converters.Add(new PolymorphicConverter(typeRegistry)); + options.Converters.Add(new PolymorphicConverter(typeRegistry)); + options.Converters.Add(new PolymorphicConverter(typeRegistry)); + options.Converters.Add(new PolymorphicConverter(typeRegistry)); + options.Converters.Add(new PolymorphicConverter(typeRegistry)); + options.Converters.Add(new PolymorphicConverter(typeRegistry)); options.Converters.Add(new JsonValueConverter()); options.Converters.Add(new ReadonlyDictionaryConverterFactory()); options.Converters.Add(new ReadonlyListConverterFactory()); @@ -71,6 +75,7 @@ public static class SerializationServices options.Converters.Add(new StringConverter()); options.Converters.Add(new StringConverter()); options.Converters.Add(new JsonStringEnumConverter()); + options.TypeInfoResolver = new PolymorphicTypeResolver(typeRegistry); options.IncludeFields = true; return options; @@ -78,17 +83,17 @@ public static class SerializationServices public static IServiceCollection AddSquidexSerializers(this IServiceCollection services) { - services.AddSingletonAs>() - .As(); + services.AddSingleton( + new AssemblyTypeProvider(SquidexEvents.Assembly)); - services.AddSingletonAs>() - .As(); + services.AddSingleton( + new AssemblyTypeProvider(SquidexMigrations.Assembly)); - services.AddSingletonAs>() - .As(); + services.AddSingleton( + new AssemblyTypeProvider("fieldType")); - services.AddSingletonAs>() - .As(); + services.AddSingleton( + new AssemblyTypeProvider("triggerType")); services.AddSingletonAs() .As(); @@ -96,15 +101,15 @@ public static class SerializationServices services.AddSingletonAs() .As(); - services.AddSingletonAs() + services.AddSingletonAs() .AsSelf(); - services.AddSingletonAs(c => ConfigureJson(c.GetRequiredService())) + services.AddSingletonAs(c => ConfigureJson(c.GetRequiredService())) .As(); services.Configure((c, options) => { - ConfigureJson(c.GetRequiredService(), options); + ConfigureJson(c.GetRequiredService(), options); }); return services; @@ -114,7 +119,7 @@ public static class SerializationServices { builder.Services.Configure((c, options) => { - ConfigureJson(c.GetRequiredService(), options.JsonSerializerOptions); + ConfigureJson(c.GetRequiredService(), options.JsonSerializerOptions); // Do not write null values. options.JsonSerializerOptions.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull; diff --git a/backend/src/Squidex/Config/Domain/StoreServices.cs b/backend/src/Squidex/Config/Domain/StoreServices.cs index be7ad511d..ddbd3d5a0 100644 --- a/backend/src/Squidex/Config/Domain/StoreServices.cs +++ b/backend/src/Squidex/Config/Domain/StoreServices.cs @@ -62,9 +62,9 @@ public static class StoreServices { ["MongoDB"] = () => { - var mongoConfiguration = config.GetRequiredValue("store:mongoDb:configuration"); - var mongoDatabaseName = config.GetRequiredValue("store:mongoDb:database"); - var mongoContentDatabaseName = config.GetOptionalValue("store:mongoDb:contentDatabase", mongoDatabaseName); + var mongoConfiguration = config.GetRequiredValue("store:mongoDb:configuration")!; + var mongoDatabaseName = config.GetRequiredValue("store:mongoDb:database")!; + var mongoContentDatabaseName = config.GetOptionalValue("store:mongoDb:contentDatabase", mongoDatabaseName)!; services.AddSingleton(typeof(ISnapshotStore<>), typeof(MongoSnapshotStore<>)); diff --git a/backend/src/Squidex/Pipeline/Plugins/PluginExtensions.cs b/backend/src/Squidex/Pipeline/Plugins/PluginExtensions.cs index dc37f429c..b384ee5da 100644 --- a/backend/src/Squidex/Pipeline/Plugins/PluginExtensions.cs +++ b/backend/src/Squidex/Pipeline/Plugins/PluginExtensions.cs @@ -35,16 +35,13 @@ public static class PluginExtensions var options = config.Get(); - if (options.Plugins != null) + if (options?.Plugins != null) { foreach (var path in options.Plugins) { var pluginAssembly = pluginManager.Load(path, SharedAssemblies); - if (pluginAssembly != null) - { - pluginAssembly.AddParts(mvcBuilder); - } + pluginAssembly?.AddParts(mvcBuilder); } } diff --git a/backend/src/Squidex/Pipeline/Squid/SquidMiddleware.cs b/backend/src/Squidex/Pipeline/Squid/SquidMiddleware.cs index 2c71e4fff..04aabd6a3 100644 --- a/backend/src/Squidex/Pipeline/Squid/SquidMiddleware.cs +++ b/backend/src/Squidex/Pipeline/Squid/SquidMiddleware.cs @@ -25,34 +25,51 @@ public sealed class SquidMiddleware { var request = context.Request; - var face = "sad"; + string? requestedFace = null; + string? requestedTitle = null; + string? requestedText = null; + string? requestedBackground = null; - if (request.Query.TryGetValue("face", out var faceValue) && (faceValue == "sad" || faceValue == "happy")) + if (request.Query.TryGetValue("face", out var faceValue)) { - face = faceValue; + requestedFace = faceValue; } - var isSad = face == "sad"; + if (request.Query.TryGetValue("title", out var titleValue)) + { + requestedTitle = titleValue!; + } - var title = isSad ? "OH DAMN!" : "OH YEAH!"; + if (request.Query.TryGetValue("text", out var textValue)) + { + requestedText = textValue!; + } - if (request.Query.TryGetValue("title", out var titleValue) && !string.IsNullOrWhiteSpace(titleValue)) + if (request.Query.TryGetValue("background", out var backgroundValue)) { - title = titleValue; + requestedBackground = backgroundValue; } - var text = "text"; + if (string.IsNullOrWhiteSpace(requestedFace) || requestedFace is not "sad" and not "happy") + { + requestedFace = "sad"; + } + + var isSad = string.Equals(requestedFace, "sad", StringComparison.OrdinalIgnoreCase); - if (request.Query.TryGetValue("text", out var textValue) && !string.IsNullOrWhiteSpace(textValue)) + if (string.IsNullOrWhiteSpace(requestedTitle)) { - text = textValue; + requestedTitle = isSad ? "OH DAMN!" : "OH YEAH!"; } - var background = isSad ? "#F5F5F9" : "#4CC159"; + if (string.IsNullOrWhiteSpace(requestedText)) + { + requestedText = "text"; + } - if (request.Query.TryGetValue("background", out var backgroundValue) && !string.IsNullOrWhiteSpace(backgroundValue)) + if (string.IsNullOrWhiteSpace(requestedBackground)) { - background = backgroundValue; + requestedBackground = isSad ? "#F5F5F9" : "#4CC159"; } var isSmall = request.Query.TryGetValue("small", out _); @@ -68,13 +85,13 @@ public sealed class SquidMiddleware svg = isSad ? squidSadLG : squidHappyLG; } - var (l1, l2, l3) = SplitText(text); + var (line1, line2, line3) = SplitText(requestedText); - svg = svg.Replace("{{TITLE}}", title.ToUpperInvariant(), StringComparison.Ordinal); - svg = svg.Replace("{{TEXT1}}", l1, StringComparison.Ordinal); - svg = svg.Replace("{{TEXT2}}", l2, StringComparison.Ordinal); - svg = svg.Replace("{{TEXT3}}", l3, StringComparison.Ordinal); - svg = svg.Replace("[COLOR]", background, StringComparison.Ordinal); + svg = svg.Replace("{{TITLE}}", requestedTitle.ToUpperInvariant(), StringComparison.Ordinal); + svg = svg.Replace("{{TEXT1}}", line1, StringComparison.Ordinal); + svg = svg.Replace("{{TEXT2}}", line2, StringComparison.Ordinal); + svg = svg.Replace("{{TEXT3}}", line3, StringComparison.Ordinal); + svg = svg.Replace("[COLOR]", requestedBackground, StringComparison.Ordinal); context.Response.StatusCode = 200; context.Response.ContentType = "image/svg+xml"; diff --git a/backend/src/Squidex/Properties/Resources.Designer.cs b/backend/src/Squidex/Properties/Resources.Designer.cs index 0ca84648d..e5af8ed1d 100644 --- a/backend/src/Squidex/Properties/Resources.Designer.cs +++ b/backend/src/Squidex/Properties/Resources.Designer.cs @@ -8,124 +8,119 @@ // //------------------------------------------------------------------------------ -namespace Squidex.Properties; -using System; - - -/// -/// A strongly-typed resource class, for looking up localized strings, etc. -/// -// This class was auto-generated by the StronglyTypedResourceBuilder -// class via a tool like ResGen or Visual Studio. -// To add or remove a member, edit your .ResX file then rerun ResGen -// with the /str option, or rebuild your VS project. -[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] -[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] -[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] -internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; +namespace Squidex.Properties { + using System; - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } /// - /// Returns the cached ResourceManager instance used by this class. + /// A strongly-typed resource class, for looking up localized strings, etc. /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Squidex.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Squidex.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } } - set { - resourceCulture = value; + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } } - } - - /// - /// Looks up a localized string similar to # Introduction - /// - ///The API provides two specifications. The Content API usually returns one object per schema field where the keys are the languages (or `iv` for non-localized) fields and the values are the actual field values. - /// - ///You can use the `X-Flatten` header to return a flat structure when you query content items. This is more performant and easier for code generation. Unfortunantely it cannot be modelled with OpenAPI. Therefore we provide two different documents for your API. - /// - ///Read more about this [rest of string was truncated]";. - /// - internal static string OpenApiContentDescription { - get { - return ResourceManager.GetString("OpenApiContentDescription", resourceCulture); + + /// + /// Looks up a localized string similar to # Introduction + /// + ///The API provides two specifications. The Content API usually returns one object per schema field where the keys are the languages (or `iv` for non-localized) fields and the values are the actual field values. + /// + ///You can use the `X-Flatten` header to return a flat structure when you query content items. This is more performant and easier for code generation. Unfortunantely it cannot be modelled with OpenAPI. Therefore we provide two different documents for your API. + /// + ///Read more about this [rest of string was truncated]";. + /// + internal static string OpenApiContentDescription { + get { + return ResourceManager.GetString("OpenApiContentDescription", resourceCulture); + } } - } - - /// - /// Looks up a localized string similar to The data of the content. - /// - ///Please note that each field is an object with one entry per language. - ///If the field is not localizable you must use `iv` (invariant language) as a key. - /// - ///Read more about it at: https://docs.squidex.io/04-guides/02-api.html. - /// - internal static string OpenApiSchemaBody { - get { - return ResourceManager.GetString("OpenApiSchemaBody", resourceCulture); + + /// + /// Looks up a localized string similar to The data of the content. + /// + ///Please note that each field is an object with one entry per language. + ///If the field is not localizable you must use `iv` (invariant language) as a key. + /// + ///Read more about it at: https://docs.squidex.io/04-guides/02-api.html. + /// + internal static string OpenApiSchemaBody { + get { + return ResourceManager.GetString("OpenApiSchemaBody", resourceCulture); + } } - } - - /// - /// Looks up a localized string similar to How to make queries? - /// - ///Read more about it at: https://docs.squidex.io/04-guides/02-api.html - /// - ///The query endpoints support three options: - /// - ///### Query with OData - /// - ///Squidex supports a subset of the OData (https://www.odata.org/) syntax with with the following query options: - /// - ///* **$top**: The $top query option requests the number of items in the queried collection to be included in the result. The default value is 20 and the maximum allowed value is 200. You can change the maximum in the app settings, when [rest of string was truncated]";. - /// - internal static string OpenApiSchemaQuery { - get { - return ResourceManager.GetString("OpenApiSchemaQuery", resourceCulture); + + /// + /// Looks up a localized string similar to How to make queries? + /// + ///Read more about it at: https://docs.squidex.io/04-guides/02-api.html + /// + ///The query endpoints support three options: + /// + ///### Query with OData + /// + ///Squidex supports a subset of the OData (https://www.odata.org/) syntax with with the following query options: + /// + ///* **$top**: The $top query option requests the number of items in the queried collection to be included in the result. The default value is 20 and the maximum allowed value is 200. You can change the maximum in the app settings, when [rest of string was truncated]";. + /// + internal static string OpenApiSchemaQuery { + get { + return ResourceManager.GetString("OpenApiSchemaQuery", resourceCulture); + } } - } - - /// - /// Looks up a localized string similar to Squidex uses oauth2 client authentication. Read more about it at: https://oauth.net/2/ and https://tools.ietf.org/html/rfc6750. - /// - ///To retrieve an access token, the client id must make a request to the token url. For example: - /// - /// $ curl - /// -X POST '<TOKEN_URL>' - /// -H 'Content-Type: application/x-www-form-urlencoded' - /// -d 'grant_type=client_credentials& - /// client_id=[CLIENT_ID]& - /// client_secret=[CLIENT_SECRET]& - /// scope=squidex-api' - /// - ///You must send this token in [rest of string was truncated]";. - /// - internal static string OpenApiSecurity { - get { - return ResourceManager.GetString("OpenApiSecurity", resourceCulture); + + /// + /// Looks up a localized string similar to Squidex uses OpenId Connect (OIDC) with the Client Credentials Flow (defined in OAuth 2.0 RFC 6749, section 4.4). + /// + ///The OpenId Connect Client Credentials flow can be used for machine to machine authentication. In this grant a specific user is not authorized but rather the credentials are verified and a generic `access_token` is returned. + /// + ///The `access_token` is a signed JSON Web Token (JWT) which contains expiry information. + /// + ///To retrieve an access token you must pass the Client ID and Client Secret to [rest of string was truncated]";. + /// + internal static string OpenApiSecurity { + get { + return ResourceManager.GetString("OpenApiSecurity", resourceCulture); + } } } } diff --git a/backend/src/Squidex/Properties/Resources.resx b/backend/src/Squidex/Properties/Resources.resx index e968e9e94..6222beb35 100644 --- a/backend/src/Squidex/Properties/Resources.resx +++ b/backend/src/Squidex/Properties/Resources.resx @@ -176,9 +176,13 @@ Query your items by passing in one or many IDs with the following query paramete * **ids**: A comma-separated list of ids. If you define this option all other settings are ignored. - Squidex uses oauth2 client authentication. Read more about it at: https://oauth.net/2/ and https://tools.ietf.org/html/rfc6750. + Squidex uses OpenId Connect (OIDC) with the Client Credentials Flow (defined in OAuth 2.0 RFC 6749, section 4.4). -To retrieve an access token, the client id must make a request to the token url. For example: +The OpenId Connect Client Credentials flow can be used for machine to machine authentication. In this grant a specific user is not authorized but rather the credentials are verified and a generic `access_token` is returned. + +The `access_token` is a signed JSON Web Token (JWT) which contains expiry information. + +To retrieve an access token you must pass the Client ID and Client Secret to the token endpoint to authenticate yourself and get a token: $ curl -X POST '<TOKEN_URL>' @@ -188,7 +192,7 @@ To retrieve an access token, the client id must make a request to the token url. client_secret=[CLIENT_SECRET]& scope=squidex-api' -You must send this token in the `Authorization` header when making requests to the API: +Pass this token to all consecutiv requests to the API via the `Authorization` header: Authorization: Bearer <token> diff --git a/backend/src/Squidex/Squidex.csproj b/backend/src/Squidex/Squidex.csproj index a62bed67b..f6b7f38e5 100644 --- a/backend/src/Squidex/Squidex.csproj +++ b/backend/src/Squidex/Squidex.csproj @@ -1,11 +1,12 @@  - net6.0 + net7.0 Latest true 10.0 enable en + NU1608 enable true @@ -34,66 +35,55 @@ - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - + + + + + + - - - - - + + - + - - - - - - - - - + + + + + + + + + - - - + + + - - - - true - - - - diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/AppClientJsonTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/AppClientJsonTests.cs index 7794976a9..429319a9c 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/AppClientJsonTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/AppClientJsonTests.cs @@ -7,7 +7,6 @@ using Squidex.Domain.Apps.Core.Apps; using Squidex.Domain.Apps.Core.TestHelpers; -using Xunit; namespace Squidex.Domain.Apps.Core.Model.Apps; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/AppClientsTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/AppClientsTests.cs index 8fc6660ab..327716607 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/AppClientsTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/AppClientsTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using Squidex.Domain.Apps.Core.Apps; -using Xunit; #pragma warning disable SA1310 // Field names must not contain underscore diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/AppContributorsJsonTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/AppContributorsJsonTests.cs index 792f0c338..8c2ab5134 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/AppContributorsJsonTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/AppContributorsJsonTests.cs @@ -7,7 +7,6 @@ using Squidex.Domain.Apps.Core.Apps; using Squidex.Domain.Apps.Core.TestHelpers; -using Xunit; namespace Squidex.Domain.Apps.Core.Model.Apps; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/AppContributorsTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/AppContributorsTests.cs index 467d3909a..4592d8bce 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/AppContributorsTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/AppContributorsTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using Squidex.Domain.Apps.Core.Apps; -using Xunit; #pragma warning disable SA1310 // Field names must not contain underscore diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/AppImageTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/AppImageTests.cs index f157dba63..03e684b93 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/AppImageTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/AppImageTests.cs @@ -7,7 +7,6 @@ using Squidex.Domain.Apps.Core.Apps; using Squidex.Domain.Apps.Core.TestHelpers; -using Xunit; namespace Squidex.Domain.Apps.Core.Model.Apps; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/AppPlanTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/AppPlanTests.cs index 65b2aa0ea..ceab86e88 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/AppPlanTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/AppPlanTests.cs @@ -7,7 +7,6 @@ using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure; -using Xunit; namespace Squidex.Domain.Apps.Core.Model.Apps; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/LanguagesConfigJsonTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/LanguagesConfigJsonTests.cs index 1748e7438..6ebc53b95 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/LanguagesConfigJsonTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/LanguagesConfigJsonTests.cs @@ -5,11 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.Apps; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure; -using Xunit; namespace Squidex.Domain.Apps.Core.Model.Apps; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/LanguagesConfigTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/LanguagesConfigTests.cs index 429dc2128..9700cd101 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/LanguagesConfigTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/LanguagesConfigTests.cs @@ -5,11 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.Apps; using Squidex.Infrastructure; using Squidex.Infrastructure.Collections; -using Xunit; #pragma warning disable SA1310 // Field names must not contain underscore #pragma warning disable CA1806 // Do not ignore method results diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/RoleTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/RoleTests.cs index 37e518b75..2d5a8d16b 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/RoleTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/RoleTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using Squidex.Domain.Apps.Core.Apps; -using Xunit; namespace Squidex.Domain.Apps.Core.Model.Apps; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/RolesJsonTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/RolesJsonTests.cs index 061cd0564..e76c679a5 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/RolesJsonTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/RolesJsonTests.cs @@ -5,12 +5,10 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.Apps; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure.Json.Objects; using Squidex.Infrastructure.Security; -using Xunit; namespace Squidex.Domain.Apps.Core.Model.Apps; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/RolesTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/RolesTests.cs index 1ae8dc23f..820352838 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/RolesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Apps/RolesTests.cs @@ -5,11 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.Apps; using Squidex.Infrastructure.Json.Objects; using Squidex.Infrastructure.Security; -using Xunit; #pragma warning disable SA1310 // Field names must not contain underscore diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Assets/AssetMetadataTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Assets/AssetMetadataTests.cs index b17d8602e..f97d54c68 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Assets/AssetMetadataTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Assets/AssetMetadataTests.cs @@ -7,7 +7,6 @@ using Squidex.Domain.Apps.Core.Assets; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Core.Model.Assets; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/ContentDataTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/ContentDataTests.cs index 9a3ad5dc1..7abdf4a2d 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/ContentDataTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/ContentDataTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using Squidex.Domain.Apps.Core.Contents; -using Xunit; namespace Squidex.Domain.Apps.Core.Model.Contents; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/ContentFieldDataTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/ContentFieldDataTests.cs index a268bb7ea..300978299 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/ContentFieldDataTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/ContentFieldDataTests.cs @@ -8,7 +8,6 @@ using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Core.Model.Contents; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/StatusTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/StatusTests.cs index a18c2dd20..42e56c4a2 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/StatusTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/StatusTests.cs @@ -8,7 +8,6 @@ using System.ComponentModel; using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Core.TestHelpers; -using Xunit; namespace Squidex.Domain.Apps.Core.Model.Contents; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/TranslationStatusTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/TranslationStatusTests.cs index 468c1795b..bc1489166 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/TranslationStatusTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/TranslationStatusTests.cs @@ -9,7 +9,6 @@ using Squidex.Domain.Apps.Core.Apps; using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Infrastructure; -using Xunit; namespace Squidex.Domain.Apps.Core.Model.Contents; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/WorkflowJsonTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/WorkflowJsonTests.cs index fab8b8053..2645b5fe8 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/WorkflowJsonTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/WorkflowJsonTests.cs @@ -10,7 +10,6 @@ using Squidex.Domain.Apps.Core.Contents.Json; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Collections; -using Xunit; namespace Squidex.Domain.Apps.Core.Model.Contents; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/WorkflowTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/WorkflowTests.cs index 1c6eb4d74..ce920b2e7 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/WorkflowTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/WorkflowTests.cs @@ -7,7 +7,6 @@ using Squidex.Domain.Apps.Core.Contents; using Squidex.Infrastructure.Collections; -using Xunit; namespace Squidex.Domain.Apps.Core.Model.Contents; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/WorkflowsJsonTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/WorkflowsJsonTests.cs index 4986a30d5..0d3a004a3 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/WorkflowsJsonTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/WorkflowsJsonTests.cs @@ -8,7 +8,6 @@ using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure; -using Xunit; namespace Squidex.Domain.Apps.Core.Model.Contents; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/WorkflowsTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/WorkflowsTests.cs index 7c4c4b81c..11da80743 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/WorkflowsTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Contents/WorkflowsTests.cs @@ -7,7 +7,6 @@ using Squidex.Domain.Apps.Core.Contents; using Squidex.Infrastructure; -using Xunit; #pragma warning disable SA1310 // Field names must not contain underscore diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/InvariantPartitionTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/InvariantPartitionTests.cs index 4ab105f40..2295d2cd2 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/InvariantPartitionTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/InvariantPartitionTests.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using Xunit; - namespace Squidex.Domain.Apps.Core.Model; public class InvariantPartitionTests diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/PartitioningTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/PartitioningTests.cs index 07c43783e..997c979bb 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/PartitioningTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/PartitioningTests.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using Xunit; - namespace Squidex.Domain.Apps.Core.Model; public class PartitioningTests diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Rules/RuleTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Rules/RuleTests.cs index c1a77cc3c..c47f97fb9 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Rules/RuleTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Rules/RuleTests.cs @@ -5,13 +5,10 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.Rules; using Squidex.Domain.Apps.Core.Rules.Triggers; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure.Migrations; -using Squidex.Infrastructure.Reflection; -using Xunit; #pragma warning disable SA1310 // Field names must not contain underscore @@ -49,13 +46,11 @@ public class RuleTests } } - [TypeName(nameof(TestAction1))] public sealed record TestAction1 : RuleAction { public string Property { get; set; } } - [TypeName(nameof(TestAction2))] public sealed record TestAction2 : RuleAction { public string Property { get; set; } diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Schemas/ArrayFieldTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Schemas/ArrayFieldTests.cs index a764e9283..1d362bd85 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Schemas/ArrayFieldTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Schemas/ArrayFieldTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using Squidex.Domain.Apps.Core.Schemas; -using Xunit; #pragma warning disable SA1310 // Field names must not contain underscore diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Schemas/FieldCompareTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Schemas/FieldCompareTests.cs index 1b7e04d7a..e33d6724e 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Schemas/FieldCompareTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Schemas/FieldCompareTests.cs @@ -7,7 +7,6 @@ using Squidex.Domain.Apps.Core.Schemas; using Squidex.Infrastructure.Collections; -using Xunit; namespace Squidex.Domain.Apps.Core.Model.Schemas; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Schemas/SchemaFieldTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Schemas/SchemaFieldTests.cs index 07a247ae9..0f64686b8 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Schemas/SchemaFieldTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Schemas/SchemaFieldTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using Squidex.Domain.Apps.Core.Schemas; -using Xunit; #pragma warning disable SA1310 // Field names must not contain underscore diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Schemas/SchemaTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Schemas/SchemaTests.cs index 5251c190d..016b37b60 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Schemas/SchemaTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Model/Schemas/SchemaTests.cs @@ -5,11 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure.Collections; -using Xunit; #pragma warning disable SA1310 // Field names must not contain underscore diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ConvertContent/ContentConversionFlatTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ConvertContent/ContentConversionFlatTests.cs index 854f66a1f..0f960594a 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ConvertContent/ContentConversionFlatTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ConvertContent/ContentConversionFlatTests.cs @@ -9,7 +9,6 @@ using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Core.ConvertContent; using Squidex.Infrastructure; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ConvertContent; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ConvertContent/ContentConversionTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ConvertContent/ContentConversionTests.cs index 0dae97627..d0dff0c9a 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ConvertContent/ContentConversionTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ConvertContent/ContentConversionTests.cs @@ -10,7 +10,6 @@ using Squidex.Domain.Apps.Core.ConvertContent; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Infrastructure; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ConvertContent; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ConvertContent/FieldConvertersTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ConvertContent/FieldConvertersTests.cs index 225a87d1a..9f6da35db 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ConvertContent/FieldConvertersTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ConvertContent/FieldConvertersTests.cs @@ -12,7 +12,6 @@ using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ConvertContent; @@ -20,7 +19,7 @@ public class FieldConvertersTests { private readonly LanguagesConfig languages = LanguagesConfig.English.Set(Language.DE); - private static IEnumerable InvalidValues() + public static IEnumerable InvalidValues() { yield return new object?[] { JsonValue.Null }; yield return new object?[] { JsonValue.Create(false) }; // Undefined diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ConvertContent/StringFormatterTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ConvertContent/StringFormatterTests.cs index fc7a9d075..acd397385 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ConvertContent/StringFormatterTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ConvertContent/StringFormatterTests.cs @@ -8,7 +8,6 @@ using Squidex.Domain.Apps.Core.ConvertContent; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ConvertContent; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ConvertContent/ValueConvertersTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ConvertContent/ValueConvertersTests.cs index a8dcf8241..71d80dd89 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ConvertContent/ValueConvertersTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ConvertContent/ValueConvertersTests.cs @@ -5,14 +5,12 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Core.ConvertContent; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ConvertContent; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/DefaultValues/DefaultValuesTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/DefaultValues/DefaultValuesTests.cs index fba91be4f..4188b6920 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/DefaultValues/DefaultValuesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/DefaultValues/DefaultValuesTests.cs @@ -13,7 +13,6 @@ using Squidex.Domain.Apps.Core.Schemas; using Squidex.Infrastructure; using Squidex.Infrastructure.Collections; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.DefaultValues; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/EventSynchronization/AssertHelper.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/EventSynchronization/AssertHelper.cs index 4d69d2f76..52b6ff97e 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/EventSynchronization/AssertHelper.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/EventSynchronization/AssertHelper.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Infrastructure.EventSourcing; namespace Squidex.Domain.Apps.Core.Operations.EventSynchronization; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/EventSynchronization/SchemaSynchronizerTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/EventSynchronization/SchemaSynchronizerTests.cs index afac508fb..5ba7a739e 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/EventSynchronization/SchemaSynchronizerTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/EventSynchronization/SchemaSynchronizerTests.cs @@ -10,7 +10,6 @@ using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Events.Schemas; using Squidex.Infrastructure; using Squidex.Infrastructure.Collections; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.EventSynchronization; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ExtractReferenceIds/ReferenceExtractionTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ExtractReferenceIds/ReferenceExtractionTests.cs index 577abda2c..ed61740df 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ExtractReferenceIds/ReferenceExtractionTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ExtractReferenceIds/ReferenceExtractionTests.cs @@ -11,7 +11,6 @@ using Squidex.Domain.Apps.Core.ExtractReferenceIds; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Infrastructure; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ExtractReferenceIds; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ExtractReferenceIds/ReferenceFormattingTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ExtractReferenceIds/ReferenceFormattingTests.cs index 63da258d5..1bd76abf1 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ExtractReferenceIds/ReferenceFormattingTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ExtractReferenceIds/ReferenceFormattingTests.cs @@ -11,7 +11,6 @@ using Squidex.Domain.Apps.Core.ExtractReferenceIds; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Infrastructure; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ExtractReferenceIds; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ExtractReferenceIds/StringReferenceExtractorTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ExtractReferenceIds/StringReferenceExtractorTests.cs index 13bb3d109..0bbf80767 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ExtractReferenceIds/StringReferenceExtractorTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ExtractReferenceIds/StringReferenceExtractorTests.cs @@ -5,10 +5,8 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core.ExtractReferenceIds; using Squidex.Infrastructure; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ExtractReferenceIds; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/GenerateFilters/FiltersTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/GenerateFilters/FiltersTests.cs index c9fdec620..75ec16a1d 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/GenerateFilters/FiltersTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/GenerateFilters/FiltersTests.cs @@ -11,7 +11,6 @@ using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Queries; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.GenerateFilters; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/GenerateJsonSchema/JsonSchemaTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/GenerateJsonSchema/JsonSchemaTests.cs index a18090fd8..7447e98e6 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/GenerateJsonSchema/JsonSchemaTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/GenerateJsonSchema/JsonSchemaTests.cs @@ -11,7 +11,6 @@ using Squidex.Domain.Apps.Core.GenerateJsonSchema; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.GenerateJsonSchema; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/EventEnricherTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/EventEnricherTests.cs index 3d7caf59f..d89ce96ea 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/EventEnricherTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/EventEnricherTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Options; using NodaTime; @@ -16,7 +15,6 @@ using Squidex.Domain.Apps.Events.Contents; using Squidex.Infrastructure; using Squidex.Infrastructure.EventSourcing; using Squidex.Shared.Users; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.HandleRules; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/EventJsonSchemaGeneratorTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/EventJsonSchemaGeneratorTests.cs index 9158aeea0..90cb75604 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/EventJsonSchemaGeneratorTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/EventJsonSchemaGeneratorTests.cs @@ -8,7 +8,6 @@ using NJsonSchema.Generation; using Squidex.Domain.Apps.Core.HandleRules; using Squidex.Domain.Apps.Core.Rules.EnrichedEvents; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.HandleRules; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/RuleElementRegistryTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/RuleElementRegistryTests.cs deleted file mode 100644 index b56ff1dbf..000000000 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/RuleElementRegistryTests.cs +++ /dev/null @@ -1,203 +0,0 @@ -// ========================================================================== -// Squidex Headless CMS -// ========================================================================== -// Copyright (c) Squidex UG (haftungsbeschraenkt) -// All rights reserved. Licensed under the MIT license. -// ========================================================================== - -using System.ComponentModel.DataAnnotations; -using FluentAssertions; -using Squidex.Domain.Apps.Core.HandleRules; -using Squidex.Domain.Apps.Core.Rules; -using Squidex.Infrastructure.Validation; -using Xunit; - -namespace Squidex.Domain.Apps.Core.Operations.HandleRules; - -public class RuleElementRegistryTests -{ - private readonly RuleTypeProvider sut = new RuleTypeProvider(); - - private abstract class MyRuleActionHandler : RuleActionHandler - { - protected MyRuleActionHandler(RuleEventFormatter formatter) - : base(formatter) - { - } - } - - public enum ActionEnum - { - Yes, - No - } - - [RuleAction( - Title = "Action", - IconImage = "", - IconColor = "#1e5470", - Display = "Action display", - Description = "Action description.", - ReadMore = "https://www.readmore.com/")] - public sealed record MyRuleAction : RuleAction - { - [LocalizedRequired] - [Display(Name = "Url Name", Description = "Url Description")] - [Editor(RuleFieldEditor.Url)] - [Formattable] - public Uri Url { get; set; } - - [Editor(RuleFieldEditor.Javascript)] - public string Script { get; set; } - - [Editor(RuleFieldEditor.Text)] - public string Text { get; set; } - - [Editor(RuleFieldEditor.TextArea)] - public string TextMultiline { get; set; } - - [Editor(RuleFieldEditor.Password)] - public string Password { get; set; } - - [Editor(RuleFieldEditor.Text)] - public ActionEnum Enum { get; set; } - - [Editor(RuleFieldEditor.Text)] - public ActionEnum? EnumOptional { get; set; } - - [Editor(RuleFieldEditor.Text)] - public bool Boolean { get; set; } - - [Editor(RuleFieldEditor.Text)] - public bool? BooleanOptional { get; set; } - - [Editor(RuleFieldEditor.Text)] - public int Number { get; set; } - - [Editor(RuleFieldEditor.Text)] - public int? NumberOptional { get; set; } - } - - [Fact] - public void Should_create_definition() - { - var expected = new RuleActionDefinition - { - Type = typeof(MyRuleAction), - Title = "Action", - IconImage = "", - IconColor = "#1e5470", - Display = "Action display", - Description = "Action description.", - ReadMore = "https://www.readmore.com/" - }; - - expected.Properties.Add(new RuleActionProperty - { - Name = "url", - Display = "Url Name", - Description = "Url Description", - Editor = RuleFieldEditor.Url, - IsFormattable = true, - IsRequired = true - }); - - expected.Properties.Add(new RuleActionProperty - { - Name = "script", - Display = "Script", - Description = null, - Editor = RuleFieldEditor.Javascript, - IsRequired = false - }); - - expected.Properties.Add(new RuleActionProperty - { - Name = "text", - Display = "Text", - Description = null, - Editor = RuleFieldEditor.Text, - IsRequired = false - }); - - expected.Properties.Add(new RuleActionProperty - { - Name = "textMultiline", - Display = "TextMultiline", - Description = null, - Editor = RuleFieldEditor.TextArea, - IsRequired = false - }); - - expected.Properties.Add(new RuleActionProperty - { - Name = "password", - Display = "Password", - Description = null, - Editor = RuleFieldEditor.Password, - IsRequired = false - }); - - expected.Properties.Add(new RuleActionProperty - { - Name = "enum", - Display = "Enum", - Description = null, - Editor = RuleFieldEditor.Dropdown, - IsRequired = false, - Options = new[] { "Yes", "No" } - }); - - expected.Properties.Add(new RuleActionProperty - { - Name = "enumOptional", - Display = "EnumOptional", - Description = null, - Editor = RuleFieldEditor.Dropdown, - IsRequired = false, - Options = new[] { "Yes", "No" } - }); - - expected.Properties.Add(new RuleActionProperty - { - Name = "boolean", - Display = "Boolean", - Description = null, - Editor = RuleFieldEditor.Checkbox, - IsRequired = false - }); - - expected.Properties.Add(new RuleActionProperty - { - Name = "booleanOptional", - Display = "BooleanOptional", - Description = null, - Editor = RuleFieldEditor.Checkbox, - IsRequired = false - }); - - expected.Properties.Add(new RuleActionProperty - { - Name = "number", - Display = "Number", - Description = null, - Editor = RuleFieldEditor.Number, - IsRequired = true - }); - - expected.Properties.Add(new RuleActionProperty - { - Name = "numberOptional", - Display = "NumberOptional", - Description = null, - Editor = RuleFieldEditor.Number, - IsRequired = false - }); - - sut.Add(); - - var currentDefinition = sut.Actions.Values.First(); - - currentDefinition.Should().BeEquivalentTo(expected); - } -} diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/RuleEventFormatterCompareTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/RuleEventFormatterCompareTests.cs index 4a8958b5f..cc1eab8ce 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/RuleEventFormatterCompareTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/RuleEventFormatterCompareTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using System.Security.Claims; -using FakeItEasy; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Options; using NodaTime; @@ -24,7 +23,6 @@ using Squidex.Infrastructure; using Squidex.Infrastructure.Json.Objects; using Squidex.Shared.Identity; using Squidex.Shared.Users; -using Xunit; #pragma warning disable CA2012 // Use ValueTasks correctly diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/RuleEventFormatterTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/RuleEventFormatterTests.cs index 591cab079..4a129005c 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/RuleEventFormatterTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/RuleEventFormatterTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using System.Security.Claims; -using FakeItEasy; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Options; using Squidex.Domain.Apps.Core.Contents; @@ -22,7 +21,6 @@ using Squidex.Infrastructure; using Squidex.Infrastructure.Json.Objects; using Squidex.Shared.Identity; using Squidex.Shared.Users; -using Xunit; #pragma warning disable CA2012 // Use ValueTasks correctly diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/RuleServiceTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/RuleServiceTests.cs index 82f32abb9..bf0ed47e4 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/RuleServiceTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/RuleServiceTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using NodaTime; @@ -19,7 +18,6 @@ using Squidex.Domain.Apps.Events.Contents; using Squidex.Infrastructure; using Squidex.Infrastructure.EventSourcing; using Squidex.Infrastructure.Reflection; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.HandleRules; @@ -35,7 +33,7 @@ public class RuleServiceTests private readonly string actionDescription = "MyDescription"; private readonly DomainId ruleId = DomainId.NewGuid(); private readonly NamedId appId = NamedId.Of(DomainId.NewGuid(), "my-app"); - private readonly TypeNameRegistry typeNameRegistry = new TypeNameRegistry(); + private readonly TypeRegistry typeRegistry = new TypeRegistry(); private readonly RuleService sut; public sealed class InvalidEvent : IEvent @@ -65,8 +63,7 @@ public class RuleServiceTests public RuleServiceTests() { - typeNameRegistry.Map(typeof(ContentCreated)); - typeNameRegistry.Map(typeof(ValidAction), actionName); + typeRegistry.Add(actionName); A.CallTo(() => clock.GetCurrentInstant()) .Returns(SystemClock.Instance.GetCurrentInstant().WithoutMs()); @@ -85,7 +82,7 @@ public class RuleServiceTests sut = new RuleService(Options.Create(new RuleOptions()), new[] { ruleTriggerHandler }, new[] { ruleActionHandler }, - eventEnricher, TestUtils.DefaultSerializer, log, typeNameRegistry) + eventEnricher, TestUtils.DefaultSerializer, log, typeRegistry) { Clock = clock }; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/RuleTypeProviderTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/RuleTypeProviderTests.cs index 420a6638b..0f36b6bf3 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/RuleTypeProviderTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/HandleRules/RuleTypeProviderTests.cs @@ -6,11 +6,9 @@ // ========================================================================== using System.ComponentModel.DataAnnotations; -using FluentAssertions; using Squidex.Domain.Apps.Core.HandleRules; using Squidex.Domain.Apps.Core.Rules; using Squidex.Infrastructure.Validation; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.HandleRules; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Scripting/ContentDataObjectTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Scripting/ContentDataObjectTests.cs index 480ad1cea..97649965d 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Scripting/ContentDataObjectTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Scripting/ContentDataObjectTests.cs @@ -10,7 +10,6 @@ using Jint.Runtime; using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Core.Scripting.ContentWrapper; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.Scripting; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Scripting/JintScriptEngineHelperTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Scripting/JintScriptEngineHelperTests.cs index 5287daf46..7e0711537 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Scripting/JintScriptEngineHelperTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Scripting/JintScriptEngineHelperTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using System.Net; -using FakeItEasy; using Jint.Runtime; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Options; @@ -16,7 +15,6 @@ using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Json.Objects; using Squidex.Infrastructure.Validation; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.Scripting; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Scripting/JintScriptEngineTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Scripting/JintScriptEngineTests.cs index b07d64846..fbad4e865 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Scripting/JintScriptEngineTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Scripting/JintScriptEngineTests.cs @@ -7,7 +7,6 @@ using System.Net; using System.Security.Claims; -using FakeItEasy; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Options; using Squidex.Domain.Apps.Core.Contents; @@ -18,7 +17,6 @@ using Squidex.Infrastructure; using Squidex.Infrastructure.Json.Objects; using Squidex.Infrastructure.Security; using Squidex.Infrastructure.Validation; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.Scripting; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Scripting/JintUserTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Scripting/JintUserTests.cs index aa775079f..43bf3db1b 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Scripting/JintUserTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Scripting/JintUserTests.cs @@ -10,7 +10,6 @@ using Jint; using Squidex.Domain.Apps.Core.Scripting; using Squidex.Infrastructure.Security; using Squidex.Shared.Identity; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.Scripting; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Scripting/MockupHttpHandler.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Scripting/MockupHttpHandler.cs index c00ca0027..78234c30d 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Scripting/MockupHttpHandler.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Scripting/MockupHttpHandler.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using Xunit; - namespace Squidex.Domain.Apps.Core.Operations.Scripting; internal sealed class MockupHttpHandler : HttpMessageHandler diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Scripting/ScriptingCompleterTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Scripting/ScriptingCompleterTests.cs index ea27490d5..5018cd702 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Scripting/ScriptingCompleterTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Scripting/ScriptingCompleterTests.cs @@ -5,13 +5,11 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core.Apps; using Squidex.Domain.Apps.Core.GenerateFilters; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.Scripting; using Squidex.Infrastructure.Queries; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.Scripting; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Subscriptions/AssetSubscriptionTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Subscriptions/AssetSubscriptionTests.cs index af8542ce6..7ac680a95 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Subscriptions/AssetSubscriptionTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Subscriptions/AssetSubscriptionTests.cs @@ -12,7 +12,6 @@ using Squidex.Domain.Apps.Events.Assets; using Squidex.Infrastructure; using Squidex.Infrastructure.Security; using Squidex.Shared; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.Subscriptions; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Subscriptions/ContentSubscriptionTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Subscriptions/ContentSubscriptionTests.cs index ddb3fdaca..800f102ae 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Subscriptions/ContentSubscriptionTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Subscriptions/ContentSubscriptionTests.cs @@ -12,7 +12,6 @@ using Squidex.Domain.Apps.Events.Contents; using Squidex.Infrastructure; using Squidex.Infrastructure.Security; using Squidex.Shared; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.Subscriptions; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Subscriptions/EventMessageEvaluatorTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Subscriptions/EventMessageEvaluatorTests.cs index 73cd9eb6c..9ce2eb944 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Subscriptions/EventMessageEvaluatorTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Subscriptions/EventMessageEvaluatorTests.cs @@ -13,7 +13,6 @@ using Squidex.Domain.Apps.Events.Contents; using Squidex.Infrastructure; using Squidex.Infrastructure.Security; using Squidex.Shared; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.Subscriptions; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Subscriptions/EventMessageWrapperTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Subscriptions/EventMessageWrapperTests.cs index faba7ee0d..a2480f24d 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Subscriptions/EventMessageWrapperTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Subscriptions/EventMessageWrapperTests.cs @@ -5,13 +5,11 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core.Rules.EnrichedEvents; using Squidex.Domain.Apps.Core.Subscriptions; using Squidex.Domain.Apps.Events; using Squidex.Domain.Apps.Events.Apps; using Squidex.Infrastructure.EventSourcing; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.Subscriptions; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Subscriptions/SubscriptionPublisherTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Subscriptions/SubscriptionPublisherTests.cs index ec4467562..3ccef6185 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Subscriptions/SubscriptionPublisherTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Subscriptions/SubscriptionPublisherTests.cs @@ -5,12 +5,10 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core.Subscriptions; using Squidex.Domain.Apps.Events.Apps; using Squidex.Infrastructure.EventSourcing; using Squidex.Messaging.Subscriptions; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.Subscriptions; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Templates/FluidTemplateEngineTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Templates/FluidTemplateEngineTests.cs index f0c511b52..d38e70227 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Templates/FluidTemplateEngineTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/Templates/FluidTemplateEngineTests.cs @@ -10,7 +10,6 @@ using Squidex.Domain.Apps.Core.Rules.EnrichedEvents; using Squidex.Domain.Apps.Core.Templates; using Squidex.Domain.Apps.Core.Templates.Extensions; using Squidex.Infrastructure; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.Templates; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ArrayFieldTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ArrayFieldTests.cs index 9cbe0a864..f6f1d0c13 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ArrayFieldTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ArrayFieldTests.cs @@ -5,12 +5,10 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure.Collections; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ValidateContent; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/AssetsFieldTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/AssetsFieldTests.cs index 5ac593271..759829a00 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/AssetsFieldTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/AssetsFieldTests.cs @@ -5,14 +5,12 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Core.ValidateContent; using Squidex.Domain.Apps.Core.ValidateContent.Validators; using Squidex.Infrastructure; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ValidateContent; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/BooleanFieldTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/BooleanFieldTests.cs index 5be459f04..f4561e7af 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/BooleanFieldTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/BooleanFieldTests.cs @@ -5,11 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ValidateContent; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ComponentFieldTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ComponentFieldTests.cs index 0239cad2e..56061a968 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ComponentFieldTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ComponentFieldTests.cs @@ -5,14 +5,12 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Collections; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ValidateContent; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ComponentsFieldTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ComponentsFieldTests.cs index 03e1fd81a..88c19ee9c 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ComponentsFieldTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ComponentsFieldTests.cs @@ -5,14 +5,12 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Collections; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ValidateContent; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ContentValidationTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ContentValidationTests.cs index 7b282cfea..677741d27 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ContentValidationTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ContentValidationTests.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; -using FluentAssertions; using Squidex.Domain.Apps.Core.Apps; using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Core.Schemas; @@ -15,7 +13,6 @@ using Squidex.Domain.Apps.Core.ValidateContent; using Squidex.Infrastructure; using Squidex.Infrastructure.Json.Objects; using Squidex.Infrastructure.Validation; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ValidateContent; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/DateTimeFieldTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/DateTimeFieldTests.cs index 5898616a4..3db70795b 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/DateTimeFieldTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/DateTimeFieldTests.cs @@ -5,13 +5,11 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using NodaTime; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ValidateContent; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/GeolocationFieldTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/GeolocationFieldTests.cs index 49ce6564a..298e4f9da 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/GeolocationFieldTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/GeolocationFieldTests.cs @@ -5,11 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ValidateContent; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/JsonFieldTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/JsonFieldTests.cs index 551a452b4..5587bb3ba 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/JsonFieldTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/JsonFieldTests.cs @@ -5,11 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ValidateContent; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/NumberFieldTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/NumberFieldTests.cs index 2b7037497..f17d9c9fb 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/NumberFieldTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/NumberFieldTests.cs @@ -5,12 +5,10 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure.Collections; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ValidateContent; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ReferencesFieldTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ReferencesFieldTests.cs index 859aa0f86..4f0c1ae79 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ReferencesFieldTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/ReferencesFieldTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; @@ -13,7 +12,6 @@ using Squidex.Domain.Apps.Core.ValidateContent; using Squidex.Domain.Apps.Core.ValidateContent.Validators; using Squidex.Infrastructure; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ValidateContent; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/StringFieldTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/StringFieldTests.cs index c1a385f42..755097c5a 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/StringFieldTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/StringFieldTests.cs @@ -5,12 +5,10 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure.Collections; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ValidateContent; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/TagsFieldTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/TagsFieldTests.cs index cfc759d7b..328fa7b73 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/TagsFieldTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/TagsFieldTests.cs @@ -5,12 +5,10 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure.Collections; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ValidateContent; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/UIFieldTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/UIFieldTests.cs index f1f02f58d..cd9a83b4b 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/UIFieldTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/UIFieldTests.cs @@ -5,14 +5,12 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Core.ValidateContent; using Squidex.Infrastructure.Json.Objects; using Squidex.Infrastructure.Validation; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ValidateContent; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/AllowedValuesValidatorTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/AllowedValuesValidatorTests.cs index bf6530c98..84ea27413 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/AllowedValuesValidatorTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/AllowedValuesValidatorTests.cs @@ -5,10 +5,8 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Core.ValidateContent.Validators; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ValidateContent.Validators; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/AssetsValidatorTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/AssetsValidatorTests.cs index f6434fe1f..956da8ad3 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/AssetsValidatorTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/AssetsValidatorTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.Assets; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; @@ -13,7 +12,6 @@ using Squidex.Domain.Apps.Core.ValidateContent; using Squidex.Domain.Apps.Core.ValidateContent.Validators; using Squidex.Infrastructure; using Squidex.Infrastructure.Collections; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ValidateContent.Validators; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/CollectionItemValidatorTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/CollectionItemValidatorTests.cs index 07b824439..5b58eeaaf 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/CollectionItemValidatorTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/CollectionItemValidatorTests.cs @@ -5,10 +5,8 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Core.ValidateContent.Validators; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ValidateContent.Validators; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/CollectionValidatorTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/CollectionValidatorTests.cs index 06be77222..f0bab3082 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/CollectionValidatorTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/CollectionValidatorTests.cs @@ -5,10 +5,8 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Core.ValidateContent.Validators; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ValidateContent.Validators; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/ComponentValidatorTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/ComponentValidatorTests.cs index aab779619..a18e500f0 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/ComponentValidatorTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/ComponentValidatorTests.cs @@ -5,14 +5,12 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Core.ValidateContent; using Squidex.Domain.Apps.Core.ValidateContent.Validators; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ValidateContent.Validators; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/NoValueValidatorTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/NoValueValidatorTests.cs index 1a1c84c1f..43e3edd68 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/NoValueValidatorTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/NoValueValidatorTests.cs @@ -5,12 +5,10 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Core.ValidateContent; using Squidex.Domain.Apps.Core.ValidateContent.Validators; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ValidateContent.Validators; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/PatternValidatorTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/PatternValidatorTests.cs index 88b5e0095..73543c805 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/PatternValidatorTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/PatternValidatorTests.cs @@ -5,10 +5,8 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Core.ValidateContent.Validators; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ValidateContent.Validators; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/RangeValidatorTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/RangeValidatorTests.cs index 3c16b226d..589b29af1 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/RangeValidatorTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/RangeValidatorTests.cs @@ -5,10 +5,8 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Core.ValidateContent.Validators; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ValidateContent.Validators; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/ReferencesValidatorTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/ReferencesValidatorTests.cs index 9814dfbe2..501fa6f59 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/ReferencesValidatorTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/ReferencesValidatorTests.cs @@ -5,14 +5,12 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Core.ValidateContent; using Squidex.Domain.Apps.Core.ValidateContent.Validators; using Squidex.Infrastructure; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ValidateContent.Validators; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/RequiredStringValidatorTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/RequiredStringValidatorTests.cs index 562102a0e..52d9d6ed8 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/RequiredStringValidatorTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/RequiredStringValidatorTests.cs @@ -5,10 +5,8 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Core.ValidateContent.Validators; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ValidateContent.Validators; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/RequiredValidatorTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/RequiredValidatorTests.cs index e6386bfee..87cb52f1a 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/RequiredValidatorTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/RequiredValidatorTests.cs @@ -5,10 +5,8 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Core.ValidateContent.Validators; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ValidateContent.Validators; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/StringLengthValidatorTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/StringLengthValidatorTests.cs index 63d66e5b4..4747ec3f2 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/StringLengthValidatorTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/StringLengthValidatorTests.cs @@ -6,10 +6,8 @@ // ========================================================================== using System.Text; -using FluentAssertions; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Core.ValidateContent.Validators; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ValidateContent.Validators; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/StringTextValidatorTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/StringTextValidatorTests.cs index cdd27af80..b84247b60 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/StringTextValidatorTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/StringTextValidatorTests.cs @@ -6,10 +6,8 @@ // ========================================================================== using System.Text; -using FluentAssertions; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Core.ValidateContent.Validators; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ValidateContent.Validators; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/UniqueObjectValuesValidatorTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/UniqueObjectValuesValidatorTests.cs index 0bc0f8064..a3a05035e 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/UniqueObjectValuesValidatorTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/UniqueObjectValuesValidatorTests.cs @@ -5,11 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Core.ValidateContent.Validators; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ValidateContent.Validators; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/UniqueValidatorTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/UniqueValidatorTests.cs index d5af9a497..2ffdc2dd9 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/UniqueValidatorTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/UniqueValidatorTests.cs @@ -5,12 +5,10 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Core.ValidateContent.Validators; using Squidex.Infrastructure; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ValidateContent.Validators; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/UniqueValuesValidatorTests.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/UniqueValuesValidatorTests.cs index 324e6fab1..65232db91 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/UniqueValuesValidatorTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Operations/ValidateContent/Validators/UniqueValuesValidatorTests.cs @@ -5,10 +5,8 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Core.ValidateContent.Validators; -using Xunit; namespace Squidex.Domain.Apps.Core.Operations.ValidateContent.Validators; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/Squidex.Domain.Apps.Core.Tests.csproj b/backend/tests/Squidex.Domain.Apps.Core.Tests/Squidex.Domain.Apps.Core.Tests.csproj index e248b6cf6..0891fd596 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/Squidex.Domain.Apps.Core.Tests.csproj +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/Squidex.Domain.Apps.Core.Tests.csproj @@ -1,7 +1,7 @@  Exe - net6.0 + net7.0 Squidex.Domain.Apps.Core 10.0 enable @@ -15,24 +15,29 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + - + all runtime; build; native; contentfiles; analyzers + + + + + diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/TestHelpers/AExtensions.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/TestHelpers/AExtensions.cs index 52a2d6d2d..bde1a0cb6 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/TestHelpers/AExtensions.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/TestHelpers/AExtensions.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; - namespace Squidex.Domain.Apps.Core.TestHelpers; public static class AExtensions diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/TestHelpers/TestUtils.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/TestHelpers/TestUtils.cs index b3a56ac0f..aa9e8b353 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/TestHelpers/TestUtils.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/TestHelpers/TestUtils.cs @@ -5,6 +5,7 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== +using System.Reflection; using System.Runtime.Serialization.Formatters.Binary; using System.Security.Claims; using System.Text.Json; @@ -41,6 +42,8 @@ namespace Squidex.Domain.Apps.Core.TestHelpers; public static class TestUtils { + public static readonly TypeRegistry TypeRegistry = CreateTypeRegistry(typeof(TestUtils).Assembly); + public static readonly IJsonSerializer DefaultSerializer = CreateSerializer(); public sealed class ObjectHolder @@ -71,6 +74,20 @@ public static class TestUtils BsonStringSerializer.Register(); } + public static TypeRegistry CreateTypeRegistry(Assembly assembly) + { + var typeRegistry = + new TypeRegistry() + .Map(new FieldTypeProvider()) + .Map(new AssemblyTypeProvider(assembly)) + .Map(new AssemblyTypeProvider(SquidexEvents.Assembly)) + .Map(new AssemblyTypeProvider(assembly)) + .Map(new AssemblyTypeProvider(assembly)) + .Map(new RuleTypeProvider()); + + return typeRegistry; + } + public static IJsonSerializer CreateSerializer(Action? configure = null) { var serializerSettings = DefaultOptions(configure); @@ -80,22 +97,17 @@ public static class TestUtils public static JsonSerializerOptions DefaultOptions(Action? configure = null) { - var typeNameRegistry = - new TypeNameRegistry() - .Map(new FieldTypeProvider()) - .Map(new RuleTypeProvider()) - .MapUnmapped(typeof(TestUtils).Assembly); - var options = new JsonSerializerOptions(JsonSerializerDefaults.Web); - options.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb); // It is also a readonly list, so we have to register it first, so that other converters do not pick this up. options.Converters.Add(new StringConverter(x => x)); + + options.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb); options.Converters.Add(new GeoJsonConverterFactory()); - options.Converters.Add(new InheritanceConverter(typeNameRegistry)); - options.Converters.Add(new InheritanceConverter(typeNameRegistry)); - options.Converters.Add(new InheritanceConverter(typeNameRegistry)); - options.Converters.Add(new InheritanceConverter(typeNameRegistry)); + options.Converters.Add(new PolymorphicConverter(TypeRegistry)); + options.Converters.Add(new PolymorphicConverter(TypeRegistry)); + options.Converters.Add(new PolymorphicConverter(TypeRegistry)); + options.Converters.Add(new PolymorphicConverter(TypeRegistry)); options.Converters.Add(new JsonValueConverter()); options.Converters.Add(new ReadonlyDictionaryConverterFactory()); options.Converters.Add(new ReadonlyListConverterFactory()); @@ -118,6 +130,7 @@ public static class TestUtils options.Converters.Add(new StringConverter()); options.Converters.Add(new StringConverter()); options.Converters.Add(new JsonStringEnumConverter()); + options.TypeInfoResolver = new PolymorphicTypeResolver(TypeRegistry); configure?.Invoke(options); return options; diff --git a/backend/tests/Squidex.Domain.Apps.Core.Tests/TestHelpers/UserMocks.cs b/backend/tests/Squidex.Domain.Apps.Core.Tests/TestHelpers/UserMocks.cs index f440767c3..5fd0c9eeb 100644 --- a/backend/tests/Squidex.Domain.Apps.Core.Tests/TestHelpers/UserMocks.cs +++ b/backend/tests/Squidex.Domain.Apps.Core.Tests/TestHelpers/UserMocks.cs @@ -6,7 +6,6 @@ // ========================================================================== using System.Security.Claims; -using FakeItEasy; using Squidex.Shared.Identity; using Squidex.Shared.Users; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/AppProviderExtensionsTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/AppProviderExtensionsTests.cs index 4296f090c..6327e3470 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/AppProviderExtensionsTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/AppProviderExtensionsTests.cs @@ -5,12 +5,10 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; -using Xunit; namespace Squidex.Domain.Apps.Entities; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/AppProviderTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/AppProviderTests.cs index de5293904..bc60ab4df 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/AppProviderTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/AppProviderTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Caching; using Squidex.Domain.Apps.Entities.Apps; using Squidex.Domain.Apps.Entities.Apps.Indexes; @@ -18,7 +17,6 @@ using Squidex.Domain.Apps.Entities.Teams.Indexes; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Security; -using Xunit; namespace Squidex.Domain.Apps.Entities; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/AlwaysCreateClientCommandMiddlewareTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/AlwaysCreateClientCommandMiddlewareTests.cs index 59cd36ed4..710b75df1 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/AlwaysCreateClientCommandMiddlewareTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/AlwaysCreateClientCommandMiddlewareTests.cs @@ -5,11 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Entities.Apps.Commands; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; -using Xunit; namespace Squidex.Domain.Apps.Entities.Apps; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/AppEventDeleterTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/AppEventDeleterTests.cs index a4570ef1f..b7fab9093 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/AppEventDeleterTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/AppEventDeleterTests.cs @@ -5,11 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.EventSourcing; -using Xunit; namespace Squidex.Domain.Apps.Entities.Apps; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/AppPermanentDeleterTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/AppPermanentDeleterTests.cs index 3b769f1c5..52b0efbb3 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/AppPermanentDeleterTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/AppPermanentDeleterTests.cs @@ -5,15 +5,13 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; +using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Entities.Apps.DomainObject; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Domain.Apps.Events.Apps; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.EventSourcing; -using Squidex.Infrastructure.Reflection; -using Xunit; namespace Squidex.Domain.Apps.Entities.Apps; @@ -22,18 +20,11 @@ public class AppPermanentDeleterTests private readonly IDomainObjectFactory domainObjectFactory = A.Fake(); private readonly IDeleter deleter1 = A.Fake(); private readonly IDeleter deleter2 = A.Fake(); - private readonly TypeNameRegistry typeNameRegistry; private readonly AppPermanentDeleter sut; public AppPermanentDeleterTests() { - typeNameRegistry = - new TypeNameRegistry() - .Map(typeof(AppCreated)) - .Map(typeof(AppContributorRemoved)) - .Map(typeof(AppDeleted)); - - sut = new AppPermanentDeleter(new[] { deleter1, deleter2 }, domainObjectFactory, typeNameRegistry); + sut = new AppPermanentDeleter(new[] { deleter1, deleter2 }, domainObjectFactory, TestUtils.TypeRegistry); } [Fact] @@ -63,9 +54,11 @@ public class AppPermanentDeleterTests [Fact] public void Should_handle_delete_event() { + var eventType = TestUtils.TypeRegistry.GetName(); + var storedEvent = new StoredEvent("stream", "1", 1, - new EventData(typeNameRegistry.GetName(), new EnvelopeHeaders(), "payload")); + new EventData(eventType, new EnvelopeHeaders(), "payload")); Assert.True(sut.Handles(storedEvent)); } @@ -73,9 +66,11 @@ public class AppPermanentDeleterTests [Fact] public void Should_handle_contributor_event() { + var eventType = TestUtils.TypeRegistry.GetName(); + var storedEvent = new StoredEvent("stream", "1", 1, - new EventData(typeNameRegistry.GetName(), new EnvelopeHeaders(), "payload")); + new EventData(eventType, new EnvelopeHeaders(), "payload")); Assert.True(sut.Handles(storedEvent)); } @@ -83,9 +78,11 @@ public class AppPermanentDeleterTests [Fact] public void Should_not_handle_creation_event() { + var eventType = TestUtils.TypeRegistry.GetName(); + var storedEvent = new StoredEvent("stream", "1", 1, - new EventData(typeNameRegistry.GetName(), new EnvelopeHeaders(), "payload")); + new EventData(eventType, new EnvelopeHeaders(), "payload")); Assert.False(sut.Handles(storedEvent)); } @@ -97,8 +94,7 @@ public class AppPermanentDeleterTests await sut.On(Envelope.Create(new AppContributorRemoved { - AppId = app.NamedId(), - ContributorId = "user1" + AppId = app.NamedId(), ContributorId = "user1" })); A.CallTo(() => deleter1.DeleteContributorAsync(app.Id, "user1", default)) diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/AppSettingsSearchSourceTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/AppSettingsSearchSourceTests.cs index 1c1af8fcf..c81ef1fbd 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/AppSettingsSearchSourceTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/AppSettingsSearchSourceTests.cs @@ -6,15 +6,12 @@ // ========================================================================== using System.Security.Claims; -using FakeItEasy; -using FluentAssertions; using Squidex.Domain.Apps.Core; using Squidex.Domain.Apps.Entities.Search; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Shared; using Squidex.Shared.Identity; -using Xunit; namespace Squidex.Domain.Apps.Entities.Apps; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/AppUISettingsTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/AppUISettingsTests.cs index 5000bcf40..9ae53dd19 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/AppUISettingsTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/AppUISettingsTests.cs @@ -5,14 +5,12 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core; using Squidex.Domain.Apps.Core.Apps; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Json.Objects; using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Domain.Apps.Entities.Apps; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/AppUsageDeleterTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/AppUsageDeleterTests.cs index ba0f2fe3d..be0d08f98 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/AppUsageDeleterTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/AppUsageDeleterTests.cs @@ -5,11 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.UsageTracking; -using Xunit; namespace Squidex.Domain.Apps.Entities.Apps; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/BackupAppsTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/BackupAppsTests.cs index aa1bc1e67..dc6e99f67 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/BackupAppsTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/BackupAppsTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Assets; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Entities.Apps.DomainObject; @@ -16,7 +15,6 @@ using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.EventSourcing; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Entities.Apps; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DefaultAppImageStoreTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DefaultAppImageStoreTests.cs index ebfa99ef6..62caa82e8 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DefaultAppImageStoreTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DefaultAppImageStoreTests.cs @@ -5,12 +5,10 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.Options; using Squidex.Assets; using Squidex.Domain.Apps.Entities.Assets; using Squidex.Infrastructure; -using Xunit; namespace Squidex.Domain.Apps.Entities.Apps; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DefaultAppLogStoreTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DefaultAppLogStoreTests.cs index bd8476c60..0227e97ce 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DefaultAppLogStoreTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DefaultAppLogStoreTests.cs @@ -6,11 +6,9 @@ // ========================================================================== using System.Globalization; -using FakeItEasy; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Log; -using Xunit; namespace Squidex.Domain.Apps.Entities.Apps; @@ -130,7 +128,7 @@ public class DefaultAppLogStoreTests using (var reader = new StreamReader(stream)) { - while (await reader.ReadLineAsync() != null) + while (await reader.ReadLineAsync(default) != null) { lines++; } diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/AppCommandMiddlewareTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/AppCommandMiddlewareTests.cs index 1cc10c240..28db0259f 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/AppCommandMiddlewareTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/AppCommandMiddlewareTests.cs @@ -5,14 +5,12 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Assets; using Squidex.Domain.Apps.Entities.Apps.Commands; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.Validation; -using Xunit; namespace Squidex.Domain.Apps.Entities.Apps.DomainObject; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/AppDomainObjectTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/AppDomainObjectTests.cs index da9f1325b..a186141cc 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/AppDomainObjectTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/AppDomainObjectTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Squidex.Domain.Apps.Core.Apps; @@ -19,7 +18,6 @@ using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.Json.Objects; using Squidex.Shared.Users; -using Xunit; namespace Squidex.Domain.Apps.Entities.Apps.DomainObject; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/AppStateTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/AppStateTests.cs index 827dda896..88c058b6b 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/AppStateTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/AppStateTests.cs @@ -8,7 +8,6 @@ using System.Text.Json.Serialization; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure.Json; -using Xunit; namespace Squidex.Domain.Apps.Entities.Apps.DomainObject; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppClientsTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppClientsTests.cs index e75e8508f..c2a0914fb 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppClientsTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppClientsTests.cs @@ -5,14 +5,12 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core.Apps; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Entities.Apps.Commands; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Validation; -using Xunit; #pragma warning disable SA1310 // Field names must not contain underscore diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppContributorsTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppContributorsTests.cs index 019a7a230..75168e0bf 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppContributorsTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppContributorsTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core; using Squidex.Domain.Apps.Core.Apps; using Squidex.Domain.Apps.Core.TestHelpers; @@ -15,7 +14,6 @@ using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Validation; using Squidex.Shared.Users; -using Xunit; #pragma warning disable SA1310 // Field names must not contain underscore diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppLanguagesTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppLanguagesTests.cs index 618340d02..108ff6193 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppLanguagesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppLanguagesTests.cs @@ -5,14 +5,12 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core.Apps; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Entities.Apps.Commands; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Validation; -using Xunit; namespace Squidex.Domain.Apps.Entities.Apps.DomainObject.Guards; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppRolesTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppRolesTests.cs index 84e6bfcb0..230a6055f 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppRolesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppRolesTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core; using Squidex.Domain.Apps.Core.Apps; using Squidex.Domain.Apps.Core.TestHelpers; @@ -13,7 +12,6 @@ using Squidex.Domain.Apps.Entities.Apps.Commands; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Validation; -using Xunit; #pragma warning disable SA1310 // Field names must not contain underscore diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppTests.cs index e04a31243..1aba4a3f5 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core; using Squidex.Domain.Apps.Core.Apps; using Squidex.Domain.Apps.Core.TestHelpers; @@ -17,7 +16,6 @@ using Squidex.Infrastructure; using Squidex.Infrastructure.Collections; using Squidex.Infrastructure.Validation; using Squidex.Shared.Users; -using Xunit; namespace Squidex.Domain.Apps.Entities.Apps.DomainObject.Guards; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppWorkflowTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppWorkflowTests.cs index b4cbd822d..44c65aee6 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppWorkflowTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/DomainObject/Guards/GuardAppWorkflowTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Entities.Apps.Commands; @@ -13,7 +12,6 @@ using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Collections; using Squidex.Infrastructure.Validation; -using Xunit; namespace Squidex.Domain.Apps.Entities.Apps.DomainObject.Guards; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Indexes/AppsIndexTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Indexes/AppsIndexTests.cs index 7be353b42..342612583 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Indexes/AppsIndexTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Indexes/AppsIndexTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Options; using Squidex.Caching; @@ -19,7 +18,6 @@ using Squidex.Infrastructure.States; using Squidex.Infrastructure.TestHelpers; using Squidex.Infrastructure.Validation; using Squidex.Messaging; -using Xunit; namespace Squidex.Domain.Apps.Entities.Apps.Indexes; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Plans/RestrictAppsCommandMiddlewareTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Plans/RestrictAppsCommandMiddlewareTests.cs index 0935e78b9..cb4404edd 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Plans/RestrictAppsCommandMiddlewareTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Plans/RestrictAppsCommandMiddlewareTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using System.Security.Claims; -using FakeItEasy; using Microsoft.Extensions.Options; using Squidex.Domain.Apps.Entities.Apps.Commands; using Squidex.Infrastructure; @@ -14,7 +13,6 @@ using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.Validation; using Squidex.Shared.Identity; using Squidex.Shared.Users; -using Xunit; namespace Squidex.Domain.Apps.Entities.Apps.Plans; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/RolePermissionsProviderTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/RolePermissionsProviderTests.cs index 728d562e7..46e28f2a9 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/RolePermissionsProviderTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/RolePermissionsProviderTests.cs @@ -5,11 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Entities.Schemas; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; -using Xunit; #pragma warning disable xUnit2017 // Do not use Contains() to check if a value exists in a collection diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Templates/TemplatesClientTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Templates/TemplatesClientTests.cs index b18f93ca6..a9ae2b1ce 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Templates/TemplatesClientTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Templates/TemplatesClientTests.cs @@ -5,9 +5,7 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.Options; -using Xunit; namespace Squidex.Domain.Apps.Entities.Apps.Templates; @@ -15,12 +13,19 @@ public class TemplatesClientTests { private readonly TemplatesClient sut; + private sealed class CustomHttpClient : HttpClient + { + protected override void Dispose(bool disposing) + { + } + } + public TemplatesClientTests() { var httpClientFactory = A.Fake(); - A.CallTo(() => httpClientFactory.CreateClient(null)) - .Returns(new HttpClient()); + A.CallTo(() => httpClientFactory.CreateClient(A._)) + .Returns(new CustomHttpClient()); sut = new TemplatesClient(httpClientFactory, Options.Create(new TemplatesOptions { diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetChangedTriggerHandlerTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetChangedTriggerHandlerTests.cs index 973297b13..16504b2d4 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetChangedTriggerHandlerTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetChangedTriggerHandlerTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core.HandleRules; using Squidex.Domain.Apps.Core.Rules; using Squidex.Domain.Apps.Core.Rules.EnrichedEvents; @@ -18,7 +17,6 @@ using Squidex.Domain.Apps.Events.Assets; using Squidex.Domain.Apps.Events.Contents; using Squidex.Infrastructure; using Squidex.Infrastructure.EventSourcing; -using Xunit; namespace Squidex.Domain.Apps.Entities.Assets; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetCleanupProcessTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetCleanupProcessTests.cs index 8d7c70d4f..777f8fd31 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetCleanupProcessTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetCleanupProcessTests.cs @@ -5,9 +5,7 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using tusdotnet.Interfaces; -using Xunit; namespace Squidex.Domain.Apps.Entities.Assets; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetPermanentDeleterTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetPermanentDeleterTests.cs index 1550012c5..abc3bada8 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetPermanentDeleterTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetPermanentDeleterTests.cs @@ -5,13 +5,11 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Assets; +using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Events.Assets; using Squidex.Infrastructure; using Squidex.Infrastructure.EventSourcing; -using Squidex.Infrastructure.Reflection; -using Xunit; namespace Squidex.Domain.Apps.Entities.Assets; @@ -19,17 +17,11 @@ public class AssetPermanentDeleterTests { private readonly IAssetFileStore assetFiletore = A.Fake(); private readonly NamedId appId = NamedId.Of(DomainId.NewGuid(), "my-app"); - private readonly TypeNameRegistry typeNameRegistry; private readonly AssetPermanentDeleter sut; public AssetPermanentDeleterTests() { - typeNameRegistry = - new TypeNameRegistry() - .Map(typeof(AssetCreated)) - .Map(typeof(AssetDeleted)); - - sut = new AssetPermanentDeleter(assetFiletore, typeNameRegistry); + sut = new AssetPermanentDeleter(assetFiletore, TestUtils.TypeRegistry); } [Fact] @@ -59,9 +51,11 @@ public class AssetPermanentDeleterTests [Fact] public void Should_handle_deletion_event() { + var eventType = TestUtils.TypeRegistry.GetName(); + var storedEvent = new StoredEvent("stream", "1", 1, - new EventData(typeNameRegistry.GetName(), new EnvelopeHeaders(), "payload")); + new EventData(eventType, new EnvelopeHeaders(), "payload")); Assert.True(sut.Handles(storedEvent)); } @@ -69,9 +63,11 @@ public class AssetPermanentDeleterTests [Fact] public void Should_not_handle_creation_event() { + var eventType = TestUtils.TypeRegistry.GetName(); + var storedEvent = new StoredEvent("stream", "1", 1, - new EventData(typeNameRegistry.GetName(), new EnvelopeHeaders(), "payload")); + new EventData(eventType, new EnvelopeHeaders(), "payload")); Assert.False(sut.Handles(storedEvent)); } diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetTagsDeleterTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetTagsDeleterTests.cs index f84bf2a91..8ec199b0e 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetTagsDeleterTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetTagsDeleterTests.cs @@ -5,11 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core.Tags; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; -using Xunit; namespace Squidex.Domain.Apps.Entities.Assets; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetUsageTrackerTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetUsageTrackerTests.cs index 40adc90f5..f0c6bc312 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetUsageTrackerTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetUsageTrackerTests.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; -using FluentAssertions; using NodaTime; using Squidex.Domain.Apps.Core.Tags; using Squidex.Domain.Apps.Entities.Billing; @@ -14,7 +12,6 @@ using Squidex.Domain.Apps.Events.Assets; using Squidex.Infrastructure; using Squidex.Infrastructure.EventSourcing; using Squidex.Infrastructure.States; -using Xunit; namespace Squidex.Domain.Apps.Entities.Assets; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetsFluidExtensionTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetsFluidExtensionTests.cs index f50f5233e..e902793b6 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetsFluidExtensionTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetsFluidExtensionTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using System.Text; -using FakeItEasy; using Microsoft.Extensions.DependencyInjection; using Squidex.Assets; using Squidex.Domain.Apps.Core.Assets; @@ -17,7 +16,6 @@ using Squidex.Domain.Apps.Core.Templates.Extensions; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Entities.Assets; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetsJintExtensionTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetsJintExtensionTests.cs index ff810a416..b5c26edfc 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetsJintExtensionTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetsJintExtensionTests.cs @@ -7,7 +7,6 @@ using System.Security.Claims; using System.Text; -using FakeItEasy; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; @@ -20,7 +19,6 @@ using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Entities.Assets; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetsSearchSourceTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetsSearchSourceTests.cs index f6e71b5d3..d9b926e7f 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetsSearchSourceTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/AssetsSearchSourceTests.cs @@ -6,15 +6,12 @@ // ========================================================================== using System.Security.Claims; -using FakeItEasy; -using FluentAssertions; using Squidex.Domain.Apps.Core; using Squidex.Domain.Apps.Entities.Search; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Shared; using Squidex.Shared.Identity; -using Xunit; namespace Squidex.Domain.Apps.Entities.Assets; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/BackupAssetsTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/BackupAssetsTests.cs index 51df6f8cb..61959e3b5 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/BackupAssetsTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/BackupAssetsTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Assets; using Squidex.Domain.Apps.Core.Tags; using Squidex.Domain.Apps.Entities.Assets.DomainObject; @@ -15,7 +14,6 @@ using Squidex.Domain.Apps.Events.Assets; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.EventSourcing; -using Xunit; namespace Squidex.Domain.Apps.Entities.Assets; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DefaultAssetFileStoreTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DefaultAssetFileStoreTests.cs index bdc100bff..cd41a7bdf 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DefaultAssetFileStoreTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DefaultAssetFileStoreTests.cs @@ -6,13 +6,11 @@ // ========================================================================== using System.Globalization; -using FakeItEasy; using Microsoft.Extensions.Options; using Squidex.Assets; using Squidex.Domain.Apps.Entities.Assets.Repositories; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; -using Xunit; namespace Squidex.Domain.Apps.Entities.Assets; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/AssetCommandMiddlewareTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/AssetCommandMiddlewareTests.cs index 16b64d8b7..7506a008b 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/AssetCommandMiddlewareTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/AssetCommandMiddlewareTests.cs @@ -5,13 +5,11 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Assets; using Squidex.Domain.Apps.Entities.Assets.Commands; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; -using Xunit; namespace Squidex.Domain.Apps.Entities.Assets.DomainObject; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/AssetDomainObjectTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/AssetDomainObjectTests.cs index 0aa952223..b40f640e3 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/AssetDomainObjectTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/AssetDomainObjectTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Squidex.Assets; @@ -19,7 +18,6 @@ using Squidex.Domain.Apps.Entities.Contents.Repositories; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Domain.Apps.Events.Assets; using Squidex.Infrastructure; -using Xunit; namespace Squidex.Domain.Apps.Entities.Assets.DomainObject; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/AssetFolderDomainObjectTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/AssetFolderDomainObjectTests.cs index d87a02d2f..2f104431f 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/AssetFolderDomainObjectTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/AssetFolderDomainObjectTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Squidex.Domain.Apps.Entities.Apps; @@ -14,7 +13,6 @@ using Squidex.Domain.Apps.Entities.Contents.Repositories; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Domain.Apps.Events.Assets; using Squidex.Infrastructure; -using Xunit; namespace Squidex.Domain.Apps.Entities.Assets.DomainObject; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/AssetsBulkUpdateCommandMiddlewareTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/AssetsBulkUpdateCommandMiddlewareTests.cs index 6fbfe6f81..320ee6192 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/AssetsBulkUpdateCommandMiddlewareTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/AssetsBulkUpdateCommandMiddlewareTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using System.Security.Claims; -using FakeItEasy; using Microsoft.Extensions.Logging; using Squidex.Domain.Apps.Entities.Assets.Commands; using Squidex.Domain.Apps.Entities.TestHelpers; @@ -14,7 +13,6 @@ using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; using Squidex.Shared; using Squidex.Shared.Identity; -using Xunit; namespace Squidex.Domain.Apps.Entities.Assets.DomainObject; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/Guards/GuardAssetFolderTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/Guards/GuardAssetFolderTests.cs index 3e41ebdf9..71de1dbb4 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/Guards/GuardAssetFolderTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/Guards/GuardAssetFolderTests.cs @@ -6,14 +6,12 @@ // ========================================================================== using System.Security.Claims; -using FakeItEasy; using Microsoft.Extensions.DependencyInjection; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Entities.Assets.Commands; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Validation; -using Xunit; namespace Squidex.Domain.Apps.Entities.Assets.DomainObject.Guards; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/Guards/GuardAssetTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/Guards/GuardAssetTests.cs index 53e36d22f..47635bd8c 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/Guards/GuardAssetTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/Guards/GuardAssetTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using System.Security.Claims; -using FakeItEasy; using Microsoft.Extensions.DependencyInjection; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Entities.Assets.Commands; @@ -15,7 +14,6 @@ using Squidex.Domain.Apps.Entities.Contents.Repositories; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Validation; -using Xunit; namespace Squidex.Domain.Apps.Entities.Assets.DomainObject.Guards; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/Guards/ScriptMetadataWrapperTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/Guards/ScriptMetadataWrapperTests.cs index f6d31e3f4..cdb7d70e7 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/Guards/ScriptMetadataWrapperTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/Guards/ScriptMetadataWrapperTests.cs @@ -7,7 +7,6 @@ using Squidex.Domain.Apps.Core.Assets; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Entities.Assets.DomainObject.Guards; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/Guards/ScriptingExtensionsTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/Guards/ScriptingExtensionsTests.cs index 49ee73329..244519950 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/Guards/ScriptingExtensionsTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/DomainObject/Guards/ScriptingExtensionsTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.DependencyInjection; using Squidex.Domain.Apps.Core.Assets; @@ -15,7 +14,6 @@ using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Json.Objects; using Squidex.Infrastructure.Validation; -using Xunit; namespace Squidex.Domain.Apps.Entities.Assets.DomainObject.Guards; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/FileTagAssetMetadataSourceTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/FileTagAssetMetadataSourceTests.cs index a6f4162c5..acdc849a8 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/FileTagAssetMetadataSourceTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/FileTagAssetMetadataSourceTests.cs @@ -9,7 +9,6 @@ using Squidex.Assets; using Squidex.Domain.Apps.Core.Assets; using Squidex.Domain.Apps.Entities.Assets.Commands; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Entities.Assets; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/FileTypeAssetMetadataSourceTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/FileTypeAssetMetadataSourceTests.cs index 55171c2ee..ed379a34b 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/FileTypeAssetMetadataSourceTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/FileTypeAssetMetadataSourceTests.cs @@ -7,7 +7,6 @@ using Squidex.Domain.Apps.Entities.Assets.Commands; using Squidex.Domain.Apps.Entities.TestHelpers; -using Xunit; namespace Squidex.Domain.Apps.Entities.Assets; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/ImageAssetMetadataSourceTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/ImageAssetMetadataSourceTests.cs index 33a94eb2d..3f2f93825 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/ImageAssetMetadataSourceTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/ImageAssetMetadataSourceTests.cs @@ -5,12 +5,10 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Assets; using Squidex.Domain.Apps.Core.Assets; using Squidex.Domain.Apps.Entities.Assets.Commands; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Entities.Assets; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/MongoDb/AssetMappingTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/MongoDb/AssetMappingTests.cs index 85f1d267f..1bee0ba32 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/MongoDb/AssetMappingTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/MongoDb/AssetMappingTests.cs @@ -5,14 +5,12 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using NodaTime; using Squidex.Domain.Apps.Core.Assets; using Squidex.Domain.Apps.Entities.Assets.DomainObject; using Squidex.Domain.Apps.Entities.MongoDb.Assets; using Squidex.Infrastructure; using Squidex.Infrastructure.States; -using Xunit; namespace Squidex.Domain.Apps.Entities.Assets.MongoDb; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/MongoDb/AssetQueryTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/MongoDb/AssetQueryTests.cs index 467795fce..99174411b 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/MongoDb/AssetQueryTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/MongoDb/AssetQueryTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using MongoDB.Bson.Serialization; using MongoDB.Driver; using NodaTime.Text; @@ -16,7 +15,6 @@ using Squidex.Infrastructure; using Squidex.Infrastructure.MongoDb.Queries; using Squidex.Infrastructure.Queries; using Squidex.Infrastructure.Validation; -using Xunit; using ClrFilter = Squidex.Infrastructure.Queries.ClrFilter; using SortBuilder = Squidex.Infrastructure.Queries.SortBuilder; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/MongoDb/AssetsQueryFixture.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/MongoDb/AssetsQueryFixture.cs index 1b40bafd7..73ed4e17c 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/MongoDb/AssetsQueryFixture.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/MongoDb/AssetsQueryFixture.cs @@ -18,7 +18,6 @@ using Squidex.Infrastructure; using Squidex.Infrastructure.Json.Objects; using Squidex.Infrastructure.MongoDb; using Squidex.Infrastructure.States; -using Xunit; namespace Squidex.Domain.Apps.Entities.Assets.MongoDb; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/MongoDb/AssetsQueryIntegrationTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/MongoDb/AssetsQueryIntegrationTests.cs index 88a884b43..d9029baa4 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/MongoDb/AssetsQueryIntegrationTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/MongoDb/AssetsQueryIntegrationTests.cs @@ -7,7 +7,6 @@ using Squidex.Infrastructure; using Squidex.Infrastructure.Queries; -using Xunit; using F = Squidex.Infrastructure.Queries.ClrFilter; #pragma warning disable SA1300 // Element should begin with upper-case letter diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/Queries/AssetEnricherTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/Queries/AssetEnricherTests.cs index 4bcb123da..e0ae346d1 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/Queries/AssetEnricherTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/Queries/AssetEnricherTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core; using Squidex.Domain.Apps.Core.Tags; using Squidex.Domain.Apps.Core.TestHelpers; @@ -13,7 +12,6 @@ using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Caching; using Squidex.Infrastructure.Json; -using Xunit; namespace Squidex.Domain.Apps.Entities.Assets.Queries; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/Queries/AssetLoaderTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/Queries/AssetLoaderTests.cs index 5e06ff46e..690673a29 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/Queries/AssetLoaderTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/Queries/AssetLoaderTests.cs @@ -5,11 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Entities.Assets.DomainObject; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; -using Xunit; namespace Squidex.Domain.Apps.Entities.Assets.Queries; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/Queries/AssetQueryParserTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/Queries/AssetQueryParserTests.cs index 6840d18d1..27fdc4dba 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/Queries/AssetQueryParserTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/Queries/AssetQueryParserTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.Options; using Squidex.Domain.Apps.Core.Tags; using Squidex.Domain.Apps.Core.TestHelpers; @@ -13,7 +12,6 @@ using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Queries; using Squidex.Infrastructure.Validation; -using Xunit; namespace Squidex.Domain.Apps.Entities.Assets.Queries; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/Queries/AssetQueryServiceTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/Queries/AssetQueryServiceTests.cs index 15e7f9cc4..347eb5745 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/Queries/AssetQueryServiceTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/Queries/AssetQueryServiceTests.cs @@ -5,13 +5,11 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.Options; using Squidex.Domain.Apps.Entities.Assets.Repositories; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Reflection; -using Xunit; namespace Squidex.Domain.Apps.Entities.Assets.Queries; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/RecursiveDeleterTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/RecursiveDeleterTests.cs index 3c144720f..0aa3a90b2 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/RecursiveDeleterTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/RecursiveDeleterTests.cs @@ -5,16 +5,14 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.Logging; +using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Entities.Assets.Commands; using Squidex.Domain.Apps.Entities.Assets.Repositories; using Squidex.Domain.Apps.Events.Assets; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.EventSourcing; -using Squidex.Infrastructure.Reflection; -using Xunit; namespace Squidex.Domain.Apps.Entities.Assets; @@ -29,9 +27,7 @@ public class RecursiveDeleterTests public RecursiveDeleterTests() { - var typeNameRegistry = new TypeNameRegistry().Map(typeof(AssetFolderDeleted)); - - sut = new RecursiveDeleter(commandBus, assetRepository, assetFolderRepository, typeNameRegistry, log); + sut = new RecursiveDeleter(commandBus, assetRepository, assetFolderRepository, TestUtils.TypeRegistry, log); } [Fact] diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/RepairFilesTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/RepairFilesTests.cs index 9bb5d5774..150898b0b 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/RepairFilesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/RepairFilesTests.cs @@ -5,12 +5,10 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Assets; using Squidex.Domain.Apps.Events.Assets; using Squidex.Infrastructure; using Squidex.Infrastructure.EventSourcing; -using Xunit; namespace Squidex.Domain.Apps.Entities.Assets; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/SvgAssetMetadataSourceTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/SvgAssetMetadataSourceTests.cs index f231b68b2..3e333f286 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/SvgAssetMetadataSourceTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/SvgAssetMetadataSourceTests.cs @@ -10,7 +10,6 @@ using Squidex.Assets; using Squidex.Domain.Apps.Entities.Assets.Commands; using Squidex.Domain.Apps.Entities.Properties; using Squidex.Infrastructure.Validation; -using Xunit; namespace Squidex.Domain.Apps.Entities.Assets; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Backup/BackupCompatibilityTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Backup/BackupCompatibilityTests.cs index c25555d9d..e6590dcd3 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Backup/BackupCompatibilityTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Backup/BackupCompatibilityTests.cs @@ -5,9 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; -using Xunit; - namespace Squidex.Domain.Apps.Entities.Backup; public class BackupCompatibilityTests diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Backup/BackupReaderWriterTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Backup/BackupReaderWriterTests.cs index f2b0590db..85f8500ee 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Backup/BackupReaderWriterTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Backup/BackupReaderWriterTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using System.Globalization; -using FakeItEasy; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.EventSourcing; @@ -14,7 +13,6 @@ using Squidex.Infrastructure.Json; using Squidex.Infrastructure.Json.Objects; using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.States; -using Xunit; namespace Squidex.Domain.Apps.Entities.Backup; @@ -23,7 +21,7 @@ public class BackupReaderWriterTests private readonly IEventFormatter eventFormatter; private readonly IEventStreamNames eventStreamNames = A.Fake(); private readonly IJsonSerializer serializer = TestUtils.DefaultSerializer; - private readonly TypeNameRegistry typeNameRegistry = new TypeNameRegistry(); + private readonly TypeRegistry typeRegistry = new TypeRegistry(); [TypeName(nameof(MyEvent))] public sealed class MyEvent : IEvent @@ -33,9 +31,9 @@ public class BackupReaderWriterTests public BackupReaderWriterTests() { - typeNameRegistry.Map(typeof(MyEvent)); + typeRegistry.Add("MyEvent"); - eventFormatter = new DefaultEventFormatter(typeNameRegistry, serializer); + eventFormatter = new DefaultEventFormatter(typeRegistry, serializer); } [Fact] diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Backup/BackupServiceTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Backup/BackupServiceTests.cs index 3d0fed6b8..8090a6ac5 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Backup/BackupServiceTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Backup/BackupServiceTests.cs @@ -5,15 +5,12 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; -using FluentAssertions; using NodaTime; using Squidex.Domain.Apps.Entities.Backup.State; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.TestHelpers; using Squidex.Messaging; -using Xunit; namespace Squidex.Domain.Apps.Entities.Backup; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Backup/DefaultBackupArchiveStoreTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Backup/DefaultBackupArchiveStoreTests.cs index 06474edad..819ac7ba9 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Backup/DefaultBackupArchiveStoreTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Backup/DefaultBackupArchiveStoreTests.cs @@ -5,10 +5,8 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Assets; using Squidex.Infrastructure; -using Xunit; namespace Squidex.Domain.Apps.Entities.Backup; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Backup/StreamMapperTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Backup/StreamMapperTests.cs index 0b289dae3..5d5cf61c3 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Backup/StreamMapperTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Backup/StreamMapperTests.cs @@ -5,9 +5,7 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Infrastructure; -using Xunit; namespace Squidex.Domain.Apps.Entities.Backup; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Backup/UserMappingTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Backup/UserMappingTests.cs index 96dd23e7e..ba670b44c 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Backup/UserMappingTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Backup/UserMappingTests.cs @@ -5,11 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure; using Squidex.Shared.Users; -using Xunit; namespace Squidex.Domain.Apps.Entities.Backup; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Billing/ConfigPlansProviderTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Billing/ConfigPlansProviderTests.cs index eb5a8e05b..ab9d55081 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Billing/ConfigPlansProviderTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Billing/ConfigPlansProviderTests.cs @@ -5,9 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; -using Xunit; - namespace Squidex.Domain.Apps.Entities.Billing; public class ConfigPlansProviderTests diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Billing/NoopBillingManagerTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Billing/NoopBillingManagerTests.cs index 0176a5d72..d01aa6dfc 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Billing/NoopBillingManagerTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Billing/NoopBillingManagerTests.cs @@ -7,7 +7,6 @@ using Squidex.Domain.Apps.Entities.Apps; using Squidex.Domain.Apps.Entities.Teams; -using Xunit; namespace Squidex.Domain.Apps.Entities.Billing; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Billing/UsageGateTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Billing/UsageGateTests.cs index 27ec8683a..1c44f7796 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Billing/UsageGateTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Billing/UsageGateTests.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; -using FluentAssertions; using Squidex.Domain.Apps.Core; using Squidex.Domain.Apps.Core.Apps; using Squidex.Domain.Apps.Entities.Apps; @@ -16,7 +14,6 @@ using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.UsageTracking; using Squidex.Messaging; -using Xunit; namespace Squidex.Domain.Apps.Entities.Billing; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Billing/UsageNotifierWorkerTest.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Billing/UsageNotifierWorkerTest.cs index 58c5923e0..e1d2c8ddc 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Billing/UsageNotifierWorkerTest.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Billing/UsageNotifierWorkerTest.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using NodaTime; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Entities.Apps; @@ -14,7 +13,6 @@ using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.TestHelpers; using Squidex.Shared.Users; -using Xunit; namespace Squidex.Domain.Apps.Entities.Billing; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/CommentTriggerHandlerTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/CommentTriggerHandlerTests.cs index 181118872..389912a70 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/CommentTriggerHandlerTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/CommentTriggerHandlerTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Options; using Squidex.Domain.Apps.Core.HandleRules; @@ -20,7 +19,6 @@ using Squidex.Domain.Apps.Events.Contents; using Squidex.Infrastructure; using Squidex.Infrastructure.EventSourcing; using Squidex.Shared.Users; -using Xunit; namespace Squidex.Domain.Apps.Entities.Comments; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/CommentsLoaderTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/CommentsLoaderTests.cs index 3fd97edef..fda228dfb 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/CommentsLoaderTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/CommentsLoaderTests.cs @@ -5,11 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Entities.Comments.DomainObject; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; -using Xunit; namespace Squidex.Domain.Apps.Entities.Comments; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/DomainObject/CommentsCommandMiddlewareTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/DomainObject/CommentsCommandMiddlewareTests.cs index 9741db952..cea8a034a 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/DomainObject/CommentsCommandMiddlewareTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/DomainObject/CommentsCommandMiddlewareTests.cs @@ -5,13 +5,11 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Entities.Comments.Commands; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; using Squidex.Shared.Users; -using Xunit; namespace Squidex.Domain.Apps.Entities.Comments.DomainObject; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/DomainObject/CommentsStreamTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/DomainObject/CommentsStreamTests.cs index 2c51c02f2..a4d622c3d 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/DomainObject/CommentsStreamTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/DomainObject/CommentsStreamTests.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; -using FluentAssertions; using NodaTime; using Squidex.Domain.Apps.Core.Comments; using Squidex.Domain.Apps.Entities.Comments.Commands; @@ -15,7 +13,6 @@ using Squidex.Domain.Apps.Events.Comments; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.EventSourcing; -using Xunit; namespace Squidex.Domain.Apps.Entities.Comments.DomainObject; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/DomainObject/Guards/GuardCommentsTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/DomainObject/Guards/GuardCommentsTests.cs index 318ea0865..134071626 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/DomainObject/Guards/GuardCommentsTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/DomainObject/Guards/GuardCommentsTests.cs @@ -12,7 +12,6 @@ using Squidex.Domain.Apps.Events.Comments; using Squidex.Infrastructure; using Squidex.Infrastructure.EventSourcing; using Squidex.Infrastructure.Validation; -using Xunit; namespace Squidex.Domain.Apps.Entities.Comments.DomainObject.Guards; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/WatchingServiceTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/WatchingServiceTests.cs index ce562d055..cfced1d49 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/WatchingServiceTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Comments/WatchingServiceTests.cs @@ -5,11 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using NodaTime; using Squidex.Infrastructure; using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Domain.Apps.Entities.Comments; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/BackupContentsTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/BackupContentsTests.cs index b861f391a..453f13eed 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/BackupContentsTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/BackupContentsTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core; using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Entities.Backup; @@ -17,7 +16,6 @@ using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.EventSourcing; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ContentChangedTriggerHandlerTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ContentChangedTriggerHandlerTests.cs index c71ff8b17..f72321d7d 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ContentChangedTriggerHandlerTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ContentChangedTriggerHandlerTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Core.HandleRules; using Squidex.Domain.Apps.Core.Rules; @@ -21,7 +20,6 @@ using Squidex.Infrastructure; using Squidex.Infrastructure.Collections; using Squidex.Infrastructure.EventSourcing; using Squidex.Infrastructure.Reflection; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ContentSchedulerProcessTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ContentSchedulerProcessTests.cs index 99d7bb54a..b802740eb 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ContentSchedulerProcessTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ContentSchedulerProcessTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.Logging; using NodaTime; using Squidex.Domain.Apps.Core.Contents; @@ -13,7 +12,6 @@ using Squidex.Domain.Apps.Entities.Contents.Commands; using Squidex.Domain.Apps.Entities.Contents.Repositories; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ContentsSearchSourceTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ContentsSearchSourceTests.cs index 776e768a3..dd5a4653a 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ContentsSearchSourceTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ContentsSearchSourceTests.cs @@ -6,8 +6,6 @@ // ========================================================================== using System.Security.Claims; -using FakeItEasy; -using FluentAssertions; using Squidex.Domain.Apps.Core; using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Core.Schemas; @@ -18,7 +16,6 @@ using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Shared; using Squidex.Shared.Identity; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Counter/CounterJintExtensionTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Counter/CounterJintExtensionTests.cs index 0c87b14d5..c04506a5e 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Counter/CounterJintExtensionTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Counter/CounterJintExtensionTests.cs @@ -5,12 +5,10 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Options; using Squidex.Domain.Apps.Core.Scripting; using Squidex.Infrastructure; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents.Counter; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Counter/CounterServiceTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Counter/CounterServiceTests.cs index d3fdcda92..d375caa0f 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Counter/CounterServiceTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Counter/CounterServiceTests.cs @@ -5,11 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents.Counter; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DefaultContentWorkflowTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DefaultContentWorkflowTests.cs index 2f56a32bb..11e402258 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DefaultContentWorkflowTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DefaultContentWorkflowTests.cs @@ -5,13 +5,11 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Entities.Schemas; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DefaultWorkflowsValidatorTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DefaultWorkflowsValidatorTests.cs index 33ad68ac8..a8aecf473 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DefaultWorkflowsValidatorTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DefaultWorkflowsValidatorTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; @@ -13,7 +12,6 @@ using Squidex.Domain.Apps.Entities.Schemas; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Collections; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DomainObject/ContentCommandMiddlewareTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DomainObject/ContentCommandMiddlewareTests.cs index dad0c0921..b44fdfba6 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DomainObject/ContentCommandMiddlewareTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DomainObject/ContentCommandMiddlewareTests.cs @@ -5,13 +5,11 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Entities.Contents.Commands; using Squidex.Domain.Apps.Entities.Contents.Queries; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents.DomainObject; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DomainObject/ContentDomainObjectTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DomainObject/ContentDomainObjectTests.cs index d15f5eeb4..65311589a 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DomainObject/ContentDomainObjectTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DomainObject/ContentDomainObjectTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using NodaTime; @@ -24,7 +23,6 @@ using Squidex.Domain.Apps.Events.Contents; using Squidex.Infrastructure; using Squidex.Infrastructure.Json.Objects; using Squidex.Infrastructure.Validation; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents.DomainObject; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DomainObject/ContentsBulkUpdateCommandMiddlewareTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DomainObject/ContentsBulkUpdateCommandMiddlewareTests.cs index 4df2f8b95..8425d8647 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DomainObject/ContentsBulkUpdateCommandMiddlewareTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DomainObject/ContentsBulkUpdateCommandMiddlewareTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using System.Security.Claims; -using FakeItEasy; using Microsoft.Extensions.Logging; using NodaTime; using Squidex.Domain.Apps.Core.Contents; @@ -18,7 +17,6 @@ using Squidex.Infrastructure.Json.Objects; using Squidex.Infrastructure.Queries; using Squidex.Shared; using Squidex.Shared.Identity; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents.DomainObject; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DomainObject/Guards/GuardContentTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DomainObject/Guards/GuardContentTests.cs index 9b66240cc..bd5ef7f4e 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DomainObject/Guards/GuardContentTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DomainObject/Guards/GuardContentTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using System.Security.Claims; -using FakeItEasy; using Microsoft.Extensions.DependencyInjection; using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Core.Schemas; @@ -18,7 +17,6 @@ using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Validation; using Squidex.Shared; -using Xunit; #pragma warning disable CA2012 // Use ValueTasks correctly diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DynamicContentWorkflowTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DynamicContentWorkflowTests.cs index 68eccdae0..3df2683cd 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DynamicContentWorkflowTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DynamicContentWorkflowTests.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; -using FluentAssertions; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Options; using Squidex.Domain.Apps.Core.Contents; @@ -17,7 +15,6 @@ using Squidex.Domain.Apps.Entities.Schemas; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Collections; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/GraphQL/GraphQLIntrospectionTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/GraphQL/GraphQLIntrospectionTests.cs index 87d0a84b9..576dfcf08 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/GraphQL/GraphQLIntrospectionTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/GraphQL/GraphQLIntrospectionTests.cs @@ -12,7 +12,6 @@ using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Entities.Contents.GraphQL.Types; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; -using Xunit; using GraphQLSchema = GraphQL.Types.Schema; using Schema = Squidex.Domain.Apps.Core.Schemas.Schema; @@ -207,7 +206,7 @@ public class GraphQLIntrospectionTests : GraphQLTestBase var type = FindDataType(graphQLSchema, "MySchema"); - Assert.Contains(type?.Fields, x => x.Name == "content"); + Assert.Contains(type?.Fields!, x => x.Name == "content"); } [Fact] @@ -223,7 +222,7 @@ public class GraphQLIntrospectionTests : GraphQLTestBase var type = FindDataType(graphQLSchema, "MySchema"); - Assert.Contains(type?.Fields, x => x.Name == "gql_2Field"); + Assert.Contains(type?.Fields!, x => x.Name == "gql_2Field"); } [Fact] @@ -240,8 +239,8 @@ public class GraphQLIntrospectionTests : GraphQLTestBase var type = FindDataType(graphQLSchema, "MySchema"); - Assert.Contains(type?.Fields, x => x.Name == "myField"); - Assert.Contains(type?.Fields, x => x.Name == "myField2"); + Assert.Contains(type?.Fields!, x => x.Name == "myField"); + Assert.Contains(type?.Fields!, x => x.Name == "myField2"); } [Fact] @@ -259,7 +258,7 @@ public class GraphQLIntrospectionTests : GraphQLTestBase var type = FindDataType(graphQLSchema, "MySchema"); - Assert.DoesNotContain(type?.Fields, x => x.Name == "myComponent"); + Assert.DoesNotContain(type?.Fields!, x => x.Name == "myComponent"); } [Fact] @@ -277,7 +276,7 @@ public class GraphQLIntrospectionTests : GraphQLTestBase var type = FindDataType(graphQLSchema, "MySchema"); - Assert.DoesNotContain(type?.Fields, x => x.Name == "myComponents"); + Assert.DoesNotContain(type?.Fields!, x => x.Name == "myComponents"); } [Fact] @@ -295,7 +294,7 @@ public class GraphQLIntrospectionTests : GraphQLTestBase var type = FindDataType(graphQLSchema, "MySchema"); - Assert.DoesNotContain(type?.Fields, x => x.Name == "myReferences"); + Assert.DoesNotContain(type?.Fields!, x => x.Name == "myReferences"); } private static IObjectGraphType? FindDataType(GraphQLSchema graphQLSchema, string schema) diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/GraphQL/GraphQLMutationTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/GraphQL/GraphQLMutationTests.cs index 33afbc305..01e2226de 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/GraphQL/GraphQLMutationTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/GraphQL/GraphQLMutationTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using System.Text.Json; -using FakeItEasy; using GraphQL; using NodaTime.Text; using Squidex.Domain.Apps.Core.Contents; @@ -15,7 +14,6 @@ using Squidex.Domain.Apps.Entities.Contents.Commands; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; using Squidex.Shared; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents.GraphQL; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/GraphQL/GraphQLQueriesTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/GraphQL/GraphQLQueriesTests.cs index 905930ded..fe915b5a7 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/GraphQL/GraphQLQueriesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/GraphQL/GraphQLQueriesTests.cs @@ -5,13 +5,11 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using GraphQL; using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Entities.Assets; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents.GraphQL; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/GraphQL/GraphQLSubscriptionTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/GraphQL/GraphQLSubscriptionTests.cs index 6924eb15e..7df4208ed 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/GraphQL/GraphQLSubscriptionTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/GraphQL/GraphQLSubscriptionTests.cs @@ -6,14 +6,12 @@ // ========================================================================== using System.Reactive.Linq; -using FakeItEasy; using GraphQL; using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Core.Rules.EnrichedEvents; using Squidex.Domain.Apps.Core.Subscriptions; using Squidex.Infrastructure; using Squidex.Shared; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents.GraphQL; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/GraphQL/GraphQLTestBase.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/GraphQL/GraphQLTestBase.cs index 90ce8f1f3..3f89f07d5 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/GraphQL/GraphQLTestBase.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/GraphQL/GraphQLTestBase.cs @@ -8,7 +8,6 @@ using System.Reactive.Linq; using System.Reactive.Threading.Tasks; using System.Text.RegularExpressions; -using FakeItEasy; using GraphQL; using GraphQL.DataLoader; using GraphQL.Execution; @@ -28,7 +27,6 @@ using Squidex.Infrastructure.Tasks; using Squidex.Messaging.Subscriptions; using Squidex.Shared; using Squidex.Shared.Users; -using Xunit; #pragma warning disable SA1401 // Fields must be private diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/GraphQL/NamesTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/GraphQL/NamesTests.cs index 0cdf6ee13..c371ef942 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/GraphQL/NamesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/GraphQL/NamesTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using Squidex.Domain.Apps.Entities.Contents.GraphQL.Types; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents.GraphQL; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ContentMappingTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ContentMappingTests.cs index a5a02d0dd..0934978db 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ContentMappingTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ContentMappingTests.cs @@ -5,15 +5,12 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; -using FluentAssertions; using NodaTime; using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Entities.Contents.DomainObject; using Squidex.Domain.Apps.Entities.MongoDb.Contents; using Squidex.Infrastructure; using Squidex.Infrastructure.States; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents.MongoDb; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ContentQueryTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ContentQueryTests.cs index 47948577b..8ecb3ae2e 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ContentQueryTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ContentQueryTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using MongoDB.Bson.Serialization; using MongoDB.Driver; using NodaTime.Text; @@ -20,7 +19,6 @@ using Squidex.Domain.Apps.Entities.Schemas; using Squidex.Infrastructure; using Squidex.Infrastructure.MongoDb.Queries; using Squidex.Infrastructure.Queries; -using Xunit; using ClrFilter = Squidex.Infrastructure.Queries.ClrFilter; using SortBuilder = Squidex.Infrastructure.Queries.SortBuilder; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ContentsQueryDedicatedIntegrationTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ContentsQueryDedicatedIntegrationTests.cs index a734d1c4e..fcc2e440f 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ContentsQueryDedicatedIntegrationTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ContentsQueryDedicatedIntegrationTests.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using Xunit; - namespace Squidex.Domain.Apps.Entities.Contents.MongoDb; [Trait("Category", "Dependencies")] diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ContentsQueryFixture.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ContentsQueryFixture.cs index 71ec7bb8e..8e536f692 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ContentsQueryFixture.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ContentsQueryFixture.cs @@ -6,7 +6,6 @@ // ========================================================================== using System.Globalization; -using FakeItEasy; using LoremNET; using Microsoft.Extensions.Options; using MongoDB.Bson; @@ -25,7 +24,6 @@ using Squidex.Infrastructure; using Squidex.Infrastructure.Json.Objects; using Squidex.Infrastructure.MongoDb; using Squidex.Infrastructure.States; -using Xunit; #pragma warning disable MA0048 // File name must match type name diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ContentsQueryIntegrationTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ContentsQueryIntegrationTests.cs index 15f680a19..ed85725ab 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ContentsQueryIntegrationTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ContentsQueryIntegrationTests.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using Xunit; - namespace Squidex.Domain.Apps.Entities.Contents.MongoDb; [Trait("Category", "Dependencies")] diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ContentsQueryTestsBase.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ContentsQueryTestsBase.cs index 4de91090b..939e7ba4b 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ContentsQueryTestsBase.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/ContentsQueryTestsBase.cs @@ -10,7 +10,6 @@ using Squidex.Domain.Apps.Entities.Contents.Repositories; using Squidex.Domain.Apps.Entities.Schemas; using Squidex.Infrastructure; using Squidex.Infrastructure.Queries; -using Xunit; using F = Squidex.Infrastructure.Queries.ClrFilter; #pragma warning disable SA1300 // Element should begin with upper-case letter diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/StatusSerializerTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/StatusSerializerTests.cs index 4c754464e..0be8432b9 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/StatusSerializerTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/MongoDb/StatusSerializerTests.cs @@ -9,7 +9,6 @@ using MongoDB.Bson.IO; using MongoDB.Bson.Serialization; using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Core.TestHelpers; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents.MongoDb; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/CalculateTokensTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/CalculateTokensTests.cs index 61470d673..27ff886b0 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/CalculateTokensTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/CalculateTokensTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Entities.Contents.Queries.Steps; @@ -13,7 +12,6 @@ using Squidex.Domain.Apps.Entities.Schemas; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Json; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents.Queries; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ContentEnricherTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ContentEnricherTests.cs index f61235e95..17f1716d1 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ContentEnricherTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ContentEnricherTests.cs @@ -5,12 +5,10 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Entities.Schemas; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents.Queries; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ContentLoaderTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ContentLoaderTests.cs index 60288ab90..9c6f33609 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ContentLoaderTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ContentLoaderTests.cs @@ -5,11 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Entities.Contents.DomainObject; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents.Queries; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ContentQueryParserTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ContentQueryParserTests.cs index 24d7f3b0b..665862f62 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ContentQueryParserTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ContentQueryParserTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Options; using Squidex.Domain.Apps.Core; @@ -18,7 +17,6 @@ using Squidex.Infrastructure; using Squidex.Infrastructure.Json.Objects; using Squidex.Infrastructure.Queries; using Squidex.Infrastructure.Validation; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents.Queries; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ContentQueryServiceTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ContentQueryServiceTests.cs index 6f31e410f..b26d7dcde 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ContentQueryServiceTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ContentQueryServiceTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using System.Security.Claims; -using FakeItEasy; using Microsoft.Extensions.Options; using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Core.Schemas; @@ -18,7 +17,6 @@ using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.Security; using Squidex.Shared; using Squidex.Shared.Identity; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents.Queries; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ConvertDataTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ConvertDataTests.cs index 6760f8805..d6e937fde 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ConvertDataTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ConvertDataTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core; using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Core.Schemas; @@ -17,7 +16,6 @@ using Squidex.Domain.Apps.Entities.Schemas; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Json.Objects; -using Xunit; using TestUtils = Squidex.Domain.Apps.Core.TestHelpers.TestUtils; namespace Squidex.Domain.Apps.Entities.Contents.Queries; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/EnrichForCachingTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/EnrichForCachingTests.cs index d7638a6b9..c69b53598 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/EnrichForCachingTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/EnrichForCachingTests.cs @@ -5,14 +5,12 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Entities.Contents.Queries.Steps; using Squidex.Domain.Apps.Entities.Schemas; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Caching; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents.Queries; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/EnrichWithSchemaTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/EnrichWithSchemaTests.cs index 2402ee39e..d49d3ba0b 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/EnrichWithSchemaTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/EnrichWithSchemaTests.cs @@ -10,7 +10,6 @@ using Squidex.Domain.Apps.Entities.Contents.Queries.Steps; using Squidex.Domain.Apps.Entities.Schemas; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents.Queries; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/EnrichWithWorkflowsTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/EnrichWithWorkflowsTests.cs index 118165a8d..4e7c04f05 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/EnrichWithWorkflowsTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/EnrichWithWorkflowsTests.cs @@ -5,12 +5,10 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Entities.Contents.Queries.Steps; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; -using Xunit; #pragma warning disable CA2012 // Use ValueTasks correctly @@ -70,7 +68,7 @@ public class EnrichWithWorkflowsTests await sut.EnrichAsync(requestContext, new[] { content }, null!, default); - Assert.Empty(content.NextStatuses); + Assert.Empty(content.NextStatuses!); A.CallTo(() => workflow.GetNextAsync(content, A._, requestContext.UserPrincipal)) .MustNotHaveHappened(); diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ResolveAssetsTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ResolveAssetsTests.cs index 1443a876c..0f0921ab4 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ResolveAssetsTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ResolveAssetsTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core; using Squidex.Domain.Apps.Core.Assets; using Squidex.Domain.Apps.Core.Contents; @@ -16,7 +15,6 @@ using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Caching; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents.Queries; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ResolveReferencesTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ResolveReferencesTests.cs index 7d0d382b1..ed78dd06b 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ResolveReferencesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ResolveReferencesTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core; using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Core.Schemas; @@ -15,7 +14,6 @@ using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Caching; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents.Queries; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ScriptContentTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ScriptContentTests.cs index af9a62231..5a19257ca 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ScriptContentTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ScriptContentTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Options; using Squidex.Domain.Apps.Core.Contents; @@ -15,7 +14,6 @@ using Squidex.Domain.Apps.Entities.Contents.Queries.Steps; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents.Queries; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ReferencesFluidExtensionTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ReferencesFluidExtensionTests.cs index ee14fb171..342b0da91 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ReferencesFluidExtensionTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ReferencesFluidExtensionTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.DependencyInjection; using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Core.Rules.EnrichedEvents; @@ -14,7 +13,6 @@ using Squidex.Domain.Apps.Core.Templates.Extensions; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ReferencesJintExtensionTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ReferencesJintExtensionTests.cs index 76504eb0e..8f8a18f10 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ReferencesJintExtensionTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/ReferencesJintExtensionTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using System.Security.Claims; -using FakeItEasy; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; @@ -16,7 +15,6 @@ using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Json.Objects; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/SingletonCommandMiddlewareTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/SingletonCommandMiddlewareTests.cs index 30e3b8113..618822878 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/SingletonCommandMiddlewareTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/SingletonCommandMiddlewareTests.cs @@ -5,13 +5,11 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Entities.Contents.Commands; using Squidex.Domain.Apps.Entities.Schemas.Commands; using Squidex.Infrastructure.Commands; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/AtlasParsingTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/AtlasParsingTests.cs index 6ca5c366f..2fd2ef134 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/AtlasParsingTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/AtlasParsingTests.cs @@ -12,7 +12,6 @@ using Lucene.Net.Analysis.Util; using Lucene.Net.Util; using MongoDB.Bson; using Squidex.Domain.Apps.Entities.MongoDb.Text; -using Xunit; using LuceneQueryAnalyzer = Lucene.Net.QueryParsers.Classic.QueryParser; namespace Squidex.Domain.Apps.Entities.Contents.Text; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/AtlasTextIndexFixture.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/AtlasTextIndexFixture.cs index b90325913..1c60e76b0 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/AtlasTextIndexFixture.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/AtlasTextIndexFixture.cs @@ -11,7 +11,6 @@ using MongoDB.Driver; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Entities.MongoDb.Text; using Squidex.Domain.Apps.Entities.TestHelpers; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents.Text; @@ -26,7 +25,7 @@ public sealed class AtlasTextIndexFixture : IAsyncLifetime var mongoClient = new MongoClient(TestConfig.Configuration["atlas:configuration"]); var mongoDatabase = mongoClient.GetDatabase(TestConfig.Configuration["atlas:database"]); - var options = TestConfig.Configuration.GetSection("atlas").Get(); + var options = TestConfig.Configuration.GetSection("atlas").Get()!; Index = new AtlasTextIndex(mongoDatabase, Options.Create(options)); } diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/AtlasTextIndexTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/AtlasTextIndexTests.cs index 7ba13f260..06651cb03 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/AtlasTextIndexTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/AtlasTextIndexTests.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using Xunit; - #pragma warning disable SA1300 // Element should begin with upper-case letter namespace Squidex.Domain.Apps.Entities.Contents.Text; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/AzureTextIndexFixture.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/AzureTextIndexFixture.cs index 205acaaf6..8743f91de 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/AzureTextIndexFixture.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/AzureTextIndexFixture.cs @@ -7,7 +7,6 @@ using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Extensions.Text.Azure; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents.Text; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/AzureTextIndexTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/AzureTextIndexTests.cs index 308e24703..66cce4555 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/AzureTextIndexTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/AzureTextIndexTests.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using Xunit; - #pragma warning disable SA1300 // Element should begin with upper-case letter namespace Squidex.Domain.Apps.Entities.Contents.Text; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/CachingTextIndexerStateTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/CachingTextIndexerStateTests.cs index 6f199222a..b6d41ebea 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/CachingTextIndexerStateTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/CachingTextIndexerStateTests.cs @@ -5,11 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Entities.Contents.Text.State; using Squidex.Infrastructure; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents.Text; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/ElasticSearchTextIndexFixture.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/ElasticSearchTextIndexFixture.cs index 31c1d4c8e..ed4ce3cec 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/ElasticSearchTextIndexFixture.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/ElasticSearchTextIndexFixture.cs @@ -8,7 +8,6 @@ using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Extensions.Text.ElasticSearch; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents.Text; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/ElasticSearchTextIndexTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/ElasticSearchTextIndexTests.cs index 8f872c7ef..1d6c45ba1 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/ElasticSearchTextIndexTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/ElasticSearchTextIndexTests.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using Xunit; - #pragma warning disable SA1300 // Element should begin with upper-case letter namespace Squidex.Domain.Apps.Entities.Contents.Text; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/MongoTextIndexFixture.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/MongoTextIndexFixture.cs index 18ae8c3af..c8d852454 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/MongoTextIndexFixture.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/MongoTextIndexFixture.cs @@ -9,7 +9,6 @@ using MongoDB.Driver; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Entities.MongoDb.Text; using Squidex.Domain.Apps.Entities.TestHelpers; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents.Text; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/MongoTextIndexTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/MongoTextIndexTests.cs index 273499cc0..fec0f883e 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/MongoTextIndexTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/MongoTextIndexTests.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using Xunit; - #pragma warning disable SA1300 // Element should begin with upper-case letter namespace Squidex.Domain.Apps.Entities.Contents.Text; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/OpenSearchTextIndexFixture.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/OpenSearchTextIndexFixture.cs index 821a9e3da..732b94799 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/OpenSearchTextIndexFixture.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/OpenSearchTextIndexFixture.cs @@ -8,7 +8,6 @@ using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Extensions.Text.ElasticSearch; -using Xunit; namespace Squidex.Domain.Apps.Entities.Contents.Text; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/OpenSearchTextIndexTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/OpenSearchTextIndexTests.cs index 8714f4fb3..4d528234c 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/OpenSearchTextIndexTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/OpenSearchTextIndexTests.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using Xunit; - #pragma warning disable SA1300 // Element should begin with upper-case letter namespace Squidex.Domain.Apps.Entities.Contents.Text; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/QueryParserTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/QueryParserTests.cs index 87d39d26c..dc99f32e3 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/QueryParserTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/QueryParserTests.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using Xunit; - namespace Squidex.Domain.Apps.Entities.Contents.Text; public class QueryParserTests diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/TextIndexerTestsBase.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/TextIndexerTestsBase.cs index 138b2d9eb..c351dc092 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/TextIndexerTestsBase.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/TextIndexerTestsBase.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Entities.Apps; @@ -15,7 +14,6 @@ using Squidex.Domain.Apps.Events.Contents; using Squidex.Infrastructure; using Squidex.Infrastructure.EventSourcing; using Squidex.Infrastructure.Json.Objects; -using Xunit; #pragma warning disable SA1401 // Fields should be private diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Invitation/InvitationEventConsumerTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Invitation/InvitationEventConsumerTests.cs index 67e1f098e..a33e25268 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Invitation/InvitationEventConsumerTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Invitation/InvitationEventConsumerTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.Logging; using NodaTime; using Squidex.Domain.Apps.Core.TestHelpers; @@ -18,7 +17,6 @@ using Squidex.Domain.Apps.Events.Teams; using Squidex.Infrastructure; using Squidex.Infrastructure.EventSourcing; using Squidex.Shared.Users; -using Xunit; namespace Squidex.Domain.Apps.Entities.Invitation; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Invitation/InviteUserCommandMiddlewareTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Invitation/InviteUserCommandMiddlewareTests.cs index e0b95afba..9b6755596 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Invitation/InviteUserCommandMiddlewareTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Invitation/InviteUserCommandMiddlewareTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Entities.Apps; using Squidex.Domain.Apps.Entities.Teams; @@ -13,7 +12,6 @@ using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; using Squidex.Shared.Users; -using Xunit; using AssignAppContributor = Squidex.Domain.Apps.Entities.Apps.Commands.AssignContributor; using AssignTeamContributor = Squidex.Domain.Apps.Entities.Teams.Commands.AssignContributor; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Notifications/EmailUserNotificationsTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Notifications/EmailUserNotificationsTests.cs index 5514f85d4..e19c131df 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Notifications/EmailUserNotificationsTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Notifications/EmailUserNotificationsTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Squidex.Domain.Apps.Core; @@ -16,7 +15,6 @@ using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Email; using Squidex.Shared.Users; -using Xunit; namespace Squidex.Domain.Apps.Entities.Notifications; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/BackupRulesTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/BackupRulesTests.cs index 7d9ab9280..d56e2528d 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/BackupRulesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/BackupRulesTests.cs @@ -5,14 +5,12 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Entities.Backup; using Squidex.Domain.Apps.Entities.Rules.DomainObject; using Squidex.Domain.Apps.Events.Rules; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.EventSourcing; -using Xunit; namespace Squidex.Domain.Apps.Entities.Rules; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/Guards/GuardRuleTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/Guards/GuardRuleTests.cs index 660b9fcbe..f6ffdbfe4 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/Guards/GuardRuleTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/Guards/GuardRuleTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core.Rules; using Squidex.Domain.Apps.Core.Rules.Triggers; using Squidex.Domain.Apps.Core.TestHelpers; @@ -14,7 +13,6 @@ using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Collections; using Squidex.Infrastructure.Validation; -using Xunit; namespace Squidex.Domain.Apps.Entities.Rules.DomainObject.Guards; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/Guards/Triggers/ContentChangedTriggerTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/Guards/Triggers/ContentChangedTriggerTests.cs index 650b72d67..da1dd79af 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/Guards/Triggers/ContentChangedTriggerTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/Guards/Triggers/ContentChangedTriggerTests.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; -using FluentAssertions; using Squidex.Domain.Apps.Core.Rules.Triggers; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Entities.Schemas; @@ -14,7 +12,6 @@ using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Collections; using Squidex.Infrastructure.Validation; -using Xunit; namespace Squidex.Domain.Apps.Entities.Rules.DomainObject.Guards.Triggers; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/Guards/Triggers/UsageTriggerValidationTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/Guards/Triggers/UsageTriggerValidationTests.cs index 29254ecf9..71e98e464 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/Guards/Triggers/UsageTriggerValidationTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/Guards/Triggers/UsageTriggerValidationTests.cs @@ -5,13 +5,10 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; -using FluentAssertions; using Squidex.Domain.Apps.Core.Rules.Triggers; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Validation; -using Xunit; namespace Squidex.Domain.Apps.Entities.Rules.DomainObject.Guards.Triggers; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/RuleCommandMiddlewareTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/RuleCommandMiddlewareTests.cs index c91e8a32d..17acb668f 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/RuleCommandMiddlewareTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/RuleCommandMiddlewareTests.cs @@ -5,12 +5,10 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Entities.Rules.Commands; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; -using Xunit; namespace Squidex.Domain.Apps.Entities.Rules.DomainObject; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/RuleDomainObjectTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/RuleDomainObjectTests.cs index 9fba742f6..f1cb7283d 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/RuleDomainObjectTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/DomainObject/RuleDomainObjectTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Squidex.Domain.Apps.Core.Rules; @@ -15,7 +14,6 @@ using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Domain.Apps.Events.Rules; using Squidex.Infrastructure; using Squidex.Infrastructure.EventSourcing; -using Xunit; namespace Squidex.Domain.Apps.Entities.Rules.DomainObject; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/Indexes/RulesIndexTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/Indexes/RulesIndexTests.cs index 47d832b07..7c3eed559 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/Indexes/RulesIndexTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/Indexes/RulesIndexTests.cs @@ -5,10 +5,8 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Entities.Rules.Repositories; using Squidex.Infrastructure; -using Xunit; namespace Squidex.Domain.Apps.Entities.Rules.Indexes; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/ManualTriggerHandlerTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/ManualTriggerHandlerTests.cs index 2a0ab70bf..ecb5d42a2 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/ManualTriggerHandlerTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/ManualTriggerHandlerTests.cs @@ -12,7 +12,6 @@ using Squidex.Domain.Apps.Events; using Squidex.Domain.Apps.Events.Rules; using Squidex.Infrastructure; using Squidex.Infrastructure.EventSourcing; -using Xunit; namespace Squidex.Domain.Apps.Entities.Rules; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/Queries/RuleEnricherTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/Queries/RuleEnricherTests.cs index edbf8f812..de47638b8 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/Queries/RuleEnricherTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/Queries/RuleEnricherTests.cs @@ -5,13 +5,11 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using NodaTime; using Squidex.Domain.Apps.Entities.Rules.Repositories; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Caching; -using Xunit; namespace Squidex.Domain.Apps.Entities.Rules.Queries; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/Queries/RuleQueryServiceTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/Queries/RuleQueryServiceTests.cs index c483077a5..91e2ebddd 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/Queries/RuleQueryServiceTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/Queries/RuleQueryServiceTests.cs @@ -5,11 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Entities.Rules.Indexes; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; -using Xunit; namespace Squidex.Domain.Apps.Entities.Rules.Queries; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/RuleDequeuerWorkerTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/RuleDequeuerWorkerTests.cs index ccffc9e9a..ac6436c4d 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/RuleDequeuerWorkerTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/RuleDequeuerWorkerTests.cs @@ -5,14 +5,12 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.Logging; using NodaTime; using Squidex.Domain.Apps.Core.HandleRules; using Squidex.Domain.Apps.Core.Rules; using Squidex.Domain.Apps.Entities.Rules.Repositories; using Squidex.Infrastructure; -using Xunit; namespace Squidex.Domain.Apps.Entities.Rules; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/RuleEnqueuerTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/RuleEnqueuerTests.cs index f9b29497a..d19f6b6fa 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/RuleEnqueuerTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/RuleEnqueuerTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; @@ -18,7 +17,6 @@ using Squidex.Domain.Apps.Entities.Rules.Repositories; using Squidex.Domain.Apps.Events.Contents; using Squidex.Infrastructure; using Squidex.Infrastructure.EventSourcing; -using Xunit; namespace Squidex.Domain.Apps.Entities.Rules; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/UsageTracking/UsageTriggerHandlerTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/UsageTracking/UsageTriggerHandlerTests.cs index f725b964c..6075802ed 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/UsageTracking/UsageTriggerHandlerTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Rules/UsageTracking/UsageTriggerHandlerTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core.HandleRules; using Squidex.Domain.Apps.Core.Rules; using Squidex.Domain.Apps.Core.Rules.EnrichedEvents; @@ -14,7 +13,6 @@ using Squidex.Domain.Apps.Events; using Squidex.Domain.Apps.Events.Contents; using Squidex.Infrastructure; using Squidex.Infrastructure.EventSourcing; -using Xunit; namespace Squidex.Domain.Apps.Entities.Rules.UsageTracking; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/BackupSchemasTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/BackupSchemasTests.cs index 57bb97ffa..848cef377 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/BackupSchemasTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/BackupSchemasTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Entities.Backup; using Squidex.Domain.Apps.Entities.Schemas.DomainObject; using Squidex.Domain.Apps.Events; @@ -13,7 +12,6 @@ using Squidex.Domain.Apps.Events.Schemas; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.EventSourcing; -using Xunit; namespace Squidex.Domain.Apps.Entities.Schemas; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/ArrayFieldPropertiesTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/ArrayFieldPropertiesTests.cs index dbf31f135..ca4b2a108 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/ArrayFieldPropertiesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/ArrayFieldPropertiesTests.cs @@ -5,11 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure.Validation; -using Xunit; namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject.Guards.FieldProperties; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/AssetsFieldPropertiesTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/AssetsFieldPropertiesTests.cs index e662e538b..0bf273179 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/AssetsFieldPropertiesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/AssetsFieldPropertiesTests.cs @@ -5,11 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure.Validation; -using Xunit; namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject.Guards.FieldProperties; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/BooleanFieldPropertiesTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/BooleanFieldPropertiesTests.cs index 63f3b11d2..4bd260790 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/BooleanFieldPropertiesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/BooleanFieldPropertiesTests.cs @@ -5,11 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure.Validation; -using Xunit; namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject.Guards.FieldProperties; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/ComponentsFieldPropertiesTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/ComponentsFieldPropertiesTests.cs index 75adf4a91..18ed38e70 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/ComponentsFieldPropertiesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/ComponentsFieldPropertiesTests.cs @@ -5,11 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure.Validation; -using Xunit; namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject.Guards.FieldProperties; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/DateTimeFieldPropertiesTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/DateTimeFieldPropertiesTests.cs index 62268ac5d..53016bd41 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/DateTimeFieldPropertiesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/DateTimeFieldPropertiesTests.cs @@ -5,13 +5,11 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using NodaTime; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Validation; -using Xunit; namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject.Guards.FieldProperties; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/GeolocationFieldPropertiesTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/GeolocationFieldPropertiesTests.cs index d2c165943..a926d79c3 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/GeolocationFieldPropertiesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/GeolocationFieldPropertiesTests.cs @@ -5,11 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure.Validation; -using Xunit; namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject.Guards.FieldProperties; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/JsonFieldPropertiesTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/JsonFieldPropertiesTests.cs index b3acf84a3..1583c8a9b 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/JsonFieldPropertiesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/JsonFieldPropertiesTests.cs @@ -7,7 +7,6 @@ using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; -using Xunit; namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject.Guards.FieldProperties; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/NumberFieldPropertiesTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/NumberFieldPropertiesTests.cs index df1bc50ab..471bd4891 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/NumberFieldPropertiesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/NumberFieldPropertiesTests.cs @@ -5,12 +5,10 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure.Collections; using Squidex.Infrastructure.Validation; -using Xunit; namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject.Guards.FieldProperties; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/ReferencesFieldPropertiesTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/ReferencesFieldPropertiesTests.cs index 08156a299..bf0fb5124 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/ReferencesFieldPropertiesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/ReferencesFieldPropertiesTests.cs @@ -5,11 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure.Validation; -using Xunit; namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject.Guards.FieldProperties; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/StringFieldPropertiesTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/StringFieldPropertiesTests.cs index 81f24c740..c325f6d62 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/StringFieldPropertiesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/StringFieldPropertiesTests.cs @@ -5,12 +5,10 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure.Collections; using Squidex.Infrastructure.Validation; -using Xunit; namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject.Guards.FieldProperties; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/TagsFieldPropertiesTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/TagsFieldPropertiesTests.cs index 49a015187..44f7ff6da 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/TagsFieldPropertiesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/TagsFieldPropertiesTests.cs @@ -5,11 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure.Validation; -using Xunit; namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject.Guards.FieldProperties; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/UIFieldPropertiesTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/UIFieldPropertiesTests.cs index fbf5d02a9..23ce04ebf 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/UIFieldPropertiesTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/FieldProperties/UIFieldPropertiesTests.cs @@ -5,11 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure.Validation; -using Xunit; namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject.Guards.FieldProperties; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/GuardSchemaFieldTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/GuardSchemaFieldTests.cs index 3fad23b05..85d8ce039 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/GuardSchemaFieldTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/GuardSchemaFieldTests.cs @@ -12,7 +12,6 @@ using Squidex.Domain.Apps.Entities.Schemas.Commands; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Validation; -using Xunit; #pragma warning disable SA1310 // Field names must not contain underscore diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/GuardSchemaTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/GuardSchemaTests.cs index e92ecbe08..f64d1ba4c 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/GuardSchemaTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/Guards/GuardSchemaTests.cs @@ -13,7 +13,6 @@ using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Collections; using Squidex.Infrastructure.Validation; -using Xunit; #pragma warning disable SA1310 // Field names must not contain underscore diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/SchemaDomainObjectTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/SchemaDomainObjectTests.cs index d6e8cc978..1e8b62678 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/SchemaDomainObjectTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/SchemaDomainObjectTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.Logging; using Squidex.Domain.Apps.Core; using Squidex.Domain.Apps.Core.Schemas; @@ -15,7 +14,6 @@ using Squidex.Domain.Apps.Events.Schemas; using Squidex.Infrastructure; using Squidex.Infrastructure.Collections; using Squidex.Infrastructure.Commands; -using Xunit; namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/SchemaStateTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/SchemaStateTests.cs index 722caeeb5..d9365943a 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/SchemaStateTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/DomainObject/SchemaStateTests.cs @@ -8,7 +8,6 @@ using System.Text.Json.Serialization; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Infrastructure.Json; -using Xunit; namespace Squidex.Domain.Apps.Entities.Schemas.DomainObject; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Indexes/SchemasIndexTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Indexes/SchemasIndexTests.cs index a21790a05..534758192 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Indexes/SchemasIndexTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Indexes/SchemasIndexTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Options; using Squidex.Caching; @@ -18,7 +17,6 @@ using Squidex.Infrastructure.States; using Squidex.Infrastructure.TestHelpers; using Squidex.Infrastructure.Validation; using Squidex.Messaging; -using Xunit; namespace Squidex.Domain.Apps.Entities.Schemas.Indexes; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/MongoDb/SchemasHashTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/MongoDb/SchemasHashTests.cs index 1aa49f70d..91f4766fe 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/MongoDb/SchemasHashTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/MongoDb/SchemasHashTests.cs @@ -5,13 +5,11 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using NodaTime; using Squidex.Domain.Apps.Entities.Apps; using Squidex.Domain.Apps.Events.Schemas; using Squidex.Infrastructure; using Squidex.Infrastructure.EventSourcing; -using Xunit; #pragma warning disable SA1300 // Element should begin with upper-case letter diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/SchemaChangedTriggerHandlerTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/SchemaChangedTriggerHandlerTests.cs index 74c294fe0..92a5e5ac2 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/SchemaChangedTriggerHandlerTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/SchemaChangedTriggerHandlerTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core.HandleRules; using Squidex.Domain.Apps.Core.Rules; using Squidex.Domain.Apps.Core.Rules.EnrichedEvents; @@ -17,7 +16,6 @@ using Squidex.Domain.Apps.Events.Apps; using Squidex.Domain.Apps.Events.Schemas; using Squidex.Infrastructure; using Squidex.Infrastructure.EventSourcing; -using Xunit; namespace Squidex.Domain.Apps.Entities.Schemas; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/SchemaCommandsTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/SchemaCommandsTests.cs index 46a52a158..a0f91bb69 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/SchemaCommandsTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/SchemaCommandsTests.cs @@ -5,12 +5,10 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Domain.Apps.Core; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Entities.Schemas.Commands; using Squidex.Infrastructure.Collections; -using Xunit; namespace Squidex.Domain.Apps.Entities.Schemas; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/SchemasSearchSourceTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/SchemasSearchSourceTests.cs index c1051a071..253b073c8 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/SchemasSearchSourceTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/SchemasSearchSourceTests.cs @@ -6,8 +6,6 @@ // ========================================================================== using System.Security.Claims; -using FakeItEasy; -using FluentAssertions; using Squidex.Domain.Apps.Core; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Core.TestHelpers; @@ -16,7 +14,6 @@ using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Shared; using Squidex.Shared.Identity; -using Xunit; namespace Squidex.Domain.Apps.Entities.Schemas; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Search/SearchManagerTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Search/SearchManagerTests.cs index 4b021904a..e5a35309d 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Search/SearchManagerTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Search/SearchManagerTests.cs @@ -5,12 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; -using FluentAssertions; using Microsoft.Extensions.Logging; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; -using Xunit; namespace Squidex.Domain.Apps.Entities.Search; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Squidex.Domain.Apps.Entities.Tests.csproj b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Squidex.Domain.Apps.Entities.Tests.csproj index e32946928..4fde772d3 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Squidex.Domain.Apps.Entities.Tests.csproj +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Squidex.Domain.Apps.Entities.Tests.csproj @@ -1,7 +1,7 @@  Exe - net6.0 + net7.0 Squidex.Domain.Apps.Entities 10.0 enable @@ -22,29 +22,34 @@ - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - + + + + + - + all runtime; build; native; contentfiles; analyzers + + + + + diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Tags/TagServiceTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Tags/TagServiceTests.cs index f91a31a37..ef9af8760 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Tags/TagServiceTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Tags/TagServiceTests.cs @@ -5,12 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; -using FluentAssertions; using Squidex.Domain.Apps.Core.Tags; using Squidex.Infrastructure; using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Domain.Apps.Entities.Tags; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Teams/DomainObject/Guards/GuardTeamContributorsTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Teams/DomainObject/Guards/GuardTeamContributorsTests.cs index b085cd560..ae8514b7d 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Teams/DomainObject/Guards/GuardTeamContributorsTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Teams/DomainObject/Guards/GuardTeamContributorsTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core; using Squidex.Domain.Apps.Core.Apps; using Squidex.Domain.Apps.Core.TestHelpers; @@ -14,7 +13,6 @@ using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Validation; using Squidex.Shared.Users; -using Xunit; #pragma warning disable SA1310 // Field names must not contain underscore diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Teams/DomainObject/Guards/GuardTeamTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Teams/DomainObject/Guards/GuardTeamTests.cs index 9edf2ad2c..e32c78d3c 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Teams/DomainObject/Guards/GuardTeamTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Teams/DomainObject/Guards/GuardTeamTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Core.TestHelpers; using Squidex.Domain.Apps.Entities.Billing; using Squidex.Domain.Apps.Entities.Teams.Commands; @@ -14,7 +13,6 @@ using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Validation; using Squidex.Shared.Users; -using Xunit; namespace Squidex.Domain.Teams.Apps.Teams.DomainObject.Guards; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Teams/DomainObject/TeamDomainObjectTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Teams/DomainObject/TeamDomainObjectTests.cs index 77f946328..989873758 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Teams/DomainObject/TeamDomainObjectTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Teams/DomainObject/TeamDomainObjectTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Squidex.Domain.Apps.Core.Apps; @@ -16,7 +15,6 @@ using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Domain.Apps.Events.Teams; using Squidex.Infrastructure; using Squidex.Shared.Users; -using Xunit; namespace Squidex.Domain.Apps.Entities.Teams.DomainObject; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Teams/Indexes/TeamsIndexTests.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Teams/Indexes/TeamsIndexTests.cs index 7634244c3..9a4c12cef 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Teams/Indexes/TeamsIndexTests.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Teams/Indexes/TeamsIndexTests.cs @@ -5,11 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Entities.Teams.Repositories; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; -using Xunit; namespace Squidex.Domain.Apps.Entities.Teams.Indexes; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/TestHelpers/AExtensions.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/TestHelpers/AExtensions.cs index 9679938e7..8feee9315 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/TestHelpers/AExtensions.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/TestHelpers/AExtensions.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Infrastructure; using Squidex.Infrastructure.Queries; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/TestHelpers/AssertHelper.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/TestHelpers/AssertHelper.cs index 3d3a696bd..390ebac69 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/TestHelpers/AssertHelper.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/TestHelpers/AssertHelper.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Infrastructure.EventSourcing; namespace Squidex.Domain.Apps.Entities.TestHelpers; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/TestHelpers/HandlerTestBase.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/TestHelpers/HandlerTestBase.cs index 791565a3a..40f338094 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/TestHelpers/HandlerTestBase.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/TestHelpers/HandlerTestBase.cs @@ -6,13 +6,11 @@ // ========================================================================== using System.Security.Claims; -using FakeItEasy; using Squidex.Domain.Apps.Events; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.EventSourcing; using Squidex.Infrastructure.States; -using Xunit; namespace Squidex.Domain.Apps.Entities.TestHelpers; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/TestHelpers/Mocks.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/TestHelpers/Mocks.cs index 95f38704a..85f17e27f 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/TestHelpers/Mocks.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/TestHelpers/Mocks.cs @@ -6,7 +6,6 @@ // ========================================================================== using System.Security.Claims; -using FakeItEasy; using Squidex.Domain.Apps.Core; using Squidex.Domain.Apps.Core.Apps; using Squidex.Domain.Apps.Core.Schemas; diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/TestHelpers/ValidationAssert.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/TestHelpers/ValidationAssert.cs index 4fef4b05e..77a12ed72 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/TestHelpers/ValidationAssert.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/TestHelpers/ValidationAssert.cs @@ -5,9 +5,7 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Infrastructure.Validation; -using Xunit; using Xunit.Sdk; namespace Squidex.Domain.Apps.Entities.TestHelpers; diff --git a/backend/tests/Squidex.Domain.Users.Tests/DefaultKeyStoreTests.cs b/backend/tests/Squidex.Domain.Users.Tests/DefaultKeyStoreTests.cs index 1b405d2a4..e2c990949 100644 --- a/backend/tests/Squidex.Domain.Users.Tests/DefaultKeyStoreTests.cs +++ b/backend/tests/Squidex.Domain.Users.Tests/DefaultKeyStoreTests.cs @@ -6,13 +6,11 @@ // ========================================================================== using System.Security.Cryptography; -using FakeItEasy; using IdentityModel; using Microsoft.IdentityModel.Tokens; using OpenIddict.Server; using Squidex.Infrastructure; using Squidex.Infrastructure.States; -using Xunit; namespace Squidex.Domain.Users; diff --git a/backend/tests/Squidex.Domain.Users.Tests/DefaultUserPictureStoreTests.cs b/backend/tests/Squidex.Domain.Users.Tests/DefaultUserPictureStoreTests.cs index b63cb7024..de9effe0b 100644 --- a/backend/tests/Squidex.Domain.Users.Tests/DefaultUserPictureStoreTests.cs +++ b/backend/tests/Squidex.Domain.Users.Tests/DefaultUserPictureStoreTests.cs @@ -5,9 +5,7 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Assets; -using Xunit; namespace Squidex.Domain.Users; diff --git a/backend/tests/Squidex.Domain.Users.Tests/DefaultUserResolverTests.cs b/backend/tests/Squidex.Domain.Users.Tests/DefaultUserResolverTests.cs index 4a9fc9366..54ed27bd3 100644 --- a/backend/tests/Squidex.Domain.Users.Tests/DefaultUserResolverTests.cs +++ b/backend/tests/Squidex.Domain.Users.Tests/DefaultUserResolverTests.cs @@ -5,11 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.DependencyInjection; using Squidex.Infrastructure; using Squidex.Shared.Users; -using Xunit; namespace Squidex.Domain.Users; diff --git a/backend/tests/Squidex.Domain.Users.Tests/DefaultUserServiceTests.cs b/backend/tests/Squidex.Domain.Users.Tests/DefaultUserServiceTests.cs index b9804b3bf..9551304cd 100644 --- a/backend/tests/Squidex.Domain.Users.Tests/DefaultUserServiceTests.cs +++ b/backend/tests/Squidex.Domain.Users.Tests/DefaultUserServiceTests.cs @@ -7,14 +7,12 @@ using System.Globalization; using System.Security.Claims; -using FakeItEasy; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.Logging; using Squidex.Infrastructure; using Squidex.Shared; using Squidex.Shared.Identity; using Squidex.Shared.Users; -using Xunit; namespace Squidex.Domain.Users; @@ -79,7 +77,7 @@ public class DefaultUserServiceTests { var identity = CreateIdentity(found: true); - var actual = await sut.FindByEmailAsync(identity.Email); + var actual = await sut.FindByEmailAsync(identity.Email!); Assert.Same(identity, actual?.Identity); } @@ -89,7 +87,7 @@ public class DefaultUserServiceTests { var identity = CreateIdentity(found: false); - var actual = await sut.FindByEmailAsync(identity.Email); + var actual = await sut.FindByEmailAsync(identity.Email!); Assert.Null(actual); } @@ -119,7 +117,7 @@ public class DefaultUserServiceTests CreateIdentity(found: false); A.CallTo(() => userManager.FindByLoginAsync(provider, providerKey)) - .Returns(Task.FromResult(null!)); + .Returns(Task.FromResult(null)); var actual = await sut.FindByLoginAsync(provider, providerKey); @@ -171,12 +169,12 @@ public class DefaultUserServiceTests var values = new UserValues { - Email = identity.Email + Email = identity.Email! }; SetupCreation(identity, 1); - await sut.CreateAsync(values.Email, values); + await sut.CreateAsync(values.Email!, values); A.CallTo(() => userEvents.OnUserRegisteredAsync(A.That.Matches(x => x.Identity == identity))) .MustHaveHappened(); @@ -206,7 +204,7 @@ public class DefaultUserServiceTests SetupCreation(identity, 1); - await sut.CreateAsync(identity.Email, values); + await sut.CreateAsync(identity.Email!, values); A.CallTo(() => userEvents.OnConsentGivenAsync(A.That.Matches(x => x.Identity == identity))) .MustHaveHappened(); @@ -224,7 +222,7 @@ public class DefaultUserServiceTests SetupCreation(identity, 0); - await sut.CreateAsync(identity.Email, values); + await sut.CreateAsync(identity.Email!, values); A.CallTo(() => userManager.AddClaimsAsync(identity, HasClaim(SquidexClaimTypes.Permissions, PermissionIds.Admin))) .MustHaveHappened(); @@ -242,7 +240,7 @@ public class DefaultUserServiceTests SetupCreation(identity, 0); - await sut.CreateAsync(identity.Email, values, true); + await sut.CreateAsync(identity.Email!, values, true); A.CallTo(() => userManager.SetLockoutEndDateAsync(identity, A._)) .MustNotHaveHappened(); @@ -260,7 +258,7 @@ public class DefaultUserServiceTests SetupCreation(identity, 1); - await sut.CreateAsync(identity.Email, values, true); + await sut.CreateAsync(identity.Email!, values, true); A.CallTo(() => userManager.SetLockoutEndDateAsync(identity, InFuture())) .MustHaveHappened(); @@ -278,7 +276,7 @@ public class DefaultUserServiceTests SetupCreation(identity, 1); - await sut.CreateAsync(identity.Email, values, false); + await sut.CreateAsync(identity.Email!, values, false); A.CallTo(() => userManager.AddPasswordAsync(identity, values.Password)) .MustHaveHappened(); @@ -561,16 +559,16 @@ public class DefaultUserServiceTests A.CallTo(() => userManager.FindByIdAsync(identity.Id)) .Returns(identity); - A.CallTo(() => userManager.FindByEmailAsync(identity.Email)) + A.CallTo(() => userManager.FindByEmailAsync(identity.Email!)) .Returns(identity); } else { A.CallTo(() => userManager.FindByIdAsync(identity.Id)) - .Returns(Task.FromResult(null!)); + .Returns(Task.FromResult(null)); - A.CallTo(() => userManager.FindByEmailAsync(identity.Email)) - .Returns(Task.FromResult(null!)); + A.CallTo(() => userManager.FindByEmailAsync(identity.Email!)) + .Returns(Task.FromResult(null)); } return identity; @@ -588,7 +586,7 @@ public class DefaultUserServiceTests A.CallTo(() => userManager.Users) .Returns(users.AsQueryable()); - A.CallTo(() => userFactory.Create(identity.Email)) + A.CallTo(() => userFactory.Create(identity.Email!)) .Returns(identity); } diff --git a/backend/tests/Squidex.Domain.Users.Tests/DefaultXmlRepositoryTests.cs b/backend/tests/Squidex.Domain.Users.Tests/DefaultXmlRepositoryTests.cs index 1cc3c3748..0cfb48316 100644 --- a/backend/tests/Squidex.Domain.Users.Tests/DefaultXmlRepositoryTests.cs +++ b/backend/tests/Squidex.Domain.Users.Tests/DefaultXmlRepositoryTests.cs @@ -6,10 +6,8 @@ // ========================================================================== using System.Xml.Linq; -using FakeItEasy; using Squidex.Infrastructure; using Squidex.Infrastructure.States; -using Xunit; namespace Squidex.Domain.Users; diff --git a/backend/tests/Squidex.Domain.Users.Tests/Squidex.Domain.Users.Tests.csproj b/backend/tests/Squidex.Domain.Users.Tests/Squidex.Domain.Users.Tests.csproj index fd2607b03..5667ef6e9 100644 --- a/backend/tests/Squidex.Domain.Users.Tests/Squidex.Domain.Users.Tests.csproj +++ b/backend/tests/Squidex.Domain.Users.Tests/Squidex.Domain.Users.Tests.csproj @@ -1,7 +1,7 @@  Exe - net6.0 + net7.0 Squidex.Domain.Users 10.0 enable @@ -15,20 +15,25 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + - + all runtime; build; native; contentfiles; analyzers + + + + + diff --git a/backend/tests/Squidex.Infrastructure.Tests/Caching/QueryCacheTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Caching/QueryCacheTests.cs index 9fb709722..54cc3cfe3 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Caching/QueryCacheTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Caching/QueryCacheTests.cs @@ -7,7 +7,6 @@ using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Options; -using Xunit; #pragma warning disable SA1313 // Parameter names should begin with lower-case letter diff --git a/backend/tests/Squidex.Infrastructure.Tests/CollectionExtensionsTests.cs b/backend/tests/Squidex.Infrastructure.Tests/CollectionExtensionsTests.cs index 9a9e3526d..6a46fc501 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/CollectionExtensionsTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/CollectionExtensionsTests.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using Xunit; - namespace Squidex.Infrastructure; public class CollectionExtensionsTests diff --git a/backend/tests/Squidex.Infrastructure.Tests/Collections/ListDictionaryTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Collections/ListDictionaryTests.cs index 65b83e790..3e3828fc1 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Collections/ListDictionaryTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Collections/ListDictionaryTests.cs @@ -7,7 +7,6 @@ using System.Collections; using Squidex.Infrastructure.TestHelpers; -using Xunit; #pragma warning disable xUnit2017 // Do not use Contains() to check if a value exists in a collection #pragma warning disable IDE0028 // Simplify collection initialization diff --git a/backend/tests/Squidex.Infrastructure.Tests/Collections/ReadonlyDictionaryTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Collections/ReadonlyDictionaryTests.cs index 35b8aaf14..c5c0282dd 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Collections/ReadonlyDictionaryTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Collections/ReadonlyDictionaryTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Infrastructure.Collections; diff --git a/backend/tests/Squidex.Infrastructure.Tests/Collections/ReadonlyListTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Collections/ReadonlyListTests.cs index 49a94e8e1..1acabc35b 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Collections/ReadonlyListTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Collections/ReadonlyListTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Infrastructure.Collections; diff --git a/backend/tests/Squidex.Infrastructure.Tests/Commands/CommandContextTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Commands/CommandContextTests.cs index 10e26a785..676fb2754 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Commands/CommandContextTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Commands/CommandContextTests.cs @@ -5,9 +5,7 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Infrastructure.Commands; diff --git a/backend/tests/Squidex.Infrastructure.Tests/Commands/CommandResultTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Commands/CommandResultTests.cs index 487a34540..42c6f1305 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Commands/CommandResultTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Commands/CommandResultTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Infrastructure.Commands; diff --git a/backend/tests/Squidex.Infrastructure.Tests/Commands/CustomCommandMiddlewareRunnerTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Commands/CustomCommandMiddlewareRunnerTests.cs index 265d0cdae..ebeefdfbe 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Commands/CustomCommandMiddlewareRunnerTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Commands/CustomCommandMiddlewareRunnerTests.cs @@ -5,9 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; -using Xunit; - namespace Squidex.Infrastructure.Commands; public class CustomCommandMiddlewareRunnerTests diff --git a/backend/tests/Squidex.Infrastructure.Tests/Commands/DefaultDomainObjectCacheTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Commands/DefaultDomainObjectCacheTests.cs index f769ba6f3..195dc9f2c 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Commands/DefaultDomainObjectCacheTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Commands/DefaultDomainObjectCacheTests.cs @@ -5,12 +5,10 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.Caching.Distributed; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Options; using Squidex.Infrastructure.Json; -using Xunit; namespace Squidex.Infrastructure.Commands; @@ -60,7 +58,7 @@ public class DefaultDomainObjectCacheTests [Fact] public async Task Should_provide_from_cache_if_found() { - object returned; + object? returned; A.CallTo(() => cache.TryGetValue($"{id}_10", out returned)) .Returns(true) diff --git a/backend/tests/Squidex.Infrastructure.Tests/Commands/DefaultDomainObjectFactoryTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Commands/DefaultDomainObjectFactoryTests.cs index 93e6048e7..4dc43ffe5 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Commands/DefaultDomainObjectFactoryTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Commands/DefaultDomainObjectFactoryTests.cs @@ -5,10 +5,8 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.DependencyInjection; using Squidex.Infrastructure.States; -using Xunit; #pragma warning disable SA1313 // Parameter names should begin with lower-case letter diff --git a/backend/tests/Squidex.Infrastructure.Tests/Commands/DomainObjectTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Commands/DomainObjectTests.cs index 12be04e2d..05be5d7bb 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Commands/DomainObjectTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Commands/DomainObjectTests.cs @@ -5,11 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Infrastructure.EventSourcing; using Squidex.Infrastructure.States; using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Infrastructure.Commands; diff --git a/backend/tests/Squidex.Infrastructure.Tests/Commands/EnrichWithTimestampCommandMiddlewareTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Commands/EnrichWithTimestampCommandMiddlewareTests.cs index 5a392b9a2..af4b4793e 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Commands/EnrichWithTimestampCommandMiddlewareTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Commands/EnrichWithTimestampCommandMiddlewareTests.cs @@ -5,10 +5,8 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using NodaTime; using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Infrastructure.Commands; diff --git a/backend/tests/Squidex.Infrastructure.Tests/Commands/InMemoryCommandBusTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Commands/InMemoryCommandBusTests.cs index bbd9a180a..3f6b8b114 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Commands/InMemoryCommandBusTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Commands/InMemoryCommandBusTests.cs @@ -5,9 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; -using Xunit; - namespace Squidex.Infrastructure.Commands; public class InMemoryCommandBusTests diff --git a/backend/tests/Squidex.Infrastructure.Tests/Commands/LogCommandMiddlewareTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Commands/LogCommandMiddlewareTests.cs index cdd06f950..c4ab3c148 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Commands/LogCommandMiddlewareTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Commands/LogCommandMiddlewareTests.cs @@ -5,9 +5,7 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.Logging; -using Xunit; namespace Squidex.Infrastructure.Commands; diff --git a/backend/tests/Squidex.Infrastructure.Tests/Commands/ReadonlyCommandMiddlewareTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Commands/ReadonlyCommandMiddlewareTests.cs index 203c7f530..5d654f3b0 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Commands/ReadonlyCommandMiddlewareTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Commands/ReadonlyCommandMiddlewareTests.cs @@ -5,9 +5,7 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.Options; -using Xunit; namespace Squidex.Infrastructure.Commands; diff --git a/backend/tests/Squidex.Infrastructure.Tests/DisposableObjectBaseTests.cs b/backend/tests/Squidex.Infrastructure.Tests/DisposableObjectBaseTests.cs index bd9bcead0..d58b939c1 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/DisposableObjectBaseTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/DisposableObjectBaseTests.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using Xunit; - namespace Squidex.Infrastructure; public class DisposableObjectBaseTests diff --git a/backend/tests/Squidex.Infrastructure.Tests/DomainIdTests.cs b/backend/tests/Squidex.Infrastructure.Tests/DomainIdTests.cs index 9b5c52c8f..13efb36c6 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/DomainIdTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/DomainIdTests.cs @@ -7,9 +7,7 @@ using System.ComponentModel; using System.Text.Json.Serialization; -using FluentAssertions; using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Infrastructure; diff --git a/backend/tests/Squidex.Infrastructure.Tests/DomainObjectExceptionTests.cs b/backend/tests/Squidex.Infrastructure.Tests/DomainObjectExceptionTests.cs index 637552980..c835cf7bf 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/DomainObjectExceptionTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/DomainObjectExceptionTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Infrastructure; diff --git a/backend/tests/Squidex.Infrastructure.Tests/Email/SmtpEmailSenderTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Email/SmtpEmailSenderTests.cs index d2f996712..9d9b0066c 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Email/SmtpEmailSenderTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Email/SmtpEmailSenderTests.cs @@ -8,7 +8,6 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Options; using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Infrastructure.Email; @@ -18,12 +17,12 @@ public class SmtpEmailSenderTests [Fact] public async Task Should_handle_timeout_properly() { - var options = TestConfig.Configuration.GetSection("email:smtp").Get(); + var options = TestConfig.Configuration.GetSection("email:smtp").Get()!; - var recipient = TestConfig.Configuration["email:smtp:recipient"]; + var recipient = TestConfig.Configuration["email:smtp:recipient"]!; - var testSubject = TestConfig.Configuration["email:smtp:testSubject"]; - var testBody = TestConfig.Configuration["email:smtp:testBody"]; + var testSubject = TestConfig.Configuration["email:smtp:testSubject"]!; + var testBody = TestConfig.Configuration["email:smtp:testBody"]!; var sut = new SmtpEmailSender(Options.Create(options)); diff --git a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/Consume/EventConsumerManagerTests.cs b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/Consume/EventConsumerManagerTests.cs index af1310c1d..eff0995c8 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/Consume/EventConsumerManagerTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/Consume/EventConsumerManagerTests.cs @@ -5,12 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; -using FluentAssertions; using Squidex.Infrastructure.States; using Squidex.Infrastructure.TestHelpers; using Squidex.Messaging; -using Xunit; namespace Squidex.Infrastructure.EventSourcing.Consume; diff --git a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/Consume/EventConsumerProcessorIntegrationTests.cs b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/Consume/EventConsumerProcessorIntegrationTests.cs index 8e5994fc1..d4650c235 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/Consume/EventConsumerProcessorIntegrationTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/Consume/EventConsumerProcessorIntegrationTests.cs @@ -11,7 +11,6 @@ using Squidex.Caching; using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.States; using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Infrastructure.EventSourcing.Consume; @@ -65,7 +64,7 @@ public abstract class EventConsumerProcessorIntegrationTests var mongoClient = new MongoClient(TestConfig.Configuration["mongodb:configuration"]); var mongoDatabase = mongoClient.GetDatabase(TestConfig.Configuration["mongodb:database"]); - var typeFactory = new TypeNameRegistry().Map(typeof(MyEvent), "MyEvent"); + var typeRegistry = new TypeRegistry().Add("MyEvent"); var services = new ServiceCollection() .AddLogging() @@ -74,7 +73,7 @@ public abstract class EventConsumerProcessorIntegrationTests .AddSingleton(eventConsumer) .AddSingleton(mongoClient) .AddSingleton(mongoDatabase) - .AddSingleton(typeFactory) + .AddSingleton(typeRegistry) .AddSingleton(typeof(IPersistenceFactory<>), typeof(Store<>)) .AddSingleton() .AddSingleton(eventConsumer) diff --git a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/Consume/EventConsumerProcessorTests.cs b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/Consume/EventConsumerProcessorTests.cs index 54248d537..a65a67564 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/Consume/EventConsumerProcessorTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/Consume/EventConsumerProcessorTests.cs @@ -5,12 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; -using FluentAssertions; using Microsoft.Extensions.Logging; using Squidex.Infrastructure.States; using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Infrastructure.EventSourcing.Consume; diff --git a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/Consume/EventConsumerStateTests.cs b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/Consume/EventConsumerStateTests.cs index ffe31f1cb..0d6bf472b 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/Consume/EventConsumerStateTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/Consume/EventConsumerStateTests.cs @@ -5,9 +5,7 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Infrastructure.EventSourcing.Consume; diff --git a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/Consume/EventConsumerWorkerTests.cs b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/Consume/EventConsumerWorkerTests.cs index bff776ee4..57f0a4577 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/Consume/EventConsumerWorkerTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/Consume/EventConsumerWorkerTests.cs @@ -5,9 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; -using Xunit; - namespace Squidex.Infrastructure.EventSourcing.Consume; public class EventConsumerWorkerTests diff --git a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/Consume/MongoEventConsumerProcessorIntegrationTests_Direct.cs b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/Consume/MongoEventConsumerProcessorIntegrationTests_Direct.cs index 8bb4ba620..befc06a1e 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/Consume/MongoEventConsumerProcessorIntegrationTests_Direct.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/Consume/MongoEventConsumerProcessorIntegrationTests_Direct.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using Xunit; - #pragma warning disable SA1300 // Element should begin with upper-case letter namespace Squidex.Infrastructure.EventSourcing.Consume; diff --git a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/DefaultEventFormatterTests.cs b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/DefaultEventFormatterTests.cs index 0376a8599..4780d6f63 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/DefaultEventFormatterTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/DefaultEventFormatterTests.cs @@ -9,13 +9,12 @@ using NodaTime; using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Infrastructure.EventSourcing; public class DefaultEventFormatterTests { - public sealed class MyOldEvent : IEvent, IMigrated + public sealed class MyEventOld : IEvent, IMigrated { public string MyProperty { get; set; } @@ -29,12 +28,12 @@ public class DefaultEventFormatterTests public DefaultEventFormatterTests() { - var typeNameRegistry = - new TypeNameRegistry() - .Map(typeof(MyEvent), "Event") - .Map(typeof(MyOldEvent), "OldEvent"); + var typeRegistry = + new TypeRegistry() + .Add("Event") + .Add("OldEvent"); - sut = new DefaultEventFormatter(typeNameRegistry, TestUtils.DefaultSerializer); + sut = new DefaultEventFormatter(typeRegistry, TestUtils.DefaultSerializer); } [Fact] @@ -63,7 +62,7 @@ public class DefaultEventFormatterTests [Fact] public void Should_migrate_event_serializing() { - var inputEvent = new Envelope(new MyOldEvent { MyProperty = "My-Property" }); + var inputEvent = new Envelope(new MyEventOld { MyProperty = "My-Property" }); var eventData = sut.ToEventData(inputEvent, Guid.NewGuid()); var eventStored = new StoredEvent("stream", "0", -1, eventData); @@ -76,7 +75,7 @@ public class DefaultEventFormatterTests [Fact] public void Should_migrate_event_deserializing() { - var inputEvent = new Envelope(new MyOldEvent { MyProperty = "My-Property" }); + var inputEvent = new Envelope(new MyEventOld { MyProperty = "My-Property" }); var eventData = sut.ToEventData(inputEvent, Guid.NewGuid(), false); var eventStored = new StoredEvent("stream", "0", -1, eventData); diff --git a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/EnvelopeExtensionsTests.cs b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/EnvelopeExtensionsTests.cs index d0b8bff1e..0a15a2a36 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/EnvelopeExtensionsTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/EnvelopeExtensionsTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using NodaTime; -using Xunit; namespace Squidex.Infrastructure.EventSourcing; diff --git a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/EnvelopeHeadersTests.cs b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/EnvelopeHeadersTests.cs index 9b270bbe3..dc482e0c3 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/EnvelopeHeadersTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/EnvelopeHeadersTests.cs @@ -7,7 +7,6 @@ using Squidex.Infrastructure.Json.Objects; using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Infrastructure.EventSourcing; diff --git a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/EnvelopeTests.cs b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/EnvelopeTests.cs index 2d1965bc0..1f887fb95 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/EnvelopeTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/EnvelopeTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Infrastructure.EventSourcing; diff --git a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/EventStoreTests.cs b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/EventStoreTests.cs index 8e2045109..fe2aa9a6e 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/EventStoreTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/EventStoreTests.cs @@ -6,8 +6,6 @@ // ========================================================================== using System.Globalization; -using FluentAssertions; -using Xunit; namespace Squidex.Infrastructure.EventSourcing; @@ -417,7 +415,7 @@ public abstract class EventStoreTests where T : IEventStore await Task.Delay(1000); } - Assert.Empty(readEvents); + Assert.Empty(readEvents!); } [Fact] @@ -450,7 +448,7 @@ public abstract class EventStoreTests where T : IEventStore await Task.Delay(1000); } - Assert.Empty(readEvents); + Assert.Empty(readEvents!); } private Task> QueryAsync(string streamName, long position = EtagVersion.Any) diff --git a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/GetEventStoreFixture.cs b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/GetEventStoreFixture.cs index 1467f86fe..6a73f9b4a 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/GetEventStoreFixture.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/GetEventStoreFixture.cs @@ -7,7 +7,6 @@ using EventStore.Client; using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Infrastructure.EventSourcing; diff --git a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/GetEventStoreTests.cs b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/GetEventStoreTests.cs index b51a1c0e3..84183440e 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/GetEventStoreTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/GetEventStoreTests.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using Xunit; - #pragma warning disable SA1300 // Element should begin with upper-case letter namespace Squidex.Infrastructure.EventSourcing; diff --git a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/MongoEventStoreFixture.cs b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/MongoEventStoreFixture.cs index 97143486b..c8cd9d78c 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/MongoEventStoreFixture.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/MongoEventStoreFixture.cs @@ -5,11 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using MongoDB.Driver; using Squidex.Infrastructure.MongoDb; using Squidex.Infrastructure.TestHelpers; -using Xunit; #pragma warning disable MA0048 // File name must match type name @@ -47,7 +45,7 @@ public abstract class MongoEventStoreFixture : IAsyncLifetime public sealed class MongoEventStoreDirectFixture : MongoEventStoreFixture { public MongoEventStoreDirectFixture() - : base(TestConfig.Configuration["mongodb:configuration"]) + : base(TestConfig.Configuration["mongodb:configuration"]!) { } } @@ -55,7 +53,7 @@ public sealed class MongoEventStoreDirectFixture : MongoEventStoreFixture public sealed class MongoEventStoreReplicaSetFixture : MongoEventStoreFixture { public MongoEventStoreReplicaSetFixture() - : base(TestConfig.Configuration["mongodb:configurationReplica"]) + : base(TestConfig.Configuration["mongodb:configurationReplica"]!) { } } diff --git a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/MongoEventStoreTests_Direct.cs b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/MongoEventStoreTests_Direct.cs index 5d6d73b58..9a6b6d58a 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/MongoEventStoreTests_Direct.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/MongoEventStoreTests_Direct.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using Xunit; - #pragma warning disable SA1300 // Element should begin with upper-case letter namespace Squidex.Infrastructure.EventSourcing; diff --git a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/MongoEventStoreTests_ReplicaSet.cs b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/MongoEventStoreTests_ReplicaSet.cs index 4458554e2..331fa75c3 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/MongoEventStoreTests_ReplicaSet.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/MongoEventStoreTests_ReplicaSet.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using Xunit; - #pragma warning disable SA1300 // Element should begin with upper-case letter namespace Squidex.Infrastructure.EventSourcing; diff --git a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/MongoParallelInsertTests.cs b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/MongoParallelInsertTests.cs index d3b9e6e56..b921f4b0a 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/MongoParallelInsertTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/MongoParallelInsertTests.cs @@ -5,12 +5,10 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.Logging; using Squidex.Infrastructure.EventSourcing.Consume; using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.TestHelpers; -using Xunit; #pragma warning disable SA1300 // Element should begin with upper-case letter @@ -71,9 +69,9 @@ public sealed class MongoParallelInsertTests : IClassFixture("MyEvent"); - eventFormatter = new DefaultEventFormatter(typeNameRegistry, TestUtils.DefaultSerializer); + eventFormatter = new DefaultEventFormatter(typeRegistry, TestUtils.DefaultSerializer); } [Fact] diff --git a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/PollingSubscriptionTests.cs b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/PollingSubscriptionTests.cs index d6209d4f2..013ecc5ac 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/PollingSubscriptionTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/PollingSubscriptionTests.cs @@ -6,9 +6,6 @@ // ========================================================================== using System.Globalization; -using FakeItEasy; -using FluentAssertions; -using Xunit; namespace Squidex.Infrastructure.EventSourcing; diff --git a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/RetrySubscriptionTests.cs b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/RetrySubscriptionTests.cs index dc1af01a4..9118f2dbf 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/RetrySubscriptionTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/RetrySubscriptionTests.cs @@ -5,9 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; -using Xunit; - namespace Squidex.Infrastructure.EventSourcing; public class RetrySubscriptionTests diff --git a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/WrongEventVersionExceptionTests.cs b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/WrongEventVersionExceptionTests.cs index fc647a21d..1bc88a409 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/WrongEventVersionExceptionTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/EventSourcing/WrongEventVersionExceptionTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Infrastructure.EventSourcing; diff --git a/backend/tests/Squidex.Infrastructure.Tests/FileExtensionsTests.cs b/backend/tests/Squidex.Infrastructure.Tests/FileExtensionsTests.cs index 7402ef9f4..2f41d7788 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/FileExtensionsTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/FileExtensionsTests.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using Xunit; - namespace Squidex.Infrastructure; public class FileExtensionsTests diff --git a/backend/tests/Squidex.Infrastructure.Tests/GravatarHelperTests.cs b/backend/tests/Squidex.Infrastructure.Tests/GravatarHelperTests.cs index 2e29b75fb..56d6d44b5 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/GravatarHelperTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/GravatarHelperTests.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using Xunit; - namespace Squidex.Infrastructure; public class GravatarHelperTests diff --git a/backend/tests/Squidex.Infrastructure.Tests/GuardTests.cs b/backend/tests/Squidex.Infrastructure.Tests/GuardTests.cs index 04cd0ad00..1a3bae701 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/GuardTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/GuardTests.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using Xunit; - namespace Squidex.Infrastructure; public class GuardTests diff --git a/backend/tests/Squidex.Infrastructure.Tests/Http/DumpFormatterTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Http/DumpFormatterTests.cs index f5e835fa0..8321ba657 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Http/DumpFormatterTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Http/DumpFormatterTests.cs @@ -8,7 +8,6 @@ using System.Net; using System.Net.Http.Headers; using System.Text; -using Xunit; #pragma warning disable SA1122 // Use string.Empty for empty strings diff --git a/backend/tests/Squidex.Infrastructure.Tests/InstantExtensions.cs b/backend/tests/Squidex.Infrastructure.Tests/InstantExtensions.cs index 40aca201f..9204105f1 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/InstantExtensions.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/InstantExtensions.cs @@ -6,7 +6,6 @@ // ========================================================================== using NodaTime; -using Xunit; namespace Squidex.Infrastructure; diff --git a/backend/tests/Squidex.Infrastructure.Tests/Json/ClaimsPrincipalConverterTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Json/ClaimsPrincipalConverterTests.cs index fd076e814..2f385db85 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Json/ClaimsPrincipalConverterTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Json/ClaimsPrincipalConverterTests.cs @@ -7,7 +7,6 @@ using System.Security.Claims; using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Infrastructure.Json; diff --git a/backend/tests/Squidex.Infrastructure.Tests/Json/InstantConverterTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Json/InstantConverterTests.cs index e0ef57c73..7e02f024a 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Json/InstantConverterTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Json/InstantConverterTests.cs @@ -7,7 +7,6 @@ using NodaTime; using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Infrastructure.Json; diff --git a/backend/tests/Squidex.Infrastructure.Tests/Json/Objects/JsonObjectTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Json/Objects/JsonObjectTests.cs index 53b86e56d..0caaee6ef 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Json/Objects/JsonObjectTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Json/Objects/JsonObjectTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using NodaTime; -using Xunit; #pragma warning disable xUnit2004 // Do not use equality check to test for boolean conditions diff --git a/backend/tests/Squidex.Infrastructure.Tests/Json/Objects/JsonValuesSerializationTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Json/Objects/JsonValuesSerializationTests.cs index e9bcf8934..f5702f367 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Json/Objects/JsonValuesSerializationTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Json/Objects/JsonValuesSerializationTests.cs @@ -7,7 +7,6 @@ using Squidex.Infrastructure.MongoDb; using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Infrastructure.Json.Objects; @@ -19,7 +18,7 @@ public class JsonValuesSerializationTests Bson } - private static IEnumerable Serializers() + public static IEnumerable Serializers() { yield return new object[] { SerializerMode.Json }; yield return new object[] { SerializerMode.Bson }; diff --git a/backend/tests/Squidex.Infrastructure.Tests/Json/System/JsonInheritanceConverterBaseTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Json/System/JsonInheritanceConverterBaseTests.cs deleted file mode 100644 index 8b8c66444..000000000 --- a/backend/tests/Squidex.Infrastructure.Tests/Json/System/JsonInheritanceConverterBaseTests.cs +++ /dev/null @@ -1,101 +0,0 @@ -// ========================================================================== -// Squidex Headless CMS -// ========================================================================== -// Copyright (c) Squidex UG (haftungsbeschraenkt) -// All rights reserved. Licensed under the MIT license. -// ========================================================================== - -using Squidex.Infrastructure.TestHelpers; -using Xunit; - -namespace Squidex.Infrastructure.Json.System; - -public class JsonInheritanceConverterBaseTests -{ - private record Base; - - private record A : Base - { - public int PropertyA { get; init; } - } - - private record B : Base - { - public int PropertyB { get; init; } - } - - private sealed class Converter : InheritanceConverterBase - { - public Converter() - : base("$type") - { - } - - public override Type GetDiscriminatorType(string name, Type typeToConvert) - { - return name == "A" ? typeof(A) : typeof(B); - } - - public override string GetDiscriminatorValue(Type type) - { - return type == typeof(A) ? "A" : "B"; - } - } - - [Fact] - public void Should_serialize_and_deserialize() - { - var serializer = CreateSerializer(); - - Base source = new A - { - PropertyA = 42 - }; - - var serialized = serializer.Deserialize(serializer.Serialize(source)); - - Assert.Equal(new A { PropertyA = 42 }, serialized); - } - - [Fact] - public void Should_deserialize_when_discriminiator_is_first_property() - { - var serializer = CreateSerializer(); - - var source = new Dictionary - { - ["$type"] = "A", - ["propertyA"] = 42, - ["propertyOther"] = 44 - }; - - var serialized = serializer.Deserialize(serializer.Serialize(source)); - - Assert.Equal(new A { PropertyA = 42 }, serialized); - } - - [Fact] - public void Should_deserialize_when_discriminiator_is_not_first_property() - { - var serializer = CreateSerializer(); - - var source = new Dictionary - { - ["propertyB"] = 42, - ["propertyOther"] = 44, - ["$type"] = "B" - }; - - var serialized = serializer.Deserialize(serializer.Serialize(source)); - - Assert.Equal(new B { PropertyB = 42 }, serialized); - } - - private static IJsonSerializer CreateSerializer() - { - return TestUtils.CreateSerializer(options => - { - options.Converters.Add(new Converter()); - }); - } -} diff --git a/backend/tests/Squidex.Infrastructure.Tests/Json/System/JsonInheritanceConverterTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Json/System/PolymorphicConverterTests.cs similarity index 71% rename from backend/tests/Squidex.Infrastructure.Tests/Json/System/JsonInheritanceConverterTests.cs rename to backend/tests/Squidex.Infrastructure.Tests/Json/System/PolymorphicConverterTests.cs index d97555a84..a39194b5c 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Json/System/JsonInheritanceConverterTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Json/System/PolymorphicConverterTests.cs @@ -7,11 +7,10 @@ using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Infrastructure.Json.System; -public class JsonInheritanceConverterTests +public class PolymorphicConverterTests { private record Base; @@ -45,6 +44,23 @@ public class JsonInheritanceConverterTests { var serializer = CreateSerializer(); + var source = new Dictionary + { + ["$baseType"] = "A", + ["propertyA"] = 42, + ["propertyOther"] = 44 + }; + + var serialized = serializer.Deserialize(serializer.Serialize(source)); + + Assert.Equal(new A { PropertyA = 42 }, serialized); + } + + [Fact] + public void Should_deserialize_when_discriminiator_is_default() + { + var serializer = CreateSerializer(); + var source = new Dictionary { ["$type"] = "A", @@ -66,7 +82,7 @@ public class JsonInheritanceConverterTests { ["propertyB"] = 42, ["propertyOther"] = 44, - ["$type"] = "B" + ["$baseType"] = "B" }; var serialized = serializer.Deserialize(serializer.Serialize(source)); @@ -79,11 +95,13 @@ public class JsonInheritanceConverterTests return TestUtils.CreateSerializer(options => { var typeRegistry = - new TypeNameRegistry() - .Map(typeof(A), "A") - .Map(typeof(B), "B"); + new TypeRegistry() + .Discriminator("$baseType") + .Add("A") + .Add("B"); - options.Converters.Add(new InheritanceConverter(typeRegistry)); + options.TypeInfoResolver = new PolymorphicTypeResolver(typeRegistry); + options.Converters.Add(new PolymorphicConverter(typeRegistry)); }); } } diff --git a/backend/tests/Squidex.Infrastructure.Tests/Json/System/ReadOnlyCollectionTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Json/System/ReadOnlyCollectionTests.cs index c9068b8e2..afccda8cd 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Json/System/ReadOnlyCollectionTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Json/System/ReadOnlyCollectionTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Infrastructure.Json.System; diff --git a/backend/tests/Squidex.Infrastructure.Tests/LanguageTests.cs b/backend/tests/Squidex.Infrastructure.Tests/LanguageTests.cs index f7908650a..b1db8aa8e 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/LanguageTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/LanguageTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Infrastructure; diff --git a/backend/tests/Squidex.Infrastructure.Tests/LanguagesInitializerTests.cs b/backend/tests/Squidex.Infrastructure.Tests/LanguagesInitializerTests.cs index 096f7909f..5a4a3194b 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/LanguagesInitializerTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/LanguagesInitializerTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using Microsoft.Extensions.Options; -using Xunit; namespace Squidex.Infrastructure; diff --git a/backend/tests/Squidex.Infrastructure.Tests/Log/BackgroundRequestLogStoreTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Log/BackgroundRequestLogStoreTests.cs index 16d80146e..e2905f6d4 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Log/BackgroundRequestLogStoreTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Log/BackgroundRequestLogStoreTests.cs @@ -6,10 +6,8 @@ // ========================================================================== using System.Globalization; -using FakeItEasy; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -using Xunit; namespace Squidex.Infrastructure.Log; diff --git a/backend/tests/Squidex.Infrastructure.Tests/Migrations/MigratorTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Migrations/MigratorTests.cs index a2b07cdc0..44d4ca71b 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Migrations/MigratorTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Migrations/MigratorTests.cs @@ -5,9 +5,7 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.Logging; -using Xunit; namespace Squidex.Infrastructure.Migrations; diff --git a/backend/tests/Squidex.Infrastructure.Tests/MongoDb/BsonJsonSerializerTests.cs b/backend/tests/Squidex.Infrastructure.Tests/MongoDb/BsonJsonSerializerTests.cs index 999d7bb57..5e7d5c5fe 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/MongoDb/BsonJsonSerializerTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/MongoDb/BsonJsonSerializerTests.cs @@ -5,11 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using MongoDB.Bson; using MongoDB.Bson.Serialization.Attributes; using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Infrastructure.MongoDb; diff --git a/backend/tests/Squidex.Infrastructure.Tests/MongoDb/DomainIdSerializerTests.cs b/backend/tests/Squidex.Infrastructure.Tests/MongoDb/DomainIdSerializerTests.cs index 7b73a479f..903216b52 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/MongoDb/DomainIdSerializerTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/MongoDb/DomainIdSerializerTests.cs @@ -10,7 +10,6 @@ using MongoDB.Bson.IO; using MongoDB.Bson.Serialization; using MongoDB.Bson.Serialization.Attributes; using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Infrastructure.MongoDb; diff --git a/backend/tests/Squidex.Infrastructure.Tests/MongoDb/InstantSerializerTests.cs b/backend/tests/Squidex.Infrastructure.Tests/MongoDb/InstantSerializerTests.cs index ddea5bd07..719378406 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/MongoDb/InstantSerializerTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/MongoDb/InstantSerializerTests.cs @@ -7,7 +7,6 @@ using NodaTime; using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Infrastructure.MongoDb; diff --git a/backend/tests/Squidex.Infrastructure.Tests/MongoDb/MongoFieldTests.cs b/backend/tests/Squidex.Infrastructure.Tests/MongoDb/MongoFieldTests.cs index 06e0094fc..74fbf6737 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/MongoDb/MongoFieldTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/MongoDb/MongoFieldTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using MongoDB.Bson.Serialization.Attributes; -using Xunit; namespace Squidex.Infrastructure.MongoDb; diff --git a/backend/tests/Squidex.Infrastructure.Tests/MongoDb/MongoQueryTests.cs b/backend/tests/Squidex.Infrastructure.Tests/MongoDb/MongoQueryTests.cs index 2707628a6..55f704fc7 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/MongoDb/MongoQueryTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/MongoDb/MongoQueryTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using MongoDB.Bson.Serialization; using MongoDB.Driver; using NodaTime; @@ -13,7 +12,6 @@ using NodaTime.Text; using Squidex.Infrastructure.MongoDb.Queries; using Squidex.Infrastructure.Queries; using Squidex.Infrastructure.TestHelpers; -using Xunit; using ClrFilter = Squidex.Infrastructure.Queries.ClrFilter; using SortBuilder = Squidex.Infrastructure.Queries.SortBuilder; diff --git a/backend/tests/Squidex.Infrastructure.Tests/MongoDb/TypeConverterStringSerializerTests.cs b/backend/tests/Squidex.Infrastructure.Tests/MongoDb/TypeConverterStringSerializerTests.cs index 69a949e39..15df83652 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/MongoDb/TypeConverterStringSerializerTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/MongoDb/TypeConverterStringSerializerTests.cs @@ -7,7 +7,6 @@ using MongoDB.Bson.IO; using MongoDB.Bson.Serialization; -using Xunit; namespace Squidex.Infrastructure.MongoDb; diff --git a/backend/tests/Squidex.Infrastructure.Tests/NamedIdTests.cs b/backend/tests/Squidex.Infrastructure.Tests/NamedIdTests.cs index 0b952faeb..7a193627b 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/NamedIdTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/NamedIdTests.cs @@ -8,7 +8,7 @@ using System.Text.Json.Serialization; using Squidex.Infrastructure.Json.System; using Squidex.Infrastructure.TestHelpers; -using Xunit; +using static Squidex.Infrastructure.Json.Objects.JsonValuesSerializationTests; namespace Squidex.Infrastructure; @@ -20,6 +20,24 @@ public class NamedIdTests public NamedId Value { get; set; } } + public static IEnumerable Serializers() + { + yield return new object[] { SerializerMode.Json }; + yield return new object[] { SerializerMode.Bson }; + } + + private static T Serialize(T input, SerializerMode mode) + { + if (mode == SerializerMode.Bson) + { + return input.SerializeAndDeserializeBson(); + } + else + { + return input.SerializeAndDeserialize(); + } + } + [Fact] public void Should_instantiate_token() { @@ -41,82 +59,90 @@ public class NamedIdTests Assert.Equal($"{id},my-name", namedId.ToString()); } - [Fact] - public void Should_serialize_and_deserialize_null_guid_token() + [Theory] + [MemberData(nameof(Serializers))] + public void Should_serialize_and_deserialize_null_guid_token(SerializerMode mode) { NamedId? value = null; - var serialized = value.SerializeAndDeserialize(); + var serialized = Serialize(value, mode); Assert.Equal(value, serialized); } - [Fact] - public void Should_serialize_and_deserialize_valid_guid_token() + [Theory] + [MemberData(nameof(Serializers))] + public void Should_serialize_and_deserialize_valid_guid_token(SerializerMode mode) { var value = NamedId.Of(Guid.NewGuid(), "my-name"); - var serialized = value.SerializeAndDeserialize(); + var serialized = Serialize(value, mode); Assert.Equal(value, serialized); } - [Fact] - public void Should_serialize_and_deserialize_null_long_token() + [Theory] + [MemberData(nameof(Serializers))] + public void Should_serialize_and_deserialize_null_long_token(SerializerMode mode) { NamedId? value = null; - var serialized = value.SerializeAndDeserialize(); + var serialized = Serialize(value, mode); Assert.Equal(value, serialized); } - [Fact] - public void Should_serialize_and_deserialize_valid_long_token() + [Theory] + [MemberData(nameof(Serializers))] + public void Should_serialize_and_deserialize_valid_long_token(SerializerMode mode) { var value = NamedId.Of(123L, "my-name"); - var serialized = value.SerializeAndDeserialize(); + var serialized = Serialize(value, mode); Assert.Equal(value, serialized); } - [Fact] - public void Should_serialize_and_deserialize_null_string_token() + [Theory] + [MemberData(nameof(Serializers))] + public void Should_serialize_and_deserialize_null_string_token(SerializerMode mode) { NamedId? value = null; - var serialized = value.SerializeAndDeserialize(); + var serialized = Serialize(value, mode); Assert.Equal(value, serialized); } - [Fact] - public void Should_serialize_and_deserialize_valid_string_token() + [Theory] + [MemberData(nameof(Serializers))] + public void Should_serialize_and_deserialize_valid_string_token(SerializerMode mode) { var value = NamedId.Of(Guid.NewGuid().ToString(), "my-name"); - var serialized = value.SerializeAndDeserialize(); + var serialized = Serialize(value, mode); Assert.Equal(value, serialized); } - [Fact] - public void Should_serialize_and_deserialize_null_id_token() + [Theory] + [MemberData(nameof(Serializers))] + public void Should_serialize_and_deserialize_null_id_token(SerializerMode mode) { NamedId? value = null; - var serialized = value.SerializeAndDeserialize(); + var serialized = Serialize(value, mode); Assert.Equal(value, serialized); } - [Fact] - public void Should_serialize_and_deserialize_valid_id_token() + [Theory] + [MemberData(nameof(Serializers))] + public void Should_serialize_and_deserialize_valid_id_token(SerializerMode mode) { var value = NamedId.Of(DomainId.NewGuid().ToString(), "my-name"); - var serialized = value.SerializeAndDeserialize(); + var serialized = Serialize(value, mode); Assert.Equal(value, serialized); } diff --git a/backend/tests/Squidex.Infrastructure.Tests/Net/IPAddressComparerTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Net/IPAddressComparerTests.cs index fa40123b7..d125f5519 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Net/IPAddressComparerTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Net/IPAddressComparerTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using System.Net; -using Xunit; namespace Squidex.Infrastructure.Net; diff --git a/backend/tests/Squidex.Infrastructure.Tests/Queries/FilterSchemaTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Queries/FilterSchemaTests.cs index 175bb2c61..06afd2bf8 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Queries/FilterSchemaTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Queries/FilterSchemaTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using Squidex.Infrastructure.Collections; -using Xunit; namespace Squidex.Infrastructure.Queries; diff --git a/backend/tests/Squidex.Infrastructure.Tests/Queries/PascalCasePathConverterTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Queries/PascalCasePathConverterTests.cs index d628e0a36..3b3f877cc 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Queries/PascalCasePathConverterTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Queries/PascalCasePathConverterTests.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using Xunit; - namespace Squidex.Infrastructure.Queries; public class PascalCasePathConverterTests diff --git a/backend/tests/Squidex.Infrastructure.Tests/Queries/PropertyPathTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Queries/PropertyPathTests.cs index a94a93bd6..93e07dd63 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Queries/PropertyPathTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Queries/PropertyPathTests.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using Xunit; - namespace Squidex.Infrastructure.Queries; public class PropertyPathTests diff --git a/backend/tests/Squidex.Infrastructure.Tests/Queries/QueryFromJsonTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Queries/QueryFromJsonTests.cs index c474b227f..f15a22380 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Queries/QueryFromJsonTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Queries/QueryFromJsonTests.cs @@ -10,7 +10,6 @@ using Squidex.Infrastructure.Json.Objects; using Squidex.Infrastructure.Queries.Json; using Squidex.Infrastructure.TestHelpers; using Squidex.Infrastructure.Validation; -using Xunit; namespace Squidex.Infrastructure.Queries; diff --git a/backend/tests/Squidex.Infrastructure.Tests/Queries/QueryFromODataTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Queries/QueryFromODataTests.cs index dc7ae9e1d..27c7cca25 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Queries/QueryFromODataTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Queries/QueryFromODataTests.cs @@ -8,7 +8,6 @@ using Microsoft.OData.Edm; using Squidex.Infrastructure.Collections; using Squidex.Infrastructure.Queries.OData; -using Xunit; #pragma warning disable SA1300 // Element should begin with upper-case letter #pragma warning disable IDE1006 // Naming Styles diff --git a/backend/tests/Squidex.Infrastructure.Tests/Queries/QueryJsonTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Queries/QueryJsonTests.cs index 7278493ed..94ba74e5a 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Queries/QueryJsonTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Queries/QueryJsonTests.cs @@ -8,7 +8,6 @@ using Squidex.Infrastructure.Json; using Squidex.Infrastructure.Json.Objects; using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Infrastructure.Queries; diff --git a/backend/tests/Squidex.Infrastructure.Tests/Queries/QueryOptimizationTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Queries/QueryOptimizationTests.cs index 3c3709bd7..496590639 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Queries/QueryOptimizationTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Queries/QueryOptimizationTests.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using Xunit; - namespace Squidex.Infrastructure.Queries; public class QueryOptimizationTests diff --git a/backend/tests/Squidex.Infrastructure.Tests/Queries/QueryTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Queries/QueryTests.cs index ebd3dff13..05ce64301 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Queries/QueryTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Queries/QueryTests.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using Xunit; - namespace Squidex.Infrastructure.Queries; public class QueryTests diff --git a/backend/tests/Squidex.Infrastructure.Tests/RandomHashTests.cs b/backend/tests/Squidex.Infrastructure.Tests/RandomHashTests.cs index 35fdc86e8..f2b4a67cb 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/RandomHashTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/RandomHashTests.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using Xunit; - namespace Squidex.Infrastructure; public class RandomHashTests diff --git a/backend/tests/Squidex.Infrastructure.Tests/RefTokenTests.cs b/backend/tests/Squidex.Infrastructure.Tests/RefTokenTests.cs index 88d75b27e..a5e25eee0 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/RefTokenTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/RefTokenTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Infrastructure; diff --git a/backend/tests/Squidex.Infrastructure.Tests/Reflection/PropertiesTypeAccessorTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Reflection/PropertiesTypeAccessorTests.cs index e1d94f97f..b63d53b82 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Reflection/PropertiesTypeAccessorTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Reflection/PropertiesTypeAccessorTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using Squidex.Infrastructure.Reflection.Internal; -using Xunit; namespace Squidex.Infrastructure.Reflection; diff --git a/backend/tests/Squidex.Infrastructure.Tests/Reflection/ReflectionExtensionTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Reflection/ReflectionExtensionTests.cs index aa97177e3..ffc39e4f1 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Reflection/ReflectionExtensionTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Reflection/ReflectionExtensionTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using Squidex.Infrastructure.Reflection.Internal; -using Xunit; namespace Squidex.Infrastructure.Reflection; diff --git a/backend/tests/Squidex.Infrastructure.Tests/Reflection/SimpleMapperTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Reflection/SimpleMapperTests.cs index def3bb485..15e00d853 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Reflection/SimpleMapperTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Reflection/SimpleMapperTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using System.Diagnostics; -using Xunit; namespace Squidex.Infrastructure.Reflection; diff --git a/backend/tests/Squidex.Infrastructure.Tests/TypeNameAttributeTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Reflection/TypeNameAttributeTests.cs similarity index 86% rename from backend/tests/Squidex.Infrastructure.Tests/TypeNameAttributeTests.cs rename to backend/tests/Squidex.Infrastructure.Tests/Reflection/TypeNameAttributeTests.cs index f9cec7332..38de26236 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/TypeNameAttributeTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Reflection/TypeNameAttributeTests.cs @@ -5,10 +5,7 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using Squidex.Infrastructure.Reflection; -using Xunit; - -namespace Squidex.Infrastructure; +namespace Squidex.Infrastructure.Reflection; public class TypeNameAttributeTests { diff --git a/backend/tests/Squidex.Infrastructure.Tests/Reflection/TypeRegistryTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Reflection/TypeRegistryTests.cs new file mode 100644 index 000000000..deb0caf05 --- /dev/null +++ b/backend/tests/Squidex.Infrastructure.Tests/Reflection/TypeRegistryTests.cs @@ -0,0 +1,135 @@ +// ========================================================================== +// Squidex Headless CMS +// ========================================================================== +// Copyright (c) Squidex UG (haftungsbeschraenkt) +// All rights reserved. Licensed under the MIT license. +// ========================================================================== + +using Squidex.Infrastructure.EventSourcing; + +namespace Squidex.Infrastructure.Reflection; + +public class TypeRegistryTests +{ + private readonly TypeRegistry sut = new TypeRegistry(); + + public abstract class Base + { + } + + public sealed class DerivedBase : Base + { + } + + public sealed class DerivedCustom : Base + { + } + + [TypeName("my")] + public sealed class DerivedAttribute : Base + { + } + + [EventType(nameof(DerivedEvent), 2)] + public sealed class DerivedEvent : Base + { + } + + [Fact] + public void Should_call_provider_from_constructor() + { + var provider = A.Fake(); + + var registry = new TypeRegistry(Enumerable.Repeat(provider, 1)); + + A.CallTo(() => provider.Map(registry)) + .MustHaveHappened(); + } + + [Fact] + public void Should_call_provider() + { + var provider = A.Fake(); + + sut.Map(provider); + + A.CallTo(() => provider.Map(sut)) + .MustHaveHappened(); + } + + [Fact] + public void Should_register_and_resolve_name() + { + sut.Add("My"); + + sut.TryGetName(typeof(DerivedAttribute), out var name); + + Assert.Equal("My", name); + Assert.Equal("My", sut.GetName()); + } + + [Fact] + public void Should_register_and_resolve_type() + { + sut.Add(typeof(DerivedAttribute), "My"); + + sut.TryGetType("My", out var type); + + Assert.Equal(typeof(DerivedAttribute), type); + Assert.Equal(typeof(DerivedAttribute), sut.GetType("My")); + } + + [Fact] + public void Should_register_with_provider_from_assembly_and_inherited_name() + { + sut.Map(new AssemblyTypeProvider()); + + sut.TryGetType("Derived", out var type); + + Assert.Equal(typeof(DerivedBase), type); + Assert.Equal(typeof(DerivedBase), sut.GetType("Derived")); + } + + [Fact] + public void Should_register_with_provider_from_assembly_and_custom_name() + { + sut.Map(new AssemblyTypeProvider()); + + sut.TryGetType("DerivedCustom", out var type); + + Assert.Equal(typeof(DerivedCustom), type); + Assert.Equal(typeof(DerivedCustom), sut.GetType("DerivedCustom")); + } + + [Fact] + public void Should_register_with_provider_from_assembly_and_event_name() + { + sut.Map(new AssemblyTypeProvider()); + + sut.TryGetType("DerivedEventV2", out var type); + + Assert.Equal(typeof(DerivedEvent), type); + Assert.Equal(typeof(DerivedEvent), sut.GetType("DerivedEventV2")); + } + + [Fact] + public void Should_throw_exception_if_type_name_not_found() + { + Assert.Throws(() => sut.GetName(typeof(DerivedCustom))); + } + + [Fact] + public void Should_throw_exception_if_type_not_found() + { + Assert.Throws(() => sut.GetType("DerivedCustom")); + } + + [Fact] + public void Should_register_in_parallel() + { + Parallel.ForEach(Enumerable.Range(0, 100), x => + { + sut.Add("My"); + }); + } +} diff --git a/backend/tests/Squidex.Infrastructure.Tests/RetryWindowTests.cs b/backend/tests/Squidex.Infrastructure.Tests/RetryWindowTests.cs index 7a9857e67..c05f8e3dc 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/RetryWindowTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/RetryWindowTests.cs @@ -5,9 +5,7 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using NodaTime; -using Xunit; namespace Squidex.Infrastructure; diff --git a/backend/tests/Squidex.Infrastructure.Tests/Security/ExtensionsTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Security/ExtensionsTests.cs index 885c328f2..a672a6052 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Security/ExtensionsTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Security/ExtensionsTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using System.Security.Claims; -using Xunit; namespace Squidex.Infrastructure.Security; diff --git a/backend/tests/Squidex.Infrastructure.Tests/Security/PermissionSetTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Security/PermissionSetTests.cs index 8cd1cdf02..add40d8be 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Security/PermissionSetTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Security/PermissionSetTests.cs @@ -7,7 +7,6 @@ using System.Collections; using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Infrastructure.Security; diff --git a/backend/tests/Squidex.Infrastructure.Tests/Security/PermissionTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Security/PermissionTests.cs index cf4f057bb..269f2c251 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Security/PermissionTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Security/PermissionTests.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using Xunit; - namespace Squidex.Infrastructure.Security; public class PermissionTests diff --git a/backend/tests/Squidex.Infrastructure.Tests/Squidex.Infrastructure.Tests.csproj b/backend/tests/Squidex.Infrastructure.Tests/Squidex.Infrastructure.Tests.csproj index 2297a7618..a02bc8405 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Squidex.Infrastructure.Tests.csproj +++ b/backend/tests/Squidex.Infrastructure.Tests/Squidex.Infrastructure.Tests.csproj @@ -1,7 +1,7 @@  Exe - net6.0 + net7.0 Squidex.Infrastructure 10.0 enable @@ -15,22 +15,27 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + - + all runtime; build; native; contentfiles; analyzers + + + + + diff --git a/backend/tests/Squidex.Infrastructure.Tests/States/DefaultEventStreamNamesTests.cs b/backend/tests/Squidex.Infrastructure.Tests/States/DefaultEventStreamNamesTests.cs index ca22b677e..f8f89504b 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/States/DefaultEventStreamNamesTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/States/DefaultEventStreamNamesTests.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using Xunit; - namespace Squidex.Infrastructure.States; public class DefaultEventStreamNamesTests diff --git a/backend/tests/Squidex.Infrastructure.Tests/States/InconsistentStateExceptionTests.cs b/backend/tests/Squidex.Infrastructure.Tests/States/InconsistentStateExceptionTests.cs index 5204d30d7..1bf72ebc9 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/States/InconsistentStateExceptionTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/States/InconsistentStateExceptionTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Infrastructure.States; diff --git a/backend/tests/Squidex.Infrastructure.Tests/States/PersistenceBatchTests.cs b/backend/tests/Squidex.Infrastructure.Tests/States/PersistenceBatchTests.cs index 9d0cb23dc..bbebf7178 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/States/PersistenceBatchTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/States/PersistenceBatchTests.cs @@ -6,10 +6,8 @@ // ========================================================================== using System.Globalization; -using FakeItEasy; using Squidex.Infrastructure.EventSourcing; using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Infrastructure.States; diff --git a/backend/tests/Squidex.Infrastructure.Tests/States/PersistenceEventSourcingTests.cs b/backend/tests/Squidex.Infrastructure.Tests/States/PersistenceEventSourcingTests.cs index 476e490e6..fe1eced7a 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/States/PersistenceEventSourcingTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/States/PersistenceEventSourcingTests.cs @@ -6,10 +6,8 @@ // ========================================================================== using System.Globalization; -using FakeItEasy; using Squidex.Infrastructure.EventSourcing; using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Infrastructure.States; diff --git a/backend/tests/Squidex.Infrastructure.Tests/States/PersistenceSnapshotTests.cs b/backend/tests/Squidex.Infrastructure.Tests/States/PersistenceSnapshotTests.cs index e2e04a384..64e634bfe 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/States/PersistenceSnapshotTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/States/PersistenceSnapshotTests.cs @@ -5,9 +5,7 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Infrastructure.EventSourcing; -using Xunit; namespace Squidex.Infrastructure.States; diff --git a/backend/tests/Squidex.Infrastructure.Tests/States/SimpleStateTests.cs b/backend/tests/Squidex.Infrastructure.Tests/States/SimpleStateTests.cs index 39e648068..d91fdd32c 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/States/SimpleStateTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/States/SimpleStateTests.cs @@ -5,10 +5,8 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using NodaTime; using Squidex.Infrastructure.TestHelpers; -using Xunit; namespace Squidex.Infrastructure.States; diff --git a/backend/tests/Squidex.Infrastructure.Tests/StringExtensionsTests.cs b/backend/tests/Squidex.Infrastructure.Tests/StringExtensionsTests.cs index 82563ee5e..695da8cea 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/StringExtensionsTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/StringExtensionsTests.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using Xunit; - namespace Squidex.Infrastructure; public class StringExtensionsTests diff --git a/backend/tests/Squidex.Infrastructure.Tests/TaskExtensionsTests.cs b/backend/tests/Squidex.Infrastructure.Tests/TaskExtensionsTests.cs index 9bc9088a4..347ebcd76 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/TaskExtensionsTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/TaskExtensionsTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using Squidex.Infrastructure.Tasks; -using Xunit; namespace Squidex.Infrastructure; diff --git a/backend/tests/Squidex.Infrastructure.Tests/Tasks/PartitionedActionBlockTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Tasks/PartitionedActionBlockTests.cs index 063c4a100..1e01c432a 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Tasks/PartitionedActionBlockTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Tasks/PartitionedActionBlockTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using System.Threading.Tasks.Dataflow; -using Xunit; namespace Squidex.Infrastructure.Tasks; diff --git a/backend/tests/Squidex.Infrastructure.Tests/Tasks/SchedulerTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Tasks/SchedulerTests.cs index aa8c22e13..b11f25eb0 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Tasks/SchedulerTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Tasks/SchedulerTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using System.Collections.Concurrent; -using Xunit; namespace Squidex.Infrastructure.Tasks; diff --git a/backend/tests/Squidex.Infrastructure.Tests/TestHelpers/MyDomainObject.cs b/backend/tests/Squidex.Infrastructure.Tests/TestHelpers/MyDomainObject.cs index c3552895a..65be0c115 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/TestHelpers/MyDomainObject.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/TestHelpers/MyDomainObject.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.Logging; using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.EventSourcing; diff --git a/backend/tests/Squidex.Infrastructure.Tests/TestHelpers/TestState.cs b/backend/tests/Squidex.Infrastructure.Tests/TestHelpers/TestState.cs index aeb2fb53c..493bd810e 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/TestHelpers/TestState.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/TestHelpers/TestState.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Infrastructure.EventSourcing; using Squidex.Infrastructure.States; diff --git a/backend/tests/Squidex.Infrastructure.Tests/TestHelpers/TestUtils.cs b/backend/tests/Squidex.Infrastructure.Tests/TestHelpers/TestUtils.cs index c1e191ad1..f3f367734 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/TestHelpers/TestUtils.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/TestHelpers/TestUtils.cs @@ -64,9 +64,10 @@ public static class TestUtils { var options = new JsonSerializerOptions(JsonSerializerDefaults.Web); - options.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb); // It is also a readonly list, so we have to register it first, so that other converters do not pick this up. options.Converters.Add(new StringConverter(x => x)); + + options.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb); options.Converters.Add(new JsonValueConverter()); options.Converters.Add(new ReadonlyDictionaryConverterFactory()); options.Converters.Add(new ReadonlyListConverterFactory()); diff --git a/backend/tests/Squidex.Infrastructure.Tests/Timers/CompletionTimerTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Timers/CompletionTimerTests.cs index 185cdd70a..3e0bbc9d4 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Timers/CompletionTimerTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Timers/CompletionTimerTests.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using Xunit; - namespace Squidex.Infrastructure.Timers; public class CompletionTimerTests diff --git a/backend/tests/Squidex.Infrastructure.Tests/Translations/TTests.cs b/backend/tests/Squidex.Infrastructure.Tests/Translations/TTests.cs index 4e3f155c3..7c82ddc17 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/Translations/TTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/Translations/TTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using System.Globalization; -using Xunit; namespace Squidex.Infrastructure.Translations; diff --git a/backend/tests/Squidex.Infrastructure.Tests/TypeNameRegistryTests.cs b/backend/tests/Squidex.Infrastructure.Tests/TypeNameRegistryTests.cs deleted file mode 100644 index c53b5f108..000000000 --- a/backend/tests/Squidex.Infrastructure.Tests/TypeNameRegistryTests.cs +++ /dev/null @@ -1,175 +0,0 @@ -// ========================================================================== -// Squidex Headless CMS -// ========================================================================== -// Copyright (c) Squidex UG (haftungsbeschraenkt) -// All rights reserved. Licensed under the MIT license. -// ========================================================================== - -using FakeItEasy; -using Squidex.Infrastructure.EventSourcing; -using Squidex.Infrastructure.Reflection; -using Xunit; - -namespace Squidex.Infrastructure; - -public class TypeNameRegistryTests -{ - private readonly TypeNameRegistry sut = new TypeNameRegistry(); - - [TypeName("my")] - public sealed class MyType - { - } - - [EventType(nameof(MyAdded), 2)] - public sealed class MyAdded - { - } - - [Fact] - public void Should_call_provider_from_constructor() - { - var provider = A.Fake(); - - var registry = new TypeNameRegistry(Enumerable.Repeat(provider, 1)); - - A.CallTo(() => provider.Map(registry)) - .MustHaveHappened(); - } - - [Fact] - public void Should_call_provider() - { - var provider = A.Fake(); - - sut.Map(provider); - - A.CallTo(() => provider.Map(sut)) - .MustHaveHappened(); - } - - [Fact] - public void Should_register_and_retrieve_types() - { - sut.Map(typeof(int), "NumberField"); - - Assert.Equal("NumberField", sut.GetName()); - Assert.Equal("NumberField", sut.GetName(typeof(int))); - - Assert.Equal(typeof(int), sut.GetType("NumberField")); - Assert.Equal(typeof(int), sut.GetType("NumberField")); - } - - [Fact] - public void Should_register_from_attribute() - { - sut.Map(typeof(MyType)); - - Assert.Equal("my", sut.GetName()); - Assert.Equal("my", sut.GetName(typeof(MyType))); - - Assert.Equal(typeof(MyType), sut.GetType("my")); - Assert.Equal(typeof(MyType), sut.GetType("My")); - } - - [Fact] - public void Should_register_with_provider_from_assembly() - { - sut.Map(new AutoAssembyTypeProvider()); - - Assert.Equal("my", sut.GetName()); - Assert.Equal("my", sut.GetName(typeof(MyType))); - - Assert.Equal(typeof(MyType), sut.GetType("my")); - Assert.Equal(typeof(MyType), sut.GetType("My")); - } - - [Fact] - public void Should_register_from_assembly() - { - sut.MapUnmapped(typeof(TypeNameRegistryTests).Assembly); - - Assert.Equal("my", sut.GetName()); - Assert.Equal("my", sut.GetName(typeof(MyType))); - - Assert.Equal(typeof(MyType), sut.GetType("my")); - Assert.Equal(typeof(MyType), sut.GetType("My")); - } - - [Fact] - public void Should_register_event_type_from_assembly() - { - sut.MapUnmapped(typeof(TypeNameRegistryTests).Assembly); - - Assert.Equal("MyAddedEventV2", sut.GetName()); - Assert.Equal("MyAddedEventV2", sut.GetName(typeof(MyAdded))); - - Assert.Equal(typeof(MyAdded), sut.GetType("myAddedEventV2")); - Assert.Equal(typeof(MyAdded), sut.GetType("MyAddedEventV2")); - } - - [Fact] - public void Should_register_fallback_name() - { - sut.Map(typeof(MyType)); - sut.MapObsolete(typeof(MyType), "my-old"); - - Assert.Equal(typeof(MyType), sut.GetType("my")); - Assert.Equal(typeof(MyType), sut.GetType("my-old")); - } - - [Fact] - public void Should_not_throw_exception_if_type_is_already_registered_with_same_name() - { - sut.Map(typeof(long), "long"); - sut.Map(typeof(long), "long"); - } - - [Fact] - public void Should_throw_exception_if_type_is_already_registered() - { - sut.Map(typeof(long), "long"); - - Assert.Throws(() => sut.Map(typeof(long), "longer")); - } - - [Fact] - public void Should_throw_exception_if_name_is_already_registered() - { - sut.Map(typeof(short), "short"); - - Assert.Throws(() => sut.Map(typeof(byte), "short")); - } - - [Fact] - public void Should_throw_exception_if_obsolete_name_is_already_registered() - { - sut.MapObsolete(typeof(short), "short2"); - - Assert.Throws(() => sut.MapObsolete(typeof(byte), "short2")); - } - - [Fact] - public void Should_throw_exception_if_name_is_not_supported() - { - Assert.Throws(() => sut.GetType("unsupported")); - } - - [Fact] - public void Should_return_null_if_name_is_not_supported() - { - Assert.Null(sut.GetTypeOrNull("unsupported")); - } - - [Fact] - public void Should_throw_exception_if_type_is_not_supported() - { - Assert.Throws(() => sut.GetName()); - } - - [Fact] - public void Should_return_null_if_type_is_not_supported() - { - Assert.Null(sut.GetNameOrNull()); - } -} diff --git a/backend/tests/Squidex.Infrastructure.Tests/UsageTracking/ApiUsageTrackerTests.cs b/backend/tests/Squidex.Infrastructure.Tests/UsageTracking/ApiUsageTrackerTests.cs index 215959ae5..96f867ce1 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/UsageTracking/ApiUsageTrackerTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/UsageTracking/ApiUsageTrackerTests.cs @@ -5,10 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; -using FluentAssertions; -using Xunit; - namespace Squidex.Infrastructure.UsageTracking; public class ApiUsageTrackerTests diff --git a/backend/tests/Squidex.Infrastructure.Tests/UsageTracking/BackgroundUsageTrackerTests.cs b/backend/tests/Squidex.Infrastructure.Tests/UsageTracking/BackgroundUsageTrackerTests.cs index 5d4d55e49..8471c7d1e 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/UsageTracking/BackgroundUsageTrackerTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/UsageTracking/BackgroundUsageTrackerTests.cs @@ -5,10 +5,7 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; -using FluentAssertions; using Microsoft.Extensions.Logging; -using Xunit; namespace Squidex.Infrastructure.UsageTracking; diff --git a/backend/tests/Squidex.Infrastructure.Tests/UsageTracking/CachingUsageTrackerTests.cs b/backend/tests/Squidex.Infrastructure.Tests/UsageTracking/CachingUsageTrackerTests.cs index f0628c8fb..dcd025481 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/UsageTracking/CachingUsageTrackerTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/UsageTracking/CachingUsageTrackerTests.cs @@ -5,10 +5,8 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Options; -using Xunit; namespace Squidex.Infrastructure.UsageTracking; diff --git a/backend/tests/Squidex.Infrastructure.Tests/ValidationExceptionTests.cs b/backend/tests/Squidex.Infrastructure.Tests/ValidationExceptionTests.cs index ae5a32285..e922bbfbf 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/ValidationExceptionTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/ValidationExceptionTests.cs @@ -5,10 +5,8 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FluentAssertions; using Squidex.Infrastructure.TestHelpers; using Squidex.Infrastructure.Validation; -using Xunit; namespace Squidex.Infrastructure; diff --git a/backend/tests/Squidex.Infrastructure.Tests/ValidationExtensionsTests.cs b/backend/tests/Squidex.Infrastructure.Tests/ValidationExtensionsTests.cs index 8b0c58864..c288ac63a 100644 --- a/backend/tests/Squidex.Infrastructure.Tests/ValidationExtensionsTests.cs +++ b/backend/tests/Squidex.Infrastructure.Tests/ValidationExtensionsTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using Squidex.Infrastructure.Validation; -using Xunit; namespace Squidex.Infrastructure; diff --git a/backend/tests/Squidex.Web.Tests/ApiCostsAttributeTests.cs b/backend/tests/Squidex.Web.Tests/ApiCostsAttributeTests.cs index 2ec7a8d75..88f271d8d 100644 --- a/backend/tests/Squidex.Web.Tests/ApiCostsAttributeTests.cs +++ b/backend/tests/Squidex.Web.Tests/ApiCostsAttributeTests.cs @@ -5,8 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using Xunit; - namespace Squidex.Web; public class ApiCostsAttributeTests diff --git a/backend/tests/Squidex.Web.Tests/ApiExceptionFilterAttributeTests.cs b/backend/tests/Squidex.Web.Tests/ApiExceptionFilterAttributeTests.cs index 7152a97d0..be2aa7971 100644 --- a/backend/tests/Squidex.Web.Tests/ApiExceptionFilterAttributeTests.cs +++ b/backend/tests/Squidex.Web.Tests/ApiExceptionFilterAttributeTests.cs @@ -7,7 +7,6 @@ using System.Security; using System.Text; -using FakeItEasy; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Abstractions; @@ -16,7 +15,6 @@ using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.Logging; using Squidex.Infrastructure; using Squidex.Infrastructure.Validation; -using Xunit; #pragma warning disable MA0015 // Specify the parameter name in ArgumentException diff --git a/backend/tests/Squidex.Web.Tests/ApiPermissionAttributeTests.cs b/backend/tests/Squidex.Web.Tests/ApiPermissionAttributeTests.cs index f3964d6e7..7e745f877 100644 --- a/backend/tests/Squidex.Web.Tests/ApiPermissionAttributeTests.cs +++ b/backend/tests/Squidex.Web.Tests/ApiPermissionAttributeTests.cs @@ -17,7 +17,6 @@ using Squidex.Infrastructure; using Squidex.Shared; using Squidex.Shared.Identity; using Squidex.Web.Pipeline; -using Xunit; #pragma warning disable IDE0017 // Simplify object initialization diff --git a/backend/tests/Squidex.Web.Tests/CommandMiddlewares/ETagCommandMiddlewareTests.cs b/backend/tests/Squidex.Web.Tests/CommandMiddlewares/ETagCommandMiddlewareTests.cs index 96ae53f87..73e93be97 100644 --- a/backend/tests/Squidex.Web.Tests/CommandMiddlewares/ETagCommandMiddlewareTests.cs +++ b/backend/tests/Squidex.Web.Tests/CommandMiddlewares/ETagCommandMiddlewareTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Primitives; using Microsoft.Net.Http.Headers; @@ -13,7 +12,6 @@ using Squidex.Domain.Apps.Entities.Contents; using Squidex.Domain.Apps.Entities.Contents.Commands; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; -using Xunit; namespace Squidex.Web.CommandMiddlewares; diff --git a/backend/tests/Squidex.Web.Tests/CommandMiddlewares/EnrichWithActorCommandMiddlewareTests.cs b/backend/tests/Squidex.Web.Tests/CommandMiddlewares/EnrichWithActorCommandMiddlewareTests.cs index b5751d5e4..07dd0ac13 100644 --- a/backend/tests/Squidex.Web.Tests/CommandMiddlewares/EnrichWithActorCommandMiddlewareTests.cs +++ b/backend/tests/Squidex.Web.Tests/CommandMiddlewares/EnrichWithActorCommandMiddlewareTests.cs @@ -6,14 +6,12 @@ // ========================================================================== using System.Security.Claims; -using FakeItEasy; using Microsoft.AspNetCore.Http; using Squidex.Domain.Apps.Entities; using Squidex.Domain.Apps.Entities.Contents.Commands; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.Security; -using Xunit; namespace Squidex.Web.CommandMiddlewares; diff --git a/backend/tests/Squidex.Web.Tests/CommandMiddlewares/EnrichWithAppIdCommandMiddlewareTests.cs b/backend/tests/Squidex.Web.Tests/CommandMiddlewares/EnrichWithAppIdCommandMiddlewareTests.cs index c1645f3de..a389097b8 100644 --- a/backend/tests/Squidex.Web.Tests/CommandMiddlewares/EnrichWithAppIdCommandMiddlewareTests.cs +++ b/backend/tests/Squidex.Web.Tests/CommandMiddlewares/EnrichWithAppIdCommandMiddlewareTests.cs @@ -5,13 +5,11 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Entities; using Squidex.Domain.Apps.Entities.Contents.Commands; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; -using Xunit; namespace Squidex.Web.CommandMiddlewares; diff --git a/backend/tests/Squidex.Web.Tests/CommandMiddlewares/EnrichWithContentIdCommandMiddlewareTests.cs b/backend/tests/Squidex.Web.Tests/CommandMiddlewares/EnrichWithContentIdCommandMiddlewareTests.cs index 143f26282..3926ac1b6 100644 --- a/backend/tests/Squidex.Web.Tests/CommandMiddlewares/EnrichWithContentIdCommandMiddlewareTests.cs +++ b/backend/tests/Squidex.Web.Tests/CommandMiddlewares/EnrichWithContentIdCommandMiddlewareTests.cs @@ -5,11 +5,9 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Squidex.Domain.Apps.Entities.Contents.Commands; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; -using Xunit; namespace Squidex.Web.CommandMiddlewares; diff --git a/backend/tests/Squidex.Web.Tests/CommandMiddlewares/EnrichWithSchemaIdCommandMiddlewareTests.cs b/backend/tests/Squidex.Web.Tests/CommandMiddlewares/EnrichWithSchemaIdCommandMiddlewareTests.cs index 4e341ee0d..b53a53c9b 100644 --- a/backend/tests/Squidex.Web.Tests/CommandMiddlewares/EnrichWithSchemaIdCommandMiddlewareTests.cs +++ b/backend/tests/Squidex.Web.Tests/CommandMiddlewares/EnrichWithSchemaIdCommandMiddlewareTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.AspNetCore.Http; using Squidex.Domain.Apps.Entities; using Squidex.Domain.Apps.Entities.Contents.Commands; @@ -13,7 +12,6 @@ using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; using Squidex.Web.Pipeline; -using Xunit; namespace Squidex.Web.CommandMiddlewares; diff --git a/backend/tests/Squidex.Web.Tests/CommandMiddlewares/EnrichWithTeamIdCommandMiddlewareTests.cs b/backend/tests/Squidex.Web.Tests/CommandMiddlewares/EnrichWithTeamIdCommandMiddlewareTests.cs index 27bedc866..b18da4042 100644 --- a/backend/tests/Squidex.Web.Tests/CommandMiddlewares/EnrichWithTeamIdCommandMiddlewareTests.cs +++ b/backend/tests/Squidex.Web.Tests/CommandMiddlewares/EnrichWithTeamIdCommandMiddlewareTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.AspNetCore.Http; using Squidex.Domain.Apps.Entities; using Squidex.Domain.Apps.Entities.Teams.Commands; @@ -13,7 +12,6 @@ using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Commands; using Squidex.Web.Pipeline; -using Xunit; namespace Squidex.Web.CommandMiddlewares; diff --git a/backend/tests/Squidex.Web.Tests/ExposedValuesTests.cs b/backend/tests/Squidex.Web.Tests/ExposedValuesTests.cs index 39bd06d49..9a69a915a 100644 --- a/backend/tests/Squidex.Web.Tests/ExposedValuesTests.cs +++ b/backend/tests/Squidex.Web.Tests/ExposedValuesTests.cs @@ -5,9 +5,7 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.Extensions.Configuration; -using Xunit; namespace Squidex.Web; diff --git a/backend/tests/Squidex.Web.Tests/Pipeline/ApiCostsFilterTests.cs b/backend/tests/Squidex.Web.Tests/Pipeline/ApiCostsFilterTests.cs index 6eac85271..0e9329146 100644 --- a/backend/tests/Squidex.Web.Tests/Pipeline/ApiCostsFilterTests.cs +++ b/backend/tests/Squidex.Web.Tests/Pipeline/ApiCostsFilterTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Abstractions; @@ -14,7 +13,6 @@ using Microsoft.AspNetCore.Routing; using Squidex.Domain.Apps.Entities; using Squidex.Domain.Apps.Entities.Apps; using Squidex.Domain.Apps.Entities.Billing; -using Xunit; namespace Squidex.Web.Pipeline; diff --git a/backend/tests/Squidex.Web.Tests/Pipeline/ApiPermissionUnifierTests.cs b/backend/tests/Squidex.Web.Tests/Pipeline/ApiPermissionUnifierTests.cs index 87099df85..72c850451 100644 --- a/backend/tests/Squidex.Web.Tests/Pipeline/ApiPermissionUnifierTests.cs +++ b/backend/tests/Squidex.Web.Tests/Pipeline/ApiPermissionUnifierTests.cs @@ -8,7 +8,6 @@ using System.Security.Claims; using Squidex.Shared; using Squidex.Shared.Identity; -using Xunit; namespace Squidex.Web.Pipeline; diff --git a/backend/tests/Squidex.Web.Tests/Pipeline/AppResolverTests.cs b/backend/tests/Squidex.Web.Tests/Pipeline/AppResolverTests.cs index 6685438b1..66b86555d 100644 --- a/backend/tests/Squidex.Web.Tests/Pipeline/AppResolverTests.cs +++ b/backend/tests/Squidex.Web.Tests/Pipeline/AppResolverTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using System.Security.Claims; -using FakeItEasy; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; @@ -20,7 +19,6 @@ using Squidex.Domain.Apps.Entities.Apps; using Squidex.Infrastructure.Security; using Squidex.Shared; using Squidex.Shared.Identity; -using Xunit; #pragma warning disable IDE0017 // Simplify object initialization diff --git a/backend/tests/Squidex.Web.Tests/Pipeline/CachingFilterTests.cs b/backend/tests/Squidex.Web.Tests/Pipeline/CachingFilterTests.cs index 25e29e724..616f80d59 100644 --- a/backend/tests/Squidex.Web.Tests/Pipeline/CachingFilterTests.cs +++ b/backend/tests/Squidex.Web.Tests/Pipeline/CachingFilterTests.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Abstractions; @@ -13,7 +12,6 @@ using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.Options; using Microsoft.Net.Http.Headers; -using Xunit; namespace Squidex.Web.Pipeline; diff --git a/backend/tests/Squidex.Web.Tests/Pipeline/CachingKeysMiddlewareTests.cs b/backend/tests/Squidex.Web.Tests/Pipeline/CachingKeysMiddlewareTests.cs index f8e8fdcd9..db64ce309 100644 --- a/backend/tests/Squidex.Web.Tests/Pipeline/CachingKeysMiddlewareTests.cs +++ b/backend/tests/Squidex.Web.Tests/Pipeline/CachingKeysMiddlewareTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using System.Security.Claims; -using FakeItEasy; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; using Microsoft.Extensions.Options; @@ -14,7 +13,6 @@ using Microsoft.Extensions.Primitives; using Microsoft.Net.Http.Headers; using Squidex.Infrastructure; using Squidex.Infrastructure.Security; -using Xunit; namespace Squidex.Web.Pipeline; diff --git a/backend/tests/Squidex.Web.Tests/Pipeline/RequestExceptionMiddlewareTests.cs b/backend/tests/Squidex.Web.Tests/Pipeline/RequestExceptionMiddlewareTests.cs index d2365fc09..345941f58 100644 --- a/backend/tests/Squidex.Web.Tests/Pipeline/RequestExceptionMiddlewareTests.cs +++ b/backend/tests/Squidex.Web.Tests/Pipeline/RequestExceptionMiddlewareTests.cs @@ -5,13 +5,11 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using FakeItEasy; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Infrastructure; using Microsoft.Extensions.Logging; -using Xunit; namespace Squidex.Web.Pipeline; diff --git a/backend/tests/Squidex.Web.Tests/Pipeline/SchemaResolverTests.cs b/backend/tests/Squidex.Web.Tests/Pipeline/SchemaResolverTests.cs index bbe0abd12..2ae88e695 100644 --- a/backend/tests/Squidex.Web.Tests/Pipeline/SchemaResolverTests.cs +++ b/backend/tests/Squidex.Web.Tests/Pipeline/SchemaResolverTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using System.Security.Claims; -using FakeItEasy; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Abstractions; @@ -19,7 +18,6 @@ using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; using Squidex.Infrastructure.Security; using Squidex.Shared; -using Xunit; #pragma warning disable IDE0017 // Simplify object initialization diff --git a/backend/tests/Squidex.Web.Tests/Pipeline/TeamResolverTests.cs b/backend/tests/Squidex.Web.Tests/Pipeline/TeamResolverTests.cs index 101b2b928..139aa7f15 100644 --- a/backend/tests/Squidex.Web.Tests/Pipeline/TeamResolverTests.cs +++ b/backend/tests/Squidex.Web.Tests/Pipeline/TeamResolverTests.cs @@ -6,7 +6,6 @@ // ========================================================================== using System.Security.Claims; -using FakeItEasy; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; @@ -20,7 +19,6 @@ using Squidex.Domain.Apps.Entities.Teams; using Squidex.Infrastructure; using Squidex.Infrastructure.Security; using Squidex.Shared.Identity; -using Xunit; #pragma warning disable IDE0017 // Simplify object initialization diff --git a/backend/tests/Squidex.Web.Tests/Pipeline/UsageMiddlewareTests.cs b/backend/tests/Squidex.Web.Tests/Pipeline/UsageMiddlewareTests.cs index 55d287464..bdc5e3f2f 100644 --- a/backend/tests/Squidex.Web.Tests/Pipeline/UsageMiddlewareTests.cs +++ b/backend/tests/Squidex.Web.Tests/Pipeline/UsageMiddlewareTests.cs @@ -6,14 +6,12 @@ // ========================================================================== using System.Text; -using FakeItEasy; using Microsoft.AspNetCore.Http; using NodaTime; using Squidex.Domain.Apps.Entities.Apps; using Squidex.Domain.Apps.Entities.Billing; using Squidex.Domain.Apps.Entities.TestHelpers; using Squidex.Infrastructure; -using Xunit; namespace Squidex.Web.Pipeline; diff --git a/backend/tests/Squidex.Web.Tests/Services/StringLocalizerTests.cs b/backend/tests/Squidex.Web.Tests/Services/StringLocalizerTests.cs index 0cf2285f9..4a9c117a3 100644 --- a/backend/tests/Squidex.Web.Tests/Services/StringLocalizerTests.cs +++ b/backend/tests/Squidex.Web.Tests/Services/StringLocalizerTests.cs @@ -7,7 +7,6 @@ using Squidex.Infrastructure.Translations; using Squidex.Shared; -using Xunit; namespace Squidex.Web.Services; diff --git a/backend/tests/Squidex.Web.Tests/Squidex.Web.Tests.csproj b/backend/tests/Squidex.Web.Tests/Squidex.Web.Tests.csproj index ceaad1ea0..a7191f047 100644 --- a/backend/tests/Squidex.Web.Tests/Squidex.Web.Tests.csproj +++ b/backend/tests/Squidex.Web.Tests/Squidex.Web.Tests.csproj @@ -1,7 +1,7 @@  Exe - net6.0 + net7.0 Squidex.Web 10.0 enable @@ -13,18 +13,24 @@ - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + - + all runtime; build; native; contentfiles; analyzers + + + + + diff --git a/backend/tests/Squidex.Web.Tests/UrlDecodeRouteParamsAttributeTests.cs b/backend/tests/Squidex.Web.Tests/UrlDecodeRouteParamsAttributeTests.cs index f3c378e7a..65d56a208 100644 --- a/backend/tests/Squidex.Web.Tests/UrlDecodeRouteParamsAttributeTests.cs +++ b/backend/tests/Squidex.Web.Tests/UrlDecodeRouteParamsAttributeTests.cs @@ -10,7 +10,6 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.AspNetCore.Routing; -using Xunit; namespace Squidex.Web; diff --git a/backend/tools/GenerateLanguages/GenerateLanguages.csproj b/backend/tools/GenerateLanguages/GenerateLanguages.csproj index 41d6358d7..b3f33210f 100644 --- a/backend/tools/GenerateLanguages/GenerateLanguages.csproj +++ b/backend/tools/GenerateLanguages/GenerateLanguages.csproj @@ -1,7 +1,7 @@  Exe - net6.0 + net7.0 10.0 enable diff --git a/backend/tools/TestSuite/TestSuite.ApiTests/AssetTests.cs b/backend/tools/TestSuite/TestSuite.ApiTests/AssetTests.cs index d9e042007..bc535a8df 100644 --- a/backend/tools/TestSuite/TestSuite.ApiTests/AssetTests.cs +++ b/backend/tools/TestSuite/TestSuite.ApiTests/AssetTests.cs @@ -374,48 +374,49 @@ public class AssetTests : IClassFixture [Fact] public async Task Should_annotate_asset_in_parallel() { - var tag1 = $"tag_{Guid.NewGuid()}"; - var tag2 = $"tag_{Guid.NewGuid()}"; - - var metadataRequest = new AnnotateAssetDto - { - Tags = new List - { - tag1, - tag2 - } - }; - - // STEP 1: Create asset var asset_1 = await _.Assets.UploadFileAsync(_.AppName, "Assets/logo-squared.png", "image/png"); - var numErrors = 0; - var numSuccess = 0; - // STEP 3: Make parallel upserts. await Parallel.ForEachAsync(Enumerable.Range(0, 20), async (i, ct) => { try { - await _.Assets.PutAssetAsync(_.AppName, asset_1.Id, metadataRequest); + var randomTag1 = $"tag_{Guid.NewGuid()}"; + var randomTag2 = $"tag_{Guid.NewGuid()}"; - Interlocked.Increment(ref numSuccess); + var randomMetadataRequest = new AnnotateAssetDto + { + Tags = new List + { + randomTag1, + randomTag2 + } + }; + + await _.Assets.PutAssetAsync(_.AppName, asset_1.Id, randomMetadataRequest); } catch (SquidexManagementException ex) when (ex.StatusCode is 409 or 412) { - Interlocked.Increment(ref numErrors); return; } }); - // At least some errors and success should have happened. - Assert.True(numErrors >= 0); - Assert.True(numSuccess >= 0); - // STEP 3: Make an normal update to ensure nothing is corrupt. + var tag1 = $"tag_{Guid.NewGuid()}"; + var tag2 = $"tag_{Guid.NewGuid()}"; + + var metadataRequest = new AnnotateAssetDto + { + Tags = new List + { + tag1, + tag2 + } + }; + var asset_2 = await _.Assets.PutAssetAsync(_.AppName, asset_1.Id, metadataRequest); @@ -428,6 +429,7 @@ public class AssetTests : IClassFixture Assert.Equal(1, tags[tag2]); await Verify(asset_2) + .IgnoreMember(x => x.Version) .IgnoreMember(x => x.Tags); } diff --git a/backend/tools/TestSuite/TestSuite.ApiTests/ContentUpdateTests.cs b/backend/tools/TestSuite/TestSuite.ApiTests/ContentUpdateTests.cs index 404d895e2..d55f0750d 100644 --- a/backend/tools/TestSuite/TestSuite.ApiTests/ContentUpdateTests.cs +++ b/backend/tools/TestSuite/TestSuite.ApiTests/ContentUpdateTests.cs @@ -463,9 +463,6 @@ public class ContentUpdateTests : IClassFixture }, ContentCreateOptions.AsPublish); - var numErrors = 0; - var numSuccess = 0; - // STEP 3: Make parallel updates. await Parallel.ForEachAsync(Enumerable.Range(0, 20), async (i, ct) => { @@ -475,20 +472,13 @@ public class ContentUpdateTests : IClassFixture { Number = i }); - - Interlocked.Increment(ref numSuccess); } catch (SquidexException ex) when (ex.StatusCode is 409 or 412) { - Interlocked.Increment(ref numErrors); return; } }); - // At least some errors and success should have happened. - Assert.True(numErrors >= 0); - Assert.True(numSuccess >= 0); - // STEP 3: Make an normal update to ensure nothing is corrupt. await _.Contents.UpdateAsync(content.Id, new TestEntityData @@ -522,9 +512,6 @@ public class ContentUpdateTests : IClassFixture }, ContentCreateOptions.AsPublish); - var numErrors = 0; - var numSuccess = 0; - // STEP 3: Make parallel upserts. await Parallel.ForEachAsync(Enumerable.Range(0, 20), async (i, ct) => { @@ -534,20 +521,13 @@ public class ContentUpdateTests : IClassFixture { Number = i }); - - Interlocked.Increment(ref numSuccess); } catch (SquidexException ex) when (ex.StatusCode is 409 or 412) { - Interlocked.Increment(ref numErrors); return; } }); - // At least some errors and success should have happened. - Assert.True(numErrors > 0); - Assert.True(numSuccess >= 0); - // STEP 3: Make an normal update to ensure nothing is corrupt. await _.Contents.UpdateAsync(content.Id, new TestEntityData diff --git a/backend/tools/TestSuite/TestSuite.ApiTests/TestSuite.ApiTests.csproj b/backend/tools/TestSuite/TestSuite.ApiTests/TestSuite.ApiTests.csproj index 9bd31c758..fe017df41 100644 --- a/backend/tools/TestSuite/TestSuite.ApiTests/TestSuite.ApiTests.csproj +++ b/backend/tools/TestSuite/TestSuite.ApiTests/TestSuite.ApiTests.csproj @@ -1,7 +1,7 @@  Exe - net6.0 + net7.0 10.0 enable diff --git a/backend/tools/TestSuite/TestSuite.ApiTests/Verify/AssetTests.Should_annotate_asset_in_parallel.verified.txt b/backend/tools/TestSuite/TestSuite.ApiTests/Verify/AssetTests.Should_annotate_asset_in_parallel.verified.txt index 29cf14b71..19c32c3fd 100644 --- a/backend/tools/TestSuite/TestSuite.ApiTests/Verify/AssetTests.Should_annotate_asset_in_parallel.verified.txt +++ b/backend/tools/TestSuite/TestSuite.ApiTests/Verify/AssetTests.Should_annotate_asset_in_parallel.verified.txt @@ -15,7 +15,6 @@ }, fileSize: 19430, type: Image, - version: 1, _links: { content: { method: GET diff --git a/backend/tools/TestSuite/TestSuite.LoadTests/TestSuite.LoadTests.csproj b/backend/tools/TestSuite/TestSuite.LoadTests/TestSuite.LoadTests.csproj index 8aa61b528..939c9be40 100644 --- a/backend/tools/TestSuite/TestSuite.LoadTests/TestSuite.LoadTests.csproj +++ b/backend/tools/TestSuite/TestSuite.LoadTests/TestSuite.LoadTests.csproj @@ -1,7 +1,7 @@  Exe - net6.0 + net7.0 10.0 enable diff --git a/backend/tools/TestSuite/TestSuite.Shared/TestSuite.Shared.csproj b/backend/tools/TestSuite/TestSuite.Shared/TestSuite.Shared.csproj index cb17c2093..13da2c9d0 100644 --- a/backend/tools/TestSuite/TestSuite.Shared/TestSuite.Shared.csproj +++ b/backend/tools/TestSuite/TestSuite.Shared/TestSuite.Shared.csproj @@ -1,6 +1,6 @@  - net6.0 + net7.0 TestSuite 10.0 enable