diff --git a/src/Altinn.App.Api/Altinn.App.Api.csproj b/src/Altinn.App.Api/Altinn.App.Api.csproj index fbe4c1efe..ea6fb286e 100644 --- a/src/Altinn.App.Api/Altinn.App.Api.csproj +++ b/src/Altinn.App.Api/Altinn.App.Api.csproj @@ -15,8 +15,8 @@ - - + + diff --git a/src/Altinn.App.Core/Altinn.App.Core.csproj b/src/Altinn.App.Core/Altinn.App.Core.csproj index cf24e3dd4..66fefd192 100644 --- a/src/Altinn.App.Core/Altinn.App.Core.csproj +++ b/src/Altinn.App.Core/Altinn.App.Core.csproj @@ -13,9 +13,9 @@ - + - + diff --git a/test/Altinn.App.Api.Tests/OpenApi/swagger.json b/test/Altinn.App.Api.Tests/OpenApi/swagger.json index 0625e8143..56aebd1b2 100644 --- a/test/Altinn.App.Api.Tests/OpenApi/swagger.json +++ b/test/Altinn.App.Api.Tests/OpenApi/swagger.json @@ -5464,7 +5464,7 @@ "copyInstanceSettings": { "$ref": "#/components/schemas/CopyInstanceSettings" }, - "storageContainerNumber": { + "storageAccountNumber": { "type": "integer", "format": "int32", "nullable": true diff --git a/test/Altinn.App.Api.Tests/OpenApi/swagger.yaml b/test/Altinn.App.Api.Tests/OpenApi/swagger.yaml index 591b4f8cb..d4db12244 100644 --- a/test/Altinn.App.Api.Tests/OpenApi/swagger.yaml +++ b/test/Altinn.App.Api.Tests/OpenApi/swagger.yaml @@ -3361,7 +3361,7 @@ components: $ref: '#/components/schemas/MessageBoxConfig' copyInstanceSettings: $ref: '#/components/schemas/CopyInstanceSettings' - storageContainerNumber: + storageAccountNumber: type: integer format: int32 nullable: true diff --git a/test/Altinn.App.Core.Tests/Helpers/MultiDecisionHelper/MultiDecisionHelperTests.CreateMultiDecisionRequest_generates_multidecisionrequest_with_all_actions_current_task_elemtnId.verified.txt b/test/Altinn.App.Core.Tests/Helpers/MultiDecisionHelper/MultiDecisionHelperTests.CreateMultiDecisionRequest_generates_multidecisionrequest_with_all_actions_current_task_elemtnId.verified.txt new file mode 100644 index 000000000..4a87e3f2c --- /dev/null +++ b/test/Altinn.App.Core.Tests/Helpers/MultiDecisionHelper/MultiDecisionHelperTests.CreateMultiDecisionRequest_generates_multidecisionrequest_with_all_actions_current_task_elemtnId.verified.txt @@ -0,0 +1,113 @@ +{ + Request: { + ReturnPolicyIdList: false, + CombinedDecision: false, + Resource: [ + { + Id: r1, + Attribute: [ + { + AttributeId: urn:altinn:task, + Value: Task_1, + Issuer: Altinn, + DataType: string, + IncludeInResult: false + }, + { + AttributeId: urn:altinn:instance-id, + Value: 1337/1dd16477-187b-463c-8adf-592c7fa78459, + Issuer: Altinn, + DataType: string, + IncludeInResult: true + }, + { + AttributeId: urn:altinn:partyid, + Value: 1337, + Issuer: Altinn, + DataType: string, + IncludeInResult: false + }, + { + AttributeId: urn:altinn:org, + Value: tdd, + Issuer: Altinn, + DataType: string, + IncludeInResult: false + }, + { + AttributeId: urn:altinn:app, + Value: test-app, + Issuer: Altinn, + DataType: string, + IncludeInResult: false + } + ] + } + ], + Action: [ + { + Id: a1, + Attribute: [ + { + AttributeId: urn:oasis:names:tc:xacml:1.0:action:action-id, + Value: sign, + Issuer: Altinn, + DataType: string, + IncludeInResult: true + } + ] + }, + { + Id: a2, + Attribute: [ + { + AttributeId: urn:oasis:names:tc:xacml:1.0:action:action-id, + Value: reject, + Issuer: Altinn, + DataType: string, + IncludeInResult: true + } + ] + } + ], + AccessSubject: [ + { + Id: s1, + Attribute: [ + { + AttributeId: urn:altinn:authlevel, + Value: 3, + Issuer: LOCAL AUTHORITY, + DataType: string, + IncludeInResult: false + }, + { + AttributeId: urn:altinn:partyid, + Value: 1337, + Issuer: LOCAL AUTHORITY, + DataType: string, + IncludeInResult: false + } + ] + } + ], + MultiRequests: { + RequestReference: [ + { + ReferenceId: [ + s1, + a1, + r1 + ] + }, + { + ReferenceId: [ + s1, + a2, + r1 + ] + } + ] + } + } +} diff --git a/test/Altinn.App.Core.Tests/Helpers/MultiDecisionHelper/MultiDecisionHelperTests.CreateMultiDecisionRequest_generates_multidecisionrequest_with_all_actions_endevent.verified.txt b/test/Altinn.App.Core.Tests/Helpers/MultiDecisionHelper/MultiDecisionHelperTests.CreateMultiDecisionRequest_generates_multidecisionrequest_with_all_actions_endevent.verified.txt new file mode 100644 index 000000000..e29aac452 --- /dev/null +++ b/test/Altinn.App.Core.Tests/Helpers/MultiDecisionHelper/MultiDecisionHelperTests.CreateMultiDecisionRequest_generates_multidecisionrequest_with_all_actions_endevent.verified.txt @@ -0,0 +1,113 @@ +{ + Request: { + ReturnPolicyIdList: false, + CombinedDecision: false, + Resource: [ + { + Id: r1, + Attribute: [ + { + AttributeId: urn:altinn:end-event, + Value: EndEvent_1, + Issuer: Altinn, + DataType: string, + IncludeInResult: false + }, + { + AttributeId: urn:altinn:instance-id, + Value: 1337/1dd16477-187b-463c-8adf-592c7fa78459, + Issuer: Altinn, + DataType: string, + IncludeInResult: true + }, + { + AttributeId: urn:altinn:partyid, + Value: 1337, + Issuer: Altinn, + DataType: string, + IncludeInResult: false + }, + { + AttributeId: urn:altinn:org, + Value: tdd, + Issuer: Altinn, + DataType: string, + IncludeInResult: false + }, + { + AttributeId: urn:altinn:app, + Value: test-app, + Issuer: Altinn, + DataType: string, + IncludeInResult: false + } + ] + } + ], + Action: [ + { + Id: a1, + Attribute: [ + { + AttributeId: urn:oasis:names:tc:xacml:1.0:action:action-id, + Value: sign, + Issuer: Altinn, + DataType: string, + IncludeInResult: true + } + ] + }, + { + Id: a2, + Attribute: [ + { + AttributeId: urn:oasis:names:tc:xacml:1.0:action:action-id, + Value: reject, + Issuer: Altinn, + DataType: string, + IncludeInResult: true + } + ] + } + ], + AccessSubject: [ + { + Id: s1, + Attribute: [ + { + AttributeId: urn:altinn:authlevel, + Value: 3, + Issuer: LOCAL AUTHORITY, + DataType: string, + IncludeInResult: false + }, + { + AttributeId: urn:altinn:partyid, + Value: 1337, + Issuer: LOCAL AUTHORITY, + DataType: string, + IncludeInResult: false + } + ] + } + ], + MultiRequests: { + RequestReference: [ + { + ReferenceId: [ + s1, + a1, + r1 + ] + }, + { + ReferenceId: [ + s1, + a2, + r1 + ] + } + ] + } + } +} diff --git a/test/Altinn.App.Core.Tests/Helpers/MultiDecisionHelper/MultiDecisionHelperTests.CreateMultiDecisionRequest_generates_multidecisionrequest_with_all_actions_instanceId_is_GUID_only.verified.txt b/test/Altinn.App.Core.Tests/Helpers/MultiDecisionHelper/MultiDecisionHelperTests.CreateMultiDecisionRequest_generates_multidecisionrequest_with_all_actions_instanceId_is_GUID_only.verified.txt new file mode 100644 index 000000000..4a87e3f2c --- /dev/null +++ b/test/Altinn.App.Core.Tests/Helpers/MultiDecisionHelper/MultiDecisionHelperTests.CreateMultiDecisionRequest_generates_multidecisionrequest_with_all_actions_instanceId_is_GUID_only.verified.txt @@ -0,0 +1,113 @@ +{ + Request: { + ReturnPolicyIdList: false, + CombinedDecision: false, + Resource: [ + { + Id: r1, + Attribute: [ + { + AttributeId: urn:altinn:task, + Value: Task_1, + Issuer: Altinn, + DataType: string, + IncludeInResult: false + }, + { + AttributeId: urn:altinn:instance-id, + Value: 1337/1dd16477-187b-463c-8adf-592c7fa78459, + Issuer: Altinn, + DataType: string, + IncludeInResult: true + }, + { + AttributeId: urn:altinn:partyid, + Value: 1337, + Issuer: Altinn, + DataType: string, + IncludeInResult: false + }, + { + AttributeId: urn:altinn:org, + Value: tdd, + Issuer: Altinn, + DataType: string, + IncludeInResult: false + }, + { + AttributeId: urn:altinn:app, + Value: test-app, + Issuer: Altinn, + DataType: string, + IncludeInResult: false + } + ] + } + ], + Action: [ + { + Id: a1, + Attribute: [ + { + AttributeId: urn:oasis:names:tc:xacml:1.0:action:action-id, + Value: sign, + Issuer: Altinn, + DataType: string, + IncludeInResult: true + } + ] + }, + { + Id: a2, + Attribute: [ + { + AttributeId: urn:oasis:names:tc:xacml:1.0:action:action-id, + Value: reject, + Issuer: Altinn, + DataType: string, + IncludeInResult: true + } + ] + } + ], + AccessSubject: [ + { + Id: s1, + Attribute: [ + { + AttributeId: urn:altinn:authlevel, + Value: 3, + Issuer: LOCAL AUTHORITY, + DataType: string, + IncludeInResult: false + }, + { + AttributeId: urn:altinn:partyid, + Value: 1337, + Issuer: LOCAL AUTHORITY, + DataType: string, + IncludeInResult: false + } + ] + } + ], + MultiRequests: { + RequestReference: [ + { + ReferenceId: [ + s1, + a1, + r1 + ] + }, + { + ReferenceId: [ + s1, + a2, + r1 + ] + } + ] + } + } +} diff --git a/test/Altinn.App.Core.Tests/Helpers/MultiDecisionHelperTests.cs b/test/Altinn.App.Core.Tests/Helpers/MultiDecisionHelper/MultiDecisionHelperTests.cs similarity index 76% rename from test/Altinn.App.Core.Tests/Helpers/MultiDecisionHelperTests.cs rename to test/Altinn.App.Core.Tests/Helpers/MultiDecisionHelper/MultiDecisionHelperTests.cs index 589822777..5e239eb60 100644 --- a/test/Altinn.App.Core.Tests/Helpers/MultiDecisionHelperTests.cs +++ b/test/Altinn.App.Core.Tests/Helpers/MultiDecisionHelper/MultiDecisionHelperTests.cs @@ -4,23 +4,13 @@ using Altinn.Authorization.ABAC.Xacml.JsonProfile; using Altinn.Platform.Storage.Interface.Models; using FluentAssertions; -using Xunit.Abstractions; namespace Altinn.App.Core.Tests.Helpers; public class MultiDecisionHelperTests { - private static readonly JsonSerializerOptions _jsonSerializerOptions = new() { WriteIndented = true }; - - private readonly ITestOutputHelper _output; - - public MultiDecisionHelperTests(ITestOutputHelper output) - { - _output = output; - } - [Fact] - public void CreateMultiDecisionRequest_generates_multidecisionrequest_with_all_actions_current_task_elemtnId() + public async Task CreateMultiDecisionRequest_generates_multidecisionrequest_with_all_actions_current_task_elemtnId() { var claimsPrincipal = GetClaims("1337"); @@ -41,11 +31,11 @@ public void CreateMultiDecisionRequest_generates_multidecisionrequest_with_all_a var result = MultiDecisionHelper.CreateMultiDecisionRequest(claimsPrincipal, instance, actions); - CompareWithOrUpdateGoldenFile("multidecision-all-actions-task", result); + await Verify(result); } [Fact] - public void CreateMultiDecisionRequest_generates_multidecisionrequest_with_all_actions_instanceId_is_GUID_only() + public async Task CreateMultiDecisionRequest_generates_multidecisionrequest_with_all_actions_instanceId_is_GUID_only() { var claimsPrincipal = GetClaims("1337"); @@ -66,11 +56,11 @@ public void CreateMultiDecisionRequest_generates_multidecisionrequest_with_all_a var result = MultiDecisionHelper.CreateMultiDecisionRequest(claimsPrincipal, instance, actions); - CompareWithOrUpdateGoldenFile("multidecision-all-actions-guid", result); + await Verify(result); } [Fact] - public void CreateMultiDecisionRequest_generates_multidecisionrequest_with_all_actions_endevent() + public async Task CreateMultiDecisionRequest_generates_multidecisionrequest_with_all_actions_endevent() { var claimsPrincipal = GetClaims("1337"); @@ -91,7 +81,7 @@ public void CreateMultiDecisionRequest_generates_multidecisionrequest_with_all_a var result = MultiDecisionHelper.CreateMultiDecisionRequest(claimsPrincipal, instance, actions); - CompareWithOrUpdateGoldenFile("multidecision-all-actions-endevent", result); + await Verify(result); } [Fact] @@ -204,30 +194,6 @@ private static ClaimsPrincipal GetClaims(string partyId) ); } - private static string XacmlJsonRequestRootToString(XacmlJsonRequestRoot request) - { - return JsonSerializer.Serialize(request, _jsonSerializerOptions); - } - - private void CompareWithOrUpdateGoldenFile(string testId, XacmlJsonRequestRoot xacmlJsonRequestRoot) - { - bool updateGoldeFiles = Environment.GetEnvironmentVariable("UpdateGoldenFiles") == "true"; - string goldenFilePath = Path.Join("Helpers", "TestData", "MultiDecisionHelper", testId + ".golden.json"); - string xacmlJsonRequestRootAsString = XacmlJsonRequestRootToString(xacmlJsonRequestRoot); - if (updateGoldeFiles) - { - File.WriteAllText(Path.Join("..", "..", "..", goldenFilePath), xacmlJsonRequestRootAsString); - } - else - { - _output.WriteLine("To update golden files, run with environment variable value UpdateGoldenFiles=true"); - _output.WriteLine("Golden file path: " + new FileInfo(goldenFilePath)?.FullName); - } - - string goldenFileContent = File.ReadAllText(goldenFilePath); - Assert.Equal(goldenFileContent, xacmlJsonRequestRootAsString); - } - private static List GetXacmlJsonRespons(string filename) { var xacmlJesonRespons = File.ReadAllText( diff --git a/test/Altinn.App.Core.Tests/Helpers/TestData/MultiDecisionHelper/multidecision-all-actions-endevent.golden.json b/test/Altinn.App.Core.Tests/Helpers/TestData/MultiDecisionHelper/multidecision-all-actions-endevent.golden.json deleted file mode 100644 index b55a02662..000000000 --- a/test/Altinn.App.Core.Tests/Helpers/TestData/MultiDecisionHelper/multidecision-all-actions-endevent.golden.json +++ /dev/null @@ -1,126 +0,0 @@ -{ - "Request": { - "ReturnPolicyIdList": false, - "CombinedDecision": false, - "XPathVersion": null, - "Category": null, - "Resource": [ - { - "CategoryId": null, - "Id": "r1", - "Content": null, - "Attribute": [ - { - "AttributeId": "urn:altinn:end-event", - "Value": "EndEvent_1", - "Issuer": "Altinn", - "DataType": "string", - "IncludeInResult": false - }, - { - "AttributeId": "urn:altinn:instance-id", - "Value": "1337/1dd16477-187b-463c-8adf-592c7fa78459", - "Issuer": "Altinn", - "DataType": "string", - "IncludeInResult": true - }, - { - "AttributeId": "urn:altinn:partyid", - "Value": "1337", - "Issuer": "Altinn", - "DataType": "string", - "IncludeInResult": false - }, - { - "AttributeId": "urn:altinn:org", - "Value": "tdd", - "Issuer": "Altinn", - "DataType": "string", - "IncludeInResult": false - }, - { - "AttributeId": "urn:altinn:app", - "Value": "test-app", - "Issuer": "Altinn", - "DataType": "string", - "IncludeInResult": false - } - ] - } - ], - "Action": [ - { - "CategoryId": null, - "Id": "a1", - "Content": null, - "Attribute": [ - { - "AttributeId": "urn:oasis:names:tc:xacml:1.0:action:action-id", - "Value": "sign", - "Issuer": "Altinn", - "DataType": "string", - "IncludeInResult": true - } - ] - }, - { - "CategoryId": null, - "Id": "a2", - "Content": null, - "Attribute": [ - { - "AttributeId": "urn:oasis:names:tc:xacml:1.0:action:action-id", - "Value": "reject", - "Issuer": "Altinn", - "DataType": "string", - "IncludeInResult": true - } - ] - } - ], - "AccessSubject": [ - { - "CategoryId": null, - "Id": "s1", - "Content": null, - "Attribute": [ - { - "AttributeId": "urn:altinn:partyid", - "Value": "1337", - "Issuer": "LOCAL AUTHORITY", - "DataType": "string", - "IncludeInResult": false - }, - { - "AttributeId": "urn:altinn:authlevel", - "Value": "3", - "Issuer": "LOCAL AUTHORITY", - "DataType": "string", - "IncludeInResult": false - } - ] - } - ], - "RecipientSubject": null, - "IntermediarySubject": null, - "RequestingMachine": null, - "MultiRequests": { - "RequestReference": [ - { - "ReferenceId": [ - "s1", - "a1", - "r1" - ] - }, - { - "ReferenceId": [ - "s1", - "a2", - "r1" - ] - } - ] - } - } -} \ No newline at end of file diff --git a/test/Altinn.App.Core.Tests/Helpers/TestData/MultiDecisionHelper/multidecision-all-actions-guid.golden.json b/test/Altinn.App.Core.Tests/Helpers/TestData/MultiDecisionHelper/multidecision-all-actions-guid.golden.json deleted file mode 100644 index 9e31d805d..000000000 --- a/test/Altinn.App.Core.Tests/Helpers/TestData/MultiDecisionHelper/multidecision-all-actions-guid.golden.json +++ /dev/null @@ -1,126 +0,0 @@ -{ - "Request": { - "ReturnPolicyIdList": false, - "CombinedDecision": false, - "XPathVersion": null, - "Category": null, - "Resource": [ - { - "CategoryId": null, - "Id": "r1", - "Content": null, - "Attribute": [ - { - "AttributeId": "urn:altinn:task", - "Value": "Task_1", - "Issuer": "Altinn", - "DataType": "string", - "IncludeInResult": false - }, - { - "AttributeId": "urn:altinn:instance-id", - "Value": "1337/1dd16477-187b-463c-8adf-592c7fa78459", - "Issuer": "Altinn", - "DataType": "string", - "IncludeInResult": true - }, - { - "AttributeId": "urn:altinn:partyid", - "Value": "1337", - "Issuer": "Altinn", - "DataType": "string", - "IncludeInResult": false - }, - { - "AttributeId": "urn:altinn:org", - "Value": "tdd", - "Issuer": "Altinn", - "DataType": "string", - "IncludeInResult": false - }, - { - "AttributeId": "urn:altinn:app", - "Value": "test-app", - "Issuer": "Altinn", - "DataType": "string", - "IncludeInResult": false - } - ] - } - ], - "Action": [ - { - "CategoryId": null, - "Id": "a1", - "Content": null, - "Attribute": [ - { - "AttributeId": "urn:oasis:names:tc:xacml:1.0:action:action-id", - "Value": "sign", - "Issuer": "Altinn", - "DataType": "string", - "IncludeInResult": true - } - ] - }, - { - "CategoryId": null, - "Id": "a2", - "Content": null, - "Attribute": [ - { - "AttributeId": "urn:oasis:names:tc:xacml:1.0:action:action-id", - "Value": "reject", - "Issuer": "Altinn", - "DataType": "string", - "IncludeInResult": true - } - ] - } - ], - "AccessSubject": [ - { - "CategoryId": null, - "Id": "s1", - "Content": null, - "Attribute": [ - { - "AttributeId": "urn:altinn:partyid", - "Value": "1337", - "Issuer": "LOCAL AUTHORITY", - "DataType": "string", - "IncludeInResult": false - }, - { - "AttributeId": "urn:altinn:authlevel", - "Value": "3", - "Issuer": "LOCAL AUTHORITY", - "DataType": "string", - "IncludeInResult": false - } - ] - } - ], - "RecipientSubject": null, - "IntermediarySubject": null, - "RequestingMachine": null, - "MultiRequests": { - "RequestReference": [ - { - "ReferenceId": [ - "s1", - "a1", - "r1" - ] - }, - { - "ReferenceId": [ - "s1", - "a2", - "r1" - ] - } - ] - } - } -} \ No newline at end of file diff --git a/test/Altinn.App.Core.Tests/Helpers/TestData/MultiDecisionHelper/multidecision-all-actions-task.golden.json b/test/Altinn.App.Core.Tests/Helpers/TestData/MultiDecisionHelper/multidecision-all-actions-task.golden.json deleted file mode 100644 index 9e31d805d..000000000 --- a/test/Altinn.App.Core.Tests/Helpers/TestData/MultiDecisionHelper/multidecision-all-actions-task.golden.json +++ /dev/null @@ -1,126 +0,0 @@ -{ - "Request": { - "ReturnPolicyIdList": false, - "CombinedDecision": false, - "XPathVersion": null, - "Category": null, - "Resource": [ - { - "CategoryId": null, - "Id": "r1", - "Content": null, - "Attribute": [ - { - "AttributeId": "urn:altinn:task", - "Value": "Task_1", - "Issuer": "Altinn", - "DataType": "string", - "IncludeInResult": false - }, - { - "AttributeId": "urn:altinn:instance-id", - "Value": "1337/1dd16477-187b-463c-8adf-592c7fa78459", - "Issuer": "Altinn", - "DataType": "string", - "IncludeInResult": true - }, - { - "AttributeId": "urn:altinn:partyid", - "Value": "1337", - "Issuer": "Altinn", - "DataType": "string", - "IncludeInResult": false - }, - { - "AttributeId": "urn:altinn:org", - "Value": "tdd", - "Issuer": "Altinn", - "DataType": "string", - "IncludeInResult": false - }, - { - "AttributeId": "urn:altinn:app", - "Value": "test-app", - "Issuer": "Altinn", - "DataType": "string", - "IncludeInResult": false - } - ] - } - ], - "Action": [ - { - "CategoryId": null, - "Id": "a1", - "Content": null, - "Attribute": [ - { - "AttributeId": "urn:oasis:names:tc:xacml:1.0:action:action-id", - "Value": "sign", - "Issuer": "Altinn", - "DataType": "string", - "IncludeInResult": true - } - ] - }, - { - "CategoryId": null, - "Id": "a2", - "Content": null, - "Attribute": [ - { - "AttributeId": "urn:oasis:names:tc:xacml:1.0:action:action-id", - "Value": "reject", - "Issuer": "Altinn", - "DataType": "string", - "IncludeInResult": true - } - ] - } - ], - "AccessSubject": [ - { - "CategoryId": null, - "Id": "s1", - "Content": null, - "Attribute": [ - { - "AttributeId": "urn:altinn:partyid", - "Value": "1337", - "Issuer": "LOCAL AUTHORITY", - "DataType": "string", - "IncludeInResult": false - }, - { - "AttributeId": "urn:altinn:authlevel", - "Value": "3", - "Issuer": "LOCAL AUTHORITY", - "DataType": "string", - "IncludeInResult": false - } - ] - } - ], - "RecipientSubject": null, - "IntermediarySubject": null, - "RequestingMachine": null, - "MultiRequests": { - "RequestReference": [ - { - "ReferenceId": [ - "s1", - "a1", - "r1" - ] - }, - { - "ReferenceId": [ - "s1", - "a2", - "r1" - ] - } - ] - } - } -} \ No newline at end of file diff --git a/test/Altinn.App.Core.Tests/Internal/App/TestData/AppMetadata/unmapped-properties.applicationmetadata.expected.json b/test/Altinn.App.Core.Tests/Internal/App/AppMetadataTest.GetApplicationMetadata_deserialize_serialize_unmapped_properties.verified.txt similarity index 98% rename from test/Altinn.App.Core.Tests/Internal/App/TestData/AppMetadata/unmapped-properties.applicationmetadata.expected.json rename to test/Altinn.App.Core.Tests/Internal/App/AppMetadataTest.GetApplicationMetadata_deserialize_serialize_unmapped_properties.verified.txt index db9bb243a..d4b44f610 100644 --- a/test/Altinn.App.Core.Tests/Internal/App/TestData/AppMetadata/unmapped-properties.applicationmetadata.expected.json +++ b/test/Altinn.App.Core.Tests/Internal/App/AppMetadataTest.GetApplicationMetadata_deserialize_serialize_unmapped_properties.verified.txt @@ -1,4 +1,4 @@ -{ +{ "Id": "tdd/bestilling", "Features": { "footer": true, @@ -76,7 +76,7 @@ "EFormidling": null, "MessageBoxConfig": null, "CopyInstanceSettings": null, - "StorageContainerNumber": null, + "StorageAccountNumber": null, "DisallowUserInstantiation": false, "Created": "2019-09-16T22:22:22", "CreatedBy": "username", diff --git a/test/Altinn.App.Core.Tests/Internal/App/AppMetadataTest.cs b/test/Altinn.App.Core.Tests/Internal/App/AppMetadataTest.cs index 5d7ba0bac..33a9a12e3 100644 --- a/test/Altinn.App.Core.Tests/Internal/App/AppMetadataTest.cs +++ b/test/Altinn.App.Core.Tests/Internal/App/AppMetadataTest.cs @@ -475,14 +475,12 @@ public async Task GetApplicationMetadata_deserialize_serialize_unmapped_properti IAppMetadata appMetadata = SetupAppMetadata(Options.Create(appSettings)); var appMetadataObj = await appMetadata.GetApplicationMetadata(); string serialized = JsonSerializer.Serialize(appMetadataObj, _jsonSerializerOptions); - string expected = File.ReadAllText( - Path.Join(_appBasePath, "AppMetadata", "unmapped-properties.applicationmetadata.expected.json") + serialized = serialized.Replace( + typeof(ApplicationMetadata).Assembly!.GetName().Version!.ToString(), + "--AltinnNugetVersion--" ); - expected = expected.Replace( - "--AltinnNugetVersion--", - typeof(ApplicationMetadata).Assembly!.GetName().Version!.ToString() - ); - serialized.Trim().Should().Be(expected.Trim()); + + await Verify(serialized); } [Fact]