From 10fa3e1cd037e02fa5216a2bbb66cb8f9e1a2793 Mon Sep 17 00:00:00 2001 From: HauklandJ Date: Fri, 4 Oct 2024 13:37:26 +0200 Subject: [PATCH] use the const instead of magic strings --- .../Controllers/Conventions/AltinnApiJsonFormatterTests.cs | 4 ++-- .../Controllers/Conventions/ConfigureMvcJsonOptionsTests.cs | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/test/Altinn.App.Api.Tests/Controllers/Conventions/AltinnApiJsonFormatterTests.cs b/test/Altinn.App.Api.Tests/Controllers/Conventions/AltinnApiJsonFormatterTests.cs index 123aa0311..2c819c08a 100644 --- a/test/Altinn.App.Api.Tests/Controllers/Conventions/AltinnApiJsonFormatterTests.cs +++ b/test/Altinn.App.Api.Tests/Controllers/Conventions/AltinnApiJsonFormatterTests.cs @@ -14,7 +14,7 @@ public class AltinnApiJsonFormatterTests public void CreateFormatter_WhenEncoderIsNull_SetsUnsafeRelaxedJsonEscaping() { // Arrange - string settingsName = "AltinnApi"; + string settingsName = JsonSettingNames.AltinnApi; var serializerOptions = new JsonSerializerOptions { Encoder = null, @@ -35,7 +35,7 @@ public void CreateFormatter_WhenEncoderIsNull_SetsUnsafeRelaxedJsonEscaping() public void CreateFormatter_WhenEncoderIsNotNull_PreservesEncoder() { // Arrange - string settingsName = "AltinnApi"; + string settingsName = JsonSettingNames.AltinnApi; var originalEncoder = JavaScriptEncoder.Default; var serializerOptions = new JsonSerializerOptions { diff --git a/test/Altinn.App.Api.Tests/Controllers/Conventions/ConfigureMvcJsonOptionsTests.cs b/test/Altinn.App.Api.Tests/Controllers/Conventions/ConfigureMvcJsonOptionsTests.cs index bbbd54662..ba0f9df8c 100644 --- a/test/Altinn.App.Api.Tests/Controllers/Conventions/ConfigureMvcJsonOptionsTests.cs +++ b/test/Altinn.App.Api.Tests/Controllers/Conventions/ConfigureMvcJsonOptionsTests.cs @@ -2,6 +2,7 @@ using System.Text.Json; using System.Text.Json.Serialization; using System.Text.Json.Serialization.Metadata; +using Altinn.App.Api.Controllers.Attributes; using Altinn.App.Api.Controllers.Conventions; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Formatters; @@ -14,7 +15,7 @@ public class ConfigureMvcJsonOptionsTests public void Configure_InsertsCustomFormatterWithCorrectSettings() { // Arrange - var jsonSettingsName = "AltinnApi"; + var jsonSettingsName = JsonSettingNames.AltinnApi; var configureOptions = new ConfigureMvcJsonOptions(jsonSettingsName); var mvcOptions = new MvcOptions();