diff --git a/src/Altinn.App.Core/Features/DataProcessing/DataModelFieldCalculator.cs b/src/Altinn.App.Core/Features/DataProcessing/DataModelFieldCalculator.cs index 08b174ba36..f73d007bcd 100644 --- a/src/Altinn.App.Core/Features/DataProcessing/DataModelFieldCalculator.cs +++ b/src/Altinn.App.Core/Features/DataProcessing/DataModelFieldCalculator.cs @@ -1,8 +1,9 @@ -using System.Text.Json; using Altinn.App.Core.Internal.App; using Altinn.App.Core.Internal.Data; using Altinn.App.Core.Internal.Expressions; using Altinn.App.Core.Models; +using Altinn.App.Core.Models.Calculation; +using Altinn.App.Core.Models.Expressions; using Altinn.App.Core.Models.Layout; using Altinn.Platform.Storage.Interface.Models; using Microsoft.Extensions.Logging; @@ -12,12 +13,6 @@ namespace Altinn.App.Core.Features.DataProcessing; internal sealed class DataModelFieldCalculator { - private static readonly JsonSerializerOptions _jsonSerializerOptions = new() - { - ReadCommentHandling = JsonCommentHandling.Skip, - PropertyNamingPolicy = JsonNamingPolicy.CamelCase, - }; - private readonly ILogger _logger; private readonly IAppResources _appResourceService; private readonly IDataElementAccessChecker _dataElementAccessChecker; @@ -46,27 +41,26 @@ public async Task Calculate(IInstanceDataAccessor dataAccessor, string taskId) continue; } - var calculationConfig = _appResourceService.GetCalculationConfiguration(dataType.Id); - if (!string.IsNullOrEmpty(calculationConfig)) + var calculationSchema = _appResourceService.GetCalculationConfiguration(dataType.Id); + if (calculationSchema is not null) { - await CalculateFormData(dataAccessor, dataElement, calculationConfig); + await CalculateFormData(dataAccessor, dataElement, calculationSchema); } } } - internal async Task CalculateFormData( + private async Task CalculateFormData( IInstanceDataAccessor dataAccessor, DataElement dataElement, - string rawCalculationConfig + CalculationSchema calculationSchema ) { DataElementIdentifier dataElementIdentifier = dataElement; - var dataModelFieldCalculations = ParseDataModelFieldCalculationConfig(rawCalculationConfig); var formDataWrapper = await dataAccessor.GetFormDataWrapper(dataElement); - foreach (var (baseField, calculation) in dataModelFieldCalculations) + foreach (var calculation in calculationSchema.Calculations) { - var resolvedFields = formDataWrapper.GetResolvedKeys(baseField); + var resolvedFields = formDataWrapper.GetResolvedKeys(calculation.Field); foreach (var resolvedField in resolvedFields) { var resolvedFieldReference = new DataReference() @@ -88,7 +82,7 @@ await RunCalculation( formDataWrapper, resolvedFieldReference, positionalArguments, - calculation + calculation.Expression ); } } @@ -100,14 +94,14 @@ private async Task RunCalculation( IFormDataWrapper formDataWrapper, DataReference resolvedField, ExpressionValue[] positionalArguments, - DataModelFieldCalculation calculation + Expression calculation ) { try { var calculationResult = await ExpressionEvaluator.EvaluateExpressionToExpressionValue( dataAccessor, - calculation.Expression, + calculation, context, positionalArguments ); @@ -127,72 +121,4 @@ DataModelFieldCalculation calculation throw; } } - - private Dictionary ParseDataModelFieldCalculationConfig( - string rawCalculationConfig - ) - { - JsonDocument calculationConfigDocument; - try - { - calculationConfigDocument = JsonDocument.Parse( - rawCalculationConfig, - new JsonDocumentOptions { CommentHandling = JsonCommentHandling.Skip } - ); - } - catch (JsonException e) - { - _logger.LogError(e, "Failed to parse calculation configuration JSON"); - return new Dictionary(); - } - using (calculationConfigDocument) - { - var dataModelFieldCalculations = new Dictionary(); - var hasCalculations = calculationConfigDocument.RootElement.TryGetProperty( - "calculations", - out JsonElement calculationsObject - ); - if (hasCalculations) - { - foreach (var calculationArray in calculationsObject.EnumerateObject()) - { - var field = calculationArray.Name; - var calculation = calculationArray.Value; - var resolvedDataModelFieldCalculation = ResolveDataModelFieldCalculation(field, calculation); - if (resolvedDataModelFieldCalculation == null) - { - _logger.LogError("Calculation for field {Field} could not be resolved", field); - continue; - } - dataModelFieldCalculations[field] = resolvedDataModelFieldCalculation; - } - } - return dataModelFieldCalculations; - } - } - - private DataModelFieldCalculation? ResolveDataModelFieldCalculation(string field, JsonElement definition) - { - var dataModelFieldCalculationDefinition = definition.Deserialize( - _jsonSerializerOptions - ); - if (dataModelFieldCalculationDefinition == null) - { - _logger.LogError("Calculation for field {Field} could not be parsed", field); - return null; - } - - if (dataModelFieldCalculationDefinition.Expression == null) - { - _logger.LogError("Calculation for field {Field} is missing expression", field); - return null; - } - - var dataModelFieldCalculation = new DataModelFieldCalculation - { - Expression = dataModelFieldCalculationDefinition.Expression.Value, - }; - - return dataModelFieldCalculation; - } } diff --git a/src/Altinn.App.Core/Helpers/Extensions/Utf8JsonReaderExtentions.cs b/src/Altinn.App.Core/Helpers/Extensions/Utf8JsonReaderExtentions.cs index bc4bef8727..03c0487810 100644 --- a/src/Altinn.App.Core/Helpers/Extensions/Utf8JsonReaderExtentions.cs +++ b/src/Altinn.App.Core/Helpers/Extensions/Utf8JsonReaderExtentions.cs @@ -1,3 +1,4 @@ +using System.Text; using System.Text.Json; namespace Altinn.App.Core.Helpers.Extensions; @@ -13,7 +14,14 @@ internal static string SkipReturnString(this ref Utf8JsonReader reader) Copy(ref reader, writer); writer.Flush(); - return System.Text.Encoding.UTF8.GetString(stream.ToArray()); + return Encoding.UTF8.GetString(stream.ToArray()); + } + + internal static void WriteRawFormattedValue(this Utf8JsonWriter writer, string json) + { + var jsonReader = new Utf8JsonReader(Encoding.UTF8.GetBytes(json), isFinalBlock: true, state: default); + jsonReader.Read(); // Need to read first token to initialize the reader + Copy(ref jsonReader, writer); } private static void Copy(ref Utf8JsonReader reader, Utf8JsonWriter writer) @@ -21,8 +29,7 @@ private static void Copy(ref Utf8JsonReader reader, Utf8JsonWriter writer) switch (reader.TokenType) { case JsonTokenType.None: - writer.WriteNullValue(); - break; + throw new JsonException("Reader is not initialized"); case JsonTokenType.StartObject: writer.WriteStartObject(); while (reader.Read()) @@ -41,9 +48,13 @@ private static void Copy(ref Utf8JsonReader reader, Utf8JsonWriter writer) writer.WriteEndObject(); return; default: - throw new JsonException($"Something is wrong, did not expect {reader.TokenType} here2"); + throw new JsonException($"Something is wrong, did not expect {reader.TokenType} here"); } } + if (reader.TokenType != JsonTokenType.EndObject) + { + throw new JsonException("Something is wrong, did not find end of object"); + } break; case JsonTokenType.StartArray: writer.WriteStartArray(); @@ -52,6 +63,10 @@ private static void Copy(ref Utf8JsonReader reader, Utf8JsonWriter writer) Copy(ref reader, writer); } writer.WriteEndArray(); + if (reader.TokenType != JsonTokenType.EndArray) + { + throw new JsonException("Something is wrong, did not find end of array"); + } break; case JsonTokenType.Comment: writer.WriteCommentValue(reader.ValueSpan); @@ -60,7 +75,14 @@ private static void Copy(ref Utf8JsonReader reader, Utf8JsonWriter writer) writer.WriteStringValue(reader.ValueSpan); break; case JsonTokenType.Number: - writer.WriteNumberValue(reader.GetDouble()); + if (reader.HasValueSequence) + { + writer.WriteRawValue(reader.ValueSequence); + } + else + { + writer.WriteRawValue(reader.ValueSpan); + } break; case JsonTokenType.True: writer.WriteBooleanValue(true); diff --git a/src/Altinn.App.Core/Implementation/AppResourcesSI.cs b/src/Altinn.App.Core/Implementation/AppResourcesSI.cs index 81fdacf26e..d65e774dcc 100644 --- a/src/Altinn.App.Core/Implementation/AppResourcesSI.cs +++ b/src/Altinn.App.Core/Implementation/AppResourcesSI.cs @@ -5,6 +5,7 @@ using Altinn.App.Core.Helpers; using Altinn.App.Core.Internal.App; using Altinn.App.Core.Models; +using Altinn.App.Core.Models.Calculation; using Altinn.App.Core.Models.Layout; using Altinn.App.Core.Models.Layout.Components; using Altinn.Platform.Storage.Interface.Models; @@ -541,19 +542,20 @@ private static byte[] ReadFileContentsFromLegalPath(string legalPath, string fil } /// - public string? GetCalculationConfiguration(string dataTypeId) + public CalculationSchema? GetCalculationConfiguration(string dataTypeId) { using var activity = _telemetry?.StartGetCalculationConfigurationActivity(); string legalPath = Path.Join(_settings.AppBasePath, _settings.ModelsFolder); string filename = Path.Join(legalPath, $"{dataTypeId}.{_settings.CalculationConfigurationFileName}"); PathHelper.EnsureLegalPath(legalPath, filename); - string? fileData = null; - if (File.Exists(filename)) + if (!File.Exists(filename)) { - fileData = File.ReadAllText(filename, Encoding.UTF8); + return null; } - return fileData; + return System.Text.Json.JsonSerializer.Deserialize( + File.ReadAllText(filename, Encoding.UTF8) + ); } } diff --git a/src/Altinn.App.Core/Internal/App/IAppResources.cs b/src/Altinn.App.Core/Internal/App/IAppResources.cs index 4f4eeb6f1b..e88c35c0a5 100644 --- a/src/Altinn.App.Core/Internal/App/IAppResources.cs +++ b/src/Altinn.App.Core/Internal/App/IAppResources.cs @@ -1,4 +1,5 @@ using Altinn.App.Core.Models; +using Altinn.App.Core.Models.Calculation; using Altinn.App.Core.Models.Layout; using Altinn.Platform.Storage.Interface.Models; @@ -177,5 +178,5 @@ public interface IAppResources /// Gets the calculation configuration for a given data type /// /// The calculation configuration in JSON format represented as string - string? GetCalculationConfiguration(string dataTypeId); + CalculationSchema? GetCalculationConfiguration(string dataTypeId); } diff --git a/src/Altinn.App.Core/Internal/Expressions/ExpressionValue.cs b/src/Altinn.App.Core/Internal/Expressions/ExpressionValue.cs index 7cb0d414c5..b59b34ddd9 100644 --- a/src/Altinn.App.Core/Internal/Expressions/ExpressionValue.cs +++ b/src/Altinn.App.Core/Internal/Expressions/ExpressionValue.cs @@ -1,3 +1,4 @@ +using System.Collections; using System.Diagnostics; using System.Globalization; using System.Numerics; @@ -12,7 +13,7 @@ namespace Altinn.App.Core.Internal.Expressions; /// Discriminated union for the JSON types that can be arguments and result of expressions /// [JsonConverter(typeof(ExpressionTypeUnionConverter))] -[DebuggerDisplay("{ToString(),nq}")] +[DebuggerDisplay("{ToStringForText(),nq}")] public readonly struct ExpressionValue : IEquatable { private readonly string? _stringValue = null; @@ -22,10 +23,10 @@ namespace Altinn.App.Core.Internal.Expressions; private readonly double _numberValue = 0; /// - /// Constructor for NULL value (structs require a public parameterless constructor) + /// Constructor for Undefined value (structs require a public parameterless constructor) /// public ExpressionValue() - : this(JsonValueKind.Null) { } + : this(JsonValueKind.Undefined) { } private ExpressionValue(JsonValueKind valueKind) { @@ -622,6 +623,28 @@ public bool TryDeserialize(Type type, out object? result) return false; } } + case JsonValueKind.Array when underlyingType.IsAssignableTo(typeof(IEnumerable)): + case JsonValueKind.Object: + try + { + // For complex types we serialize the expressionValue to json + // and then deserialize to the target type. + // This allows us to leverage the normal JSON deserialization rules and also handle cases where the + // ValueKind doesn't exactly match the target type (e.g., deserialize a JsonObject to a Dictionary or similar) + var json = JsonSerializer.SerializeToUtf8Bytes(this); + result = JsonSerializer.Deserialize(json, type); + return true; + } + catch (JsonException) + { + result = null; + return false; + } + catch (NotSupportedException) + { + result = null; + return false; + } } // Add special handling for bool to support loose conversion rules @@ -707,7 +730,7 @@ public static ExpressionValue FromJsonString(string jsonString) return new(doc.RootElement); } - internal void WriteJson(Utf8JsonWriter writer, JsonSerializerOptions options) + internal void WriteJson(Utf8JsonWriter writer) { switch (ValueKind) { @@ -729,7 +752,8 @@ internal void WriteJson(Utf8JsonWriter writer, JsonSerializerOptions options) break; case JsonValueKind.Object: case JsonValueKind.Array: - writer.WriteRawValue(_stringValueNotNull); + // writer.WriteRawFormattedValue(_stringValueNotNull); + JsonSerializer.Serialize(writer, JsonElement); break; default: throw new JsonException(); @@ -768,5 +792,5 @@ public override ExpressionValue Read(ref Utf8JsonReader reader, Type typeToConve /// public override void Write(Utf8JsonWriter writer, ExpressionValue value, JsonSerializerOptions options) => - value.WriteJson(writer, options); + value.WriteJson(writer); } diff --git a/src/Altinn.App.Core/Models/Calculation/CalculationItem.cs b/src/Altinn.App.Core/Models/Calculation/CalculationItem.cs new file mode 100644 index 0000000000..7b31e4ff52 --- /dev/null +++ b/src/Altinn.App.Core/Models/Calculation/CalculationItem.cs @@ -0,0 +1,23 @@ +using System.Text.Json.Serialization; +using Altinn.App.Core.Models.Expressions; + +namespace Altinn.App.Core.Models.Calculation; + +/// +/// Calculation item in the calculation configuration +/// +public class CalculationItem +{ + /// + /// The base field to be calculated. + /// Note that missing indexes will be added to the field name when calculating array items. For example, if the field is "myArray[].myField", the calculation will be applied to all items in the array. + /// + [JsonPropertyName("field")] + public required string Field { get; init; } + + /// + /// The expression to be used for the calculation. Note that this will be run in the context of the field, so you can use relative paths in the expression. + /// + [JsonPropertyName("expression")] + public required Expression Expression { get; init; } +} diff --git a/src/Altinn.App.Core/Models/Calculation/CalculationSchema.cs b/src/Altinn.App.Core/Models/Calculation/CalculationSchema.cs new file mode 100644 index 0000000000..eb1a947130 --- /dev/null +++ b/src/Altinn.App.Core/Models/Calculation/CalculationSchema.cs @@ -0,0 +1,21 @@ +using System.Text.Json.Serialization; + +namespace Altinn.App.Core.Models.Calculation; + +/// +/// Represents the schema for the calculation configuration +/// +public class CalculationSchema +{ + /// + /// Gets the schema for the calculation configuration. + /// + [JsonPropertyName("$schema")] + public string Schema => + "https://altinncdn.no/toolkits/altinn-app-frontend/4/schemas/json/calculation/calculation.schema.v1.json"; + + /// + /// Gets or sets the list of calculation items in the calculation configuration. + /// + public required List Calculations { get; init; } +} diff --git a/src/Altinn.App.Core/Models/DataElementIdentifier.cs b/src/Altinn.App.Core/Models/DataElementIdentifier.cs index ca5a655ea4..0291616cd7 100644 --- a/src/Altinn.App.Core/Models/DataElementIdentifier.cs +++ b/src/Altinn.App.Core/Models/DataElementIdentifier.cs @@ -1,3 +1,6 @@ +using System.Diagnostics; +using System.Text.Json; +using System.Text.Json.Serialization; using Altinn.Platform.Storage.Interface.Models; namespace Altinn.App.Core.Models; @@ -5,6 +8,7 @@ namespace Altinn.App.Core.Models; /// /// Wrapper type for a as Guid and string /// +[JsonConverter(typeof(DataElementIdentifierConverter))] public readonly struct DataElementIdentifier : IEquatable { /// @@ -109,4 +113,36 @@ public override int GetHashCode() { return Guid.GetHashCode(); } + + /// + /// Custom JSON converter to ensure that the struct is serialized and deserialized as a string containing the guid, to be compatible with existing code that uses strings for DataElement IDs + /// + public class DataElementIdentifierConverter : JsonConverter + { + /// + public override DataElementIdentifier Read( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + if (reader.TokenType != JsonTokenType.String) + { + throw new JsonException( + $"Unexpected token parsing DataElementIdentifier. Expected String, got {reader.TokenType}." + ); + } + + string id = + reader.GetString() + ?? throw new UnreachableException("GetString should not return null when the token type is String"); + return new DataElementIdentifier(id); + } + + /// + public override void Write(Utf8JsonWriter writer, DataElementIdentifier value, JsonSerializerOptions options) + { + writer.WriteStringValue(value.ToString()); + } + } } diff --git a/src/Altinn.App.Core/Models/RawDataModelFieldCalculation.cs b/src/Altinn.App.Core/Models/RawDataModelFieldCalculation.cs deleted file mode 100644 index 31a5609ca3..0000000000 --- a/src/Altinn.App.Core/Models/RawDataModelFieldCalculation.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Altinn.App.Core.Models.Expressions; - -namespace Altinn.App.Core.Models; - -/// -/// Resolved data field calculation -/// -internal sealed class DataModelFieldCalculation -{ - /// - /// Expression to evaluate - /// - public required Expression Expression { get; set; } -} - -/// -/// Raw value calculation expression from the calculation configuration file -/// -internal sealed class RawDataModelFieldCalculation -{ - /// - /// Expression to evaluate - /// - public Expression? Expression { get; set; } -} diff --git a/test/Altinn.App.Core.Tests/Features/DataProcessing/DataModelFieldCalculatorTests.cs b/test/Altinn.App.Core.Tests/Features/DataProcessing/DataModelFieldCalculatorTests.cs index 43a310f8ae..09d525375d 100644 --- a/test/Altinn.App.Core.Tests/Features/DataProcessing/DataModelFieldCalculatorTests.cs +++ b/test/Altinn.App.Core.Tests/Features/DataProcessing/DataModelFieldCalculatorTests.cs @@ -7,11 +7,12 @@ using Altinn.App.Core.Internal.Expressions; using Altinn.App.Core.Internal.Texts; using Altinn.App.Core.Models; +using Altinn.App.Core.Models.Calculation; using Altinn.App.Core.Models.Layout; +using Altinn.App.Core.Tests.LayoutExpressions.CommonTests; using Altinn.App.Core.Tests.LayoutExpressions.TestUtilities; using Altinn.App.Core.Tests.TestUtils; using Altinn.Platform.Storage.Interface.Models; -using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Testing; using Microsoft.Extensions.Options; using Moq; @@ -22,6 +23,7 @@ namespace Altinn.App.Core.Tests.Features.DataProcessing; public sealed class DataModelFieldCalculatorTests { + const string TaskId = "Task_1"; private readonly ITestOutputHelper _output; private readonly DataModelFieldCalculator _dataModelFieldCalculator; private readonly FakeLogger _logger = new(); @@ -35,8 +37,11 @@ public sealed class DataModelFieldCalculatorTests PropertyNamingPolicy = JsonNamingPolicy.CamelCase, }; - private DataElement _dataElement = null!; - private IInstanceDataAccessor _instanceDataAccessor = null!; + private readonly DataElement _defaultSingleDataElement = new DataElement + { + Id = "30844cc0-81af-4429-9f9e-035d78f1f9da", + DataType = "default", + }; public DataModelFieldCalculatorTests(ITestOutputHelper output) { @@ -74,11 +79,12 @@ public async Task ShouldLogErrorAndThrowWhenExpressionEvaluatorThrowsException() ], "calculationConfig": { "$schema": "https://altinncdn.no/toolkits/altinn-app-frontend/4/schemas/json/calculation/calculation.schema.v1.json", - "calculations": { - "form.formDataWrapperThrows": { + "calculations": [ + { + "field": "form.formDataWrapperThrows", "expression": ["noneExistingExpression"] } - } + ] }, "formData": { "form": { @@ -94,14 +100,10 @@ public async Task ShouldLogErrorAndThrowWhenExpressionEvaluatorThrowsException() _jsonSerializerOptions )!; - Setup(testCase); + var dataAccessor = Setup(testCase); var exception = await Assert.ThrowsAsync(() => - _dataModelFieldCalculator.CalculateFormData( - _instanceDataAccessor, - _dataElement, - JsonSerializer.Serialize(testCase.CalculationConfig) - ) + _dataModelFieldCalculator.Calculate(dataAccessor, TaskId) ); Assert.Contains(testCase.Expects.First().LogMessage, _logger.Collector.GetSnapshot().Select(x => x.Message)); @@ -115,7 +117,11 @@ public async Task ShouldLogErrorAndThrowWhenExpressionEvaluatorThrowsException() [FileNamesInFolderData(["Features", "DataProcessing", "data-field-value-calculator-tests", "assert-logger"])] public async Task RunDataModelFieldCalculationTestsThatAssertLogger(string fileName, string folder) { - var (_, testCase) = await RunDataModelFieldCalculatorTest(fileName, folder); + var testCase = await LoadData(fileName, folder); + + var dataAccessor = Setup(testCase); + + await _dataModelFieldCalculator.Calculate(dataAccessor, TaskId); foreach (var expected in testCase.Expects) { @@ -127,13 +133,21 @@ public async Task RunDataModelFieldCalculationTestsThatAssertLogger(string fileN [FileNamesInFolderData(["Features", "DataProcessing", "data-field-value-calculator-tests"])] public async Task RunDataModelFieldCalculationTests(string fileName, string folder) { - var (result, testCase) = await RunDataModelFieldCalculatorTest(fileName, folder); + var testCase = await LoadData(fileName, folder); + + var dataAccessor = Setup(testCase); + + await _dataModelFieldCalculator.Calculate(dataAccessor, TaskId); + Assert.Empty(_logger.Collector.GetSnapshot()); foreach (var expected in testCase.Expects) { + var dataElementIdentifier = expected.DataElementIdentifier ?? _defaultSingleDataElement; if (expected.Result.HasValue) { - Assert.Equal(expected.Result.Value.ToObject(), result.Get(expected.Field)); + var formDataWrapper = await dataAccessor.GetFormDataWrapper(dataElementIdentifier); + var value = formDataWrapper.Get(expected.Field); + Assert.Equal(JsonSerializer.Serialize(expected.Result.Value), JsonSerializer.Serialize(value)); Assert.Empty(_logger.Collector.GetSnapshot()); } else @@ -143,49 +157,19 @@ public async Task RunDataModelFieldCalculationTests(string fileName, string fold } } - private async Task<(IFormDataWrapper, DataModelFieldCalculatorTestModel)> RunDataModelFieldCalculatorTest( - string fileName, - string folder - ) - { - var testCase = await LoadData(fileName, folder); - - Setup(testCase); - - await _dataModelFieldCalculator.CalculateFormData( - _instanceDataAccessor, - _dataElement, - JsonSerializer.Serialize(testCase.CalculationConfig) - ); - - var formDataWrapper = await _instanceDataAccessor.GetFormDataWrapper(_dataElement); - - return (formDataWrapper, testCase); - } - - private void Setup(DataModelFieldCalculatorTestModel testCase) + private IInstanceDataAccessor Setup(DataModelFieldCalculatorTestModel testCase) { - var instance = new Instance() { Id = "1337/fa0678ad-960d-4307-aba2-ba29c9804c9d", AppId = "org/app" }; - var dataType = new DataType() { Id = "default" }; - - _dataElement = new DataElement { Id = "30844cc0-81af-4429-9f9e-035d78f1f9da", DataType = "default" }; - var layout = new LayoutSetComponent(testCase.Layouts, "layout", dataType); - var componentModel = new LayoutModel([layout], null); + var instance = new Instance() + { + Id = "1337/fa0678ad-960d-4307-aba2-ba29c9804c9d", + AppId = "org/app", + Process = new() { CurrentTask = new() { ElementId = TaskId } }, + }; var translationService = new TranslationService( new AppIdentifier("org", "app"), _appResources.Object, FakeLoggerXunit.Get(_output) ); - _instanceDataAccessor = DynamicClassBuilder.DataAccessorFromJsonDocument( - instance, - translationService, - componentModel, - new FrontEndSettings(), - testCase.FormData, - gatewayAction: null, - language: null, - _dataElement - ); _appResources .Setup(ar => ar.GetTexts("org", "app", "nb")) @@ -194,6 +178,56 @@ testCase.TextResources is null ? null : new TextResource { Language = "nb", Resources = testCase.TextResources } ); + _appResources + .Setup(ar => ar.GetCalculationConfiguration(It.IsAny())) + .Returns(testCase.CalculationConfig); + + if (testCase.DataModels is not null) + { + Assert.Null(testCase.FormData); + Assert.All(testCase.Expects, e => Assert.NotNull(e.DataElementIdentifier)); + Assert.All(testCase.DataModels, d => Assert.NotNull(d.DataElement.DataType)); + var dataTypes = testCase + .DataModels.Select(d => d.DataElement.DataType) + .Distinct() + .Select(dataTypeId => new DataType() + { + Id = dataTypeId, + MaxCount = 1, + AppLogic = new() { }, + TaskId = TaskId, + }) + .ToList(); + + var layout = new LayoutSetComponent(testCase.Layouts, "layout", dataTypes[0]); + var componentModel = new LayoutModel([layout], null); + + return DynamicClassBuilder.DataAccessorFromJsonDocument( + instance, + translationService, + componentModel, + _frontendSettings.Value, + testCase.DataModels, + gatewayAction: null, + language: null + ); + } + else + { + var dataType = new DataType() { Id = "default", TaskId = TaskId }; + var layout = new LayoutSetComponent(testCase.Layouts, "layout", dataType); + var componentModel = new LayoutModel([layout], null); + return DynamicClassBuilder.DataAccessorFromJsonDocument( + instance, + translationService, + componentModel, + _frontendSettings.Value, + testCase.FormData ?? throw new InvalidOperationException("Either formData or dataModels must be set"), + gatewayAction: null, + language: null, + _defaultSingleDataElement + ); + } } private record DataModelFieldCalculatorTestModel @@ -205,10 +239,16 @@ private record DataModelFieldCalculatorTestModel public required Expected[] Expects { get; set; } [JsonPropertyName("calculationConfig")] - public required JsonElement CalculationConfig { get; set; } + public required CalculationSchema CalculationConfig { get; set; } + // A single data element. Either this or must be set. [JsonPropertyName("formData")] - public required JsonElement FormData { get; set; } + public JsonElement? FormData { get; set; } + + // Multiple data elements. The calculation runs against the first element in the list, + // but expressions may reference the other data models. Either this or must be set. + [JsonPropertyName("dataModels")] + public List? DataModels { get; set; } [JsonPropertyName("layouts")] public required IReadOnlyDictionary Layouts { get; set; } @@ -219,6 +259,8 @@ private record DataModelFieldCalculatorTestModel private record Expected { + public DataElementIdentifier? DataElementIdentifier { get; set; } + public string? Field { get; set; } public ExpressionValue? Result { get; set; } diff --git a/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/assert-logger/parse-none-existing-definition.json b/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/assert-logger/parse-none-existing-definition.json deleted file mode 100644 index 83b9d63ce1..0000000000 --- a/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/assert-logger/parse-none-existing-definition.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "Should log error when trying to parse none existing definition", - "expects": [ - { - "logMessage": "Calculation for field form.noneExistingExpression could not be parsed" - }, - { - "logMessage": "Calculation for field form.noneExistingExpression could not be resolved" - } - ], - "calculationConfig": { - "$schema": "https://altinncdn.no/toolkits/altinn-app-frontend/4/schemas/json/calculation/calculation.schema.v1.json", - "calculations": { - "form.noneExistingExpression": null - } - }, - "formData": { - "form": { - "noneExistingExpression": true - } - }, - "layouts": {} -} diff --git a/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/assert-logger/parse-none-existing-expression.json b/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/assert-logger/parse-none-existing-expression.json deleted file mode 100644 index f4fc211966..0000000000 --- a/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/assert-logger/parse-none-existing-expression.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "Should log error when trying to parse none existing expression", - "expects": [ - { - "logMessage": "Calculation for field form.noneExistingExpression is missing expression" - }, - { - "logMessage": "Calculation for field form.noneExistingExpression could not be resolved" - } - ], - "calculationConfig": { - "$schema": "https://altinncdn.no/toolkits/altinn-app-frontend/4/schemas/json/calculation/calculation.schema.v1.json", - "calculations": { - "form.noneExistingExpression": {} - } - }, - "formData": { - "form": { - "noneExistingExpression": true - } - }, - "layouts": {} -} diff --git a/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/assert-logger/unsupported-data-type.json b/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/assert-logger/unsupported-data-type.json index 12ed160ff2..8f19a1755e 100644 --- a/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/assert-logger/unsupported-data-type.json +++ b/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/assert-logger/unsupported-data-type.json @@ -7,11 +7,12 @@ ], "calculationConfig": { "$schema": "https://altinncdn.no/toolkits/altinn-app-frontend/4/schemas/json/calculation/calculation.schema.v1.json", - "calculations": { - "form.unsupportedDataType": { + "calculations": [ + { + "field": "form.unsupportedDataType", "expression": ["language"] } - } + ] }, "formData": { "form": { diff --git a/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/calclulate-object.json b/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/calclulate-object.json new file mode 100644 index 0000000000..7120a1a381 --- /dev/null +++ b/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/calclulate-object.json @@ -0,0 +1,134 @@ +{ + "name": "Should set multiple values when resolving keys in a datamodel array", + "expects": [ + { + "dataElementIdentifier": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", + "field": "form.children[0]", + "result": { + "price": 200, + "quantity": 2, + "total": 400 + } + }, + { + "dataElementIdentifier": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", + "field": "form.children[1]", + "result": { + "price": 200, + "quantity": 44, + "total": 8800 + } + }, + { + "dataElementIdentifier": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeef", + "field": "form.children[0]", + "result": { + "price": 200, + "quantity": 3, + "total": 600 + } + }, + { + "dataElementIdentifier": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeef", + "field": "form.children[1]", + "result": { + "price": 200, + "quantity": 45, + "total": 9000 + } + } + ], + "calculationConfig": { + "$schema": "https://altinncdn.no/toolkits/altinn-app-frontend/4/schemas/json/calculation/calculation.schema.v1.json", + "calculations": [ + { + "field": "form.children[]", + "expression": [ + "object", + "price", + 200, + "quantity", + [ + "multiply", + [ + "dataModel", + "form.children.quantity" + ] + ], + "total", + [ + "multiply", + 200, + [ + "dataModel", + "form.children.quantity" + ] + ] + ] + } + ] + }, + "dataModels": [ + { + "dataElement":{ + "id": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", + "dataType": "element" + }, + "data": { + "form": { + "children": [ + { + "price": 100, + "quantity": 2, + "total": 0 + }, + { + "price": 5, + "quantity": 44, + "total": 0 + } + ] + } + } + }, + { + "dataElement":{ + "id": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeef", + "dataType": "element" + }, + "data": { + "form": { + "children": [ + { + "price": 50, + "quantity": 3, + "total": 0 + }, + { + "price": 10, + "quantity": 45, + "total": 0 + } + ] + } + } + } + ], + "layouts": { + "Page": { + "$schema": "https://altinncdn.no/toolkits/altinn-app-frontend/4/schemas/json/layout/layout.schema.v1.json", + "data": { + "layout": [ + { + "id": "name-input", + "type": "Input", + "dataModelBindings": { + "simpleBinding": "form.name" + }, + "hidden": true + } + ] + } + } + } +} diff --git a/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/calculate-in-group.json b/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/calculate-in-group.json index 517e217a95..157c88d2b2 100644 --- a/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/calculate-in-group.json +++ b/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/calculate-in-group.json @@ -12,11 +12,12 @@ ], "calculationConfig": { "$schema": "https://altinncdn.no/toolkits/altinn-app-frontend/4/schemas/json/calculation/calculation.schema.v1.json", - "calculations": { - "form.children.total": { + "calculations": [ + { + "field": "form.children.total", "expression": ["multiply", ["dataModel", "form.children.price"], ["dataModel", "form.children.quantity"]] } - } + ] }, "formData": { "form": { diff --git a/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/calculate-list.json b/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/calculate-list.json new file mode 100644 index 0000000000..d4c88f6df7 --- /dev/null +++ b/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/calculate-list.json @@ -0,0 +1,133 @@ +{ + "name": "Should set multiple values when resolving keys in a datamodel array", + "expects": [ + { + "dataElementIdentifier": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", + "field": "form.children[0]", + "result": { + "price": 200, + "quantity": 1, + "total": 200 + } + }, + { + "dataElementIdentifier": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", + "field": "form.children[1]", + "result": { + "price": 200, + "quantity": 2, + "total": 400 + } + }, + { + "dataElementIdentifier": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeef", + "field": "form.children[0]", + "result": { + "price": 200, + "quantity": 1, + "total": 200 + } + }, + { + "dataElementIdentifier": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeef", + "field": "form.children[1]", + "result": { + "price": 200, + "quantity": 2, + "total": 400 + } + } + ], + "calculationConfig": { + "$schema": "https://altinncdn.no/toolkits/altinn-app-frontend/4/schemas/json/calculation/calculation.schema.v1.json", + "calculations": [ + { + "field": "form.children", + "expression": [ + "list", + [ + "object", + "price", + 200, + "quantity", + 1, + "total", + 200 + ], + [ + "object", + "price", + 200, + "quantity", + 2, + "total", + 400 + ] + ] + } + ] + }, + "dataModels": [ + { + "dataElement":{ + "id": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", + "dataType": "element" + }, + "data": { + "form": { + "children": [ + { + "price": 100222, + "quantity": 233, + "total": 0 + }, + { + "price": 5333, + "quantity": 4433, + "total": 0 + } + ] + } + } + }, + { + "dataElement":{ + "id": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeef", + "dataType": "element" + }, + "data": { + "form": { + "children": [ + { + "price": 503, + "quantity": 33, + "total": 330 + }, + { + "price": 13330, + "quantity": 45, + "total": 0 + } + ] + } + } + } + ], + "layouts": { + "Page": { + "$schema": "https://altinncdn.no/toolkits/altinn-app-frontend/4/schemas/json/layout/layout.schema.v1.json", + "data": { + "layout": [ + { + "id": "name-input", + "type": "Input", + "dataModelBindings": { + "simpleBinding": "form.name" + }, + "hidden": true + } + ] + } + } + } +} diff --git a/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/component-lookup-hidden.json b/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/component-lookup-hidden.json index 0b1f445060..3fa722e65a 100644 --- a/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/component-lookup-hidden.json +++ b/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/component-lookup-hidden.json @@ -8,11 +8,12 @@ ], "calculationConfig": { "$schema": "https://altinncdn.no/toolkits/altinn-app-frontend/4/schemas/json/calculation/calculation.schema.v1.json", - "calculations": { - "form.name": { + "calculations": [ + { + "field": "form.name", "expression": "nyVerdi" } - } + ] }, "formData": { "form": { diff --git a/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/hidden-field.json b/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/hidden-field.json index 5c5626ca3e..7e41c70190 100644 --- a/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/hidden-field.json +++ b/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/hidden-field.json @@ -8,11 +8,12 @@ ], "calculationConfig": { "$schema": "https://altinncdn.no/toolkits/altinn-app-frontend/4/schemas/json/calculation/calculation.schema.v1.json", - "calculations": { - "form.name": { + "calculations": [ + { + "field": "form.name", "expression": "nyVerdi" } - } + ] }, "formData": { "form": { diff --git a/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/hidden-page.json b/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/hidden-page.json index 0ecb878aa8..976145376c 100644 --- a/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/hidden-page.json +++ b/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/hidden-page.json @@ -8,11 +8,12 @@ ], "calculationConfig": { "$schema": "https://altinncdn.no/toolkits/altinn-app-frontend/4/schemas/json/calculation/calculation.schema.v1.json", - "calculations": { - "form.name": { + "calculations": [ + { + "field": "form.name", "expression": "newValue" } - } + ] }, "formData": { "form": { diff --git a/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/single-expression-boolean.json b/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/single-expression-boolean.json index 46577b9b21..4b8c92dc30 100644 --- a/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/single-expression-boolean.json +++ b/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/single-expression-boolean.json @@ -16,20 +16,24 @@ ], "calculationConfig": { "$schema": "https://altinncdn.no/toolkits/altinn-app-frontend/4/schemas/json/calculation/calculation.schema.v1.json", - "calculations": { - "form.nameResultBoolean": { + "calculations": [ + { + "field": "form.nameResultBoolean", "expression": ["equals", ["dataModel", "form.name"], "none"] }, - "form.emailResultBoolean": { + { + "field": "form.emailResultBoolean", "expression": ["equals", ["dataModel", "form.email"], "none"] }, - "form.nameResultNumber": { + { + "field": "form.nameResultNumber", "expression": ["equals", ["dataModel", "form.name"], "none"] }, - "form.emailResultNumber": { + { + "field": "form.emailResultNumber", "expression": ["equals", ["dataModel", "form.email"], "none"] } - } + ] }, "formData": { "form": { diff --git a/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/single-expression-number.json b/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/single-expression-number.json index 4dba27e298..e1a27797c3 100644 --- a/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/single-expression-number.json +++ b/test/Altinn.App.Core.Tests/Features/DataProcessing/data-field-value-calculator-tests/single-expression-number.json @@ -10,14 +10,16 @@ ], "calculationConfig": { "$schema": "https://altinncdn.no/toolkits/altinn-app-frontend/4/schemas/json/calculation/calculation.schema.v1.json", - "calculations": { - "form.fourTimesTwoString": { + "calculations": [ + { + "field": "form.fourTimesTwoString", "expression": ["multiply", 4, 2] }, - "form.fourTimesTwoNumber": { + { + "field": "form.fourTimesTwoNumber", "expression": ["multiply", 4, 2] } - } + ] }, "formData": { "form": { diff --git a/test/Altinn.App.Core.Tests/Helpers/Utf8JsonReaderExtensionsTests.cs b/test/Altinn.App.Core.Tests/Helpers/Utf8JsonReaderExtensionsTests.cs index dc525b333b..fd2dc0c5c1 100644 --- a/test/Altinn.App.Core.Tests/Helpers/Utf8JsonReaderExtensionsTests.cs +++ b/test/Altinn.App.Core.Tests/Helpers/Utf8JsonReaderExtensionsTests.cs @@ -36,9 +36,7 @@ public void TestComment() + nl + @" ""data"": [" + nl - + @" /* a comment too */" - + nl - + @" 23" + + @" /* a comment too */23" + nl + @" /* a comment too */" + nl diff --git a/test/Altinn.App.Core.Tests/LayoutExpressions/CommonTests/TestFunctions.cs b/test/Altinn.App.Core.Tests/LayoutExpressions/CommonTests/TestFunctions.cs index 8e3bbe321d..78b2360ef7 100644 --- a/test/Altinn.App.Core.Tests/LayoutExpressions/CommonTests/TestFunctions.cs +++ b/test/Altinn.App.Core.Tests/LayoutExpressions/CommonTests/TestFunctions.cs @@ -312,14 +312,14 @@ private async Task RunTestCase(string testName, ExpressionTestCaseRoot test) } var positionalArguments = test - .PositionalArguments?.Select(e => + .PositionalArguments?.Select(e => e.ValueKind switch { JsonValueKind.String => e.GetString(), JsonValueKind.Number => e.GetDouble(), - JsonValueKind.True => true, - JsonValueKind.False => false, - JsonValueKind.Null => null, + JsonValueKind.True => ExpressionValue.True, + JsonValueKind.False => ExpressionValue.False, + JsonValueKind.Null => ExpressionValue.Null, _ => throw new NotImplementedException($"JsonElement value kind {e.ValueKind} not implemented"), } ) @@ -428,7 +428,7 @@ await RunTestCaseItem( Expression = (Expression)test.Expression, ExpectsFailure = test.ExpectsFailure, }, - state, + dataAccessor, context, positionalArguments ); @@ -438,16 +438,16 @@ await RunTestCaseItem( { foreach (var testCase in test.TestCases) { - await RunTestCaseItem(testCase, state, context, positionalArguments); + await RunTestCaseItem(testCase, dataAccessor, context, positionalArguments); } } } private async Task RunTestCaseItem( ExpressionTestCaseRoot.TestCaseItem test, - LayoutEvaluatorState state, + IInstanceDataAccessor dataAccessor, ComponentContext? context, - object?[]? positionalArguments + ExpressionValue[]? positionalArguments ) { _output.WriteLine(test.Name ?? ""); @@ -458,8 +458,8 @@ private async Task RunTestCaseItem( _output.WriteLine(""); Func act = async () => { - var evaluationResult = await ExpressionEvaluator.EvaluateExpression( - state, + var evaluationResult = await ExpressionEvaluator.EvaluateExpressionToExpressionValue( + dataAccessor, test.Expression, context!, positionalArguments @@ -474,8 +474,8 @@ private async Task RunTestCaseItem( _output.WriteLine($"Expecting success: {test.Expects}"); _output.WriteLine($"Expression: {test.Expression}"); _output.WriteLine(""); - var result = await ExpressionEvaluator.EvaluateExpression( - state, + var result = await ExpressionEvaluator.EvaluateExpressionToExpressionValue( + dataAccessor, test.Expression, context!, positionalArguments @@ -484,25 +484,29 @@ private async Task RunTestCaseItem( switch (test.Expects.ValueKind) { case JsonValueKind.String: - Assert.Equal(test.Expects.GetString(), result); + Assert.Equal(test.Expects.GetString(), result.String); break; case JsonValueKind.True: - Assert.True(result as bool?); + Assert.True(result.Bool); break; case JsonValueKind.False: - Assert.False(result as bool?); + Assert.False(result.Bool); break; case JsonValueKind.Null: - Assert.Null(result); + Assert.Equal(JsonValueKind.Null, result.ValueKind); break; case JsonValueKind.Number: - Assert.Equal(test.Expects.GetDouble(), result); + Assert.Equal(test.Expects.GetDouble(), result.Number); break; case JsonValueKind.Undefined: - + Assert.Equal(JsonValueKind.Undefined, result.ValueKind); + break; default: // Compare serialized json result for object and array - JsonSerializer.Serialize(result).Should().Be(JsonSerializer.Serialize(test.Expects)); + Assert.Equal( + JsonSerializer.Serialize(test.Expects, _jsonSerializerOptions), + JsonSerializer.Serialize(result, _jsonSerializerOptions) + ); break; } } diff --git a/test/Altinn.App.Core.Tests/LayoutExpressions/ExpressionEvaluatorTests/ExpressionValueTests.cs b/test/Altinn.App.Core.Tests/LayoutExpressions/ExpressionEvaluatorTests/ExpressionValueTests.cs index 15e7b6010e..6142cbff7e 100644 --- a/test/Altinn.App.Core.Tests/LayoutExpressions/ExpressionEvaluatorTests/ExpressionValueTests.cs +++ b/test/Altinn.App.Core.Tests/LayoutExpressions/ExpressionEvaluatorTests/ExpressionValueTests.cs @@ -1,5 +1,7 @@ using System.Globalization; +using System.Numerics; using System.Text.Json; +using System.Text.Json.Nodes; using Altinn.App.Core.Internal.Expressions; using Xunit.Abstractions; @@ -287,4 +289,292 @@ private void TestTryDeserialize(ExpressionValue value, T? expected, bool succ Assert.False(success); } } + + [Fact] + public void FromObject_CoversAllSupportedClrTypes() + { + // ExpressionValue passes through unchanged + ExpressionValue existing = "passthrough"; + Assert.Equal(JsonValueKind.String, ExpressionValue.FromObject(existing).ValueKind); + Assert.Equal("passthrough", ExpressionValue.FromObject(existing).String); + + // null + Assert.Equal(JsonValueKind.Null, ExpressionValue.FromObject(null).ValueKind); + + // bool + Assert.True(ExpressionValue.FromObject(true).Bool); + Assert.False(ExpressionValue.FromObject(false).Bool); + + // string + Assert.Equal("test", ExpressionValue.FromObject("test").String); + + // every numeric CLR type maps to a Number + Assert.Equal(JsonValueKind.Number, ExpressionValue.FromObject((float)1.5).ValueKind); + Assert.Equal(JsonValueKind.Number, ExpressionValue.FromObject(2.5d).ValueKind); + Assert.Equal(123, ExpressionValue.FromObject((byte)123).Number); + Assert.Equal(-12, ExpressionValue.FromObject((sbyte)-12).Number); + Assert.Equal(1234, ExpressionValue.FromObject((short)1234).Number); + Assert.Equal(1234, ExpressionValue.FromObject((ushort)1234).Number); + Assert.Equal(123456, ExpressionValue.FromObject(123456).Number); + Assert.Equal(123456, ExpressionValue.FromObject((uint)123456).Number); + Assert.Equal(123456789, ExpressionValue.FromObject((long)123456789).Number); + Assert.Equal(123456789, ExpressionValue.FromObject((ulong)123456789).Number); + Assert.Equal(123.456, ExpressionValue.FromObject((decimal)123.456).Number); + + // date/time types are serialized to their unquoted string representation + Assert.Equal( + "2020-02-03T12:34:56Z", + ExpressionValue.FromObject(DateTime.Parse("2020-02-03T12:34:56Z").ToUniversalTime()).String + ); + Assert.Equal( + "2020-02-03T12:34:56+00:00", + ExpressionValue.FromObject(DateTimeOffset.Parse("2020-02-03T12:34:56+00:00")).String + ); + Assert.Equal("12:34:56", ExpressionValue.FromObject(new TimeSpan(12, 34, 56)).String); + Assert.Equal("12:34:56", ExpressionValue.FromObject(new TimeOnly(12, 34, 56)).String); + Assert.Equal("2020-02-03", ExpressionValue.FromObject(new DateOnly(2020, 2, 3)).String); + + // BigInteger -> string + Assert.Equal( + "123456789012345678901234567890", + ExpressionValue.FromObject(BigInteger.Parse("123456789012345678901234567890")).String + ); + + // JsonNode -> matching value kind + // NB: must be a double-backed node, see comment on JsonNode constructor fragility + JsonNode node = JsonValue.Create(42.0); + Assert.Equal(JsonValueKind.Number, ExpressionValue.FromObject(node).ValueKind); + Assert.Equal(42.0, ExpressionValue.FromObject(node).Number); + + // fallback: arbitrary objects go through JsonSerializer + var fallback = ExpressionValue.FromObject(new { a = 1, b = "x" }); + Assert.Equal(JsonValueKind.Object, fallback.ValueKind); + Assert.Equal("1", fallback.JsonObject["a"]!.ToString()); + Assert.Equal("x", fallback.JsonObject["b"]!.ToString()); + } + + [Fact] + public void NullConstructors_ProduceNullValueKind() + { + bool? nullBool = null; + double? nullDouble = null; + string? nullString = null; + ExpressionValue fromBool = nullBool; + ExpressionValue fromDouble = nullDouble; + ExpressionValue fromString = nullString; + Assert.Equal(JsonValueKind.Null, fromBool.ValueKind); + Assert.Equal(JsonValueKind.Null, fromDouble.ValueKind); + Assert.Equal(JsonValueKind.Null, fromString.ValueKind); + } + + [Fact] + public void ParameterlessConstructor_IsUndefined() + { + Assert.Equal(JsonValueKind.Undefined, new ExpressionValue().ValueKind); + } + + [Fact] + public void ImplicitOperators_JsonNodeAndJsonElement() + { + JsonNode nodeObject = JsonNode.Parse("""{"a":1}""")!; + ExpressionValue fromNode = nodeObject; + Assert.Equal(JsonValueKind.Object, fromNode.ValueKind); + + JsonNode nodeArray = JsonNode.Parse("""[1,2,3]""")!; + fromNode = nodeArray; + Assert.Equal(JsonValueKind.Array, fromNode.ValueKind); + + using var docObject = JsonDocument.Parse("""{"a":1}"""); + ExpressionValue fromElement = docObject.RootElement; + Assert.Equal(JsonValueKind.Object, fromElement.ValueKind); + + using var docArray = JsonDocument.Parse("[1,2,3]"); + fromElement = docArray.RootElement; + Assert.Equal(JsonValueKind.Array, fromElement.ValueKind); + } + + [Fact] + public void JsonNodeConstructor_CoversAllValueKinds() + { + Assert.Equal(JsonValueKind.String, ((ExpressionValue)JsonNode.Parse("\"s\"")!).ValueKind); + Assert.Equal(JsonValueKind.Number, ((ExpressionValue)JsonNode.Parse("42")!).ValueKind); + Assert.Equal(JsonValueKind.True, ((ExpressionValue)JsonNode.Parse("true")!).ValueKind); + Assert.Equal(JsonValueKind.False, ((ExpressionValue)JsonNode.Parse("false")!).ValueKind); + Assert.Equal(JsonValueKind.Object, ((ExpressionValue)JsonNode.Parse("{}")!).ValueKind); + Assert.Equal(JsonValueKind.Array, ((ExpressionValue)JsonNode.Parse("[]")!).ValueKind); + } + + [Fact] + public void FromJsonString_ParsesAllKinds() + { + Assert.Equal(JsonValueKind.String, ExpressionValue.FromJsonString("\"hello\"").ValueKind); + Assert.Equal("hello", ExpressionValue.FromJsonString("\"hello\"").String); + Assert.Equal(42, ExpressionValue.FromJsonString("42").Number); + Assert.Equal(JsonValueKind.True, ExpressionValue.FromJsonString("true").ValueKind); + Assert.Equal(JsonValueKind.False, ExpressionValue.FromJsonString("false").ValueKind); + Assert.Equal(JsonValueKind.Null, ExpressionValue.FromJsonString("null").ValueKind); + Assert.Equal(JsonValueKind.Object, ExpressionValue.FromJsonString("{\"a\":1}").ValueKind); + Assert.Equal(JsonValueKind.Array, ExpressionValue.FromJsonString("[1,2]").ValueKind); + } + + [Fact] + public void JsonNodeProperty_CoversAllValueKinds() + { + Assert.Equal("test", ((ExpressionValue)"test").JsonNode!.GetValue()); + Assert.Equal(123.0, ((ExpressionValue)(double?)123).JsonNode!.GetValue()); + Assert.True(ExpressionValue.True.JsonNode!.GetValue()); + Assert.False(ExpressionValue.False.JsonNode!.GetValue()); + Assert.Null(ExpressionValue.Null.JsonNode); + Assert.Null(ExpressionValue.Undefined.JsonNode); + Assert.IsAssignableFrom(ExpressionValue.FromJsonString("{\"a\":1}").JsonNode); + Assert.IsAssignableFrom(ExpressionValue.FromJsonString("[1,2]").JsonNode); + } + + [Fact] + public void JsonObjectAndJsonArray_ReturnParsedNodes() + { + var obj = ExpressionValue.FromJsonString("{\"a\":1,\"b\":2}").JsonObject; + Assert.Equal(2, obj.Count); + Assert.Equal(1, obj["a"]!.GetValue()); + + var arr = ExpressionValue.FromJsonString("[1,2,3]").JsonArray; + Assert.Equal(3, arr.Count); + } + + [Fact] + public void JsonElementProperty_CoversAllValueKinds() + { + Assert.Equal(JsonValueKind.String, ((ExpressionValue)"s").JsonElement.ValueKind); + Assert.Equal(JsonValueKind.Number, ((ExpressionValue)(double?)1).JsonElement.ValueKind); + Assert.Equal(JsonValueKind.True, ExpressionValue.True.JsonElement.ValueKind); + Assert.Equal(JsonValueKind.False, ExpressionValue.False.JsonElement.ValueKind); + Assert.Equal(JsonValueKind.Null, ExpressionValue.Null.JsonElement.ValueKind); + Assert.Equal(JsonValueKind.Undefined, ExpressionValue.Undefined.JsonElement.ValueKind); + Assert.Equal(JsonValueKind.Object, ExpressionValue.FromJsonString("{\"a\":1}").JsonElement.ValueKind); + Assert.Equal(JsonValueKind.Array, ExpressionValue.FromJsonString("[1,2]").JsonElement.ValueKind); + } + + [Fact] + public void ToString_CoversAllValueKinds() + { + Assert.Equal("null", ExpressionValue.Null.ToString()); + Assert.Equal("undefined", ExpressionValue.Undefined.ToString()); + Assert.Equal("true", ExpressionValue.True.ToString()); + Assert.Equal("false", ExpressionValue.False.ToString()); + Assert.Equal("\"s\"", ((ExpressionValue)"s").ToString()); + Assert.Equal("1.5", ((ExpressionValue)(double?)1.5).ToString()); + Assert.Equal("{\"a\":1}", ExpressionValue.FromJsonString("{\"a\":1}").ToString()); + Assert.Equal("[1,2]", ExpressionValue.FromJsonString("[1,2]").ToString()); + } + + [Fact] + public void ToStringForText_CoversAllValueKinds() + { + Assert.Null(ExpressionValue.Null.ToStringForText()); + Assert.Equal("undefined", ExpressionValue.Undefined.ToStringForText()); + Assert.Equal("true", ExpressionValue.True.ToStringForText()); + Assert.Equal("false", ExpressionValue.False.ToStringForText()); + // String is returned unquoted (different from ToString) + Assert.Equal("s", ((ExpressionValue)"s").ToStringForText()); + Assert.Equal("1.5", ((ExpressionValue)(double?)1.5).ToStringForText()); + Assert.Equal("{\"a\":1}", ExpressionValue.FromJsonString("{\"a\":1}").ToStringForText()); + } + + [Fact] + public void ToStringForEquals_CoversAllValueKinds() + { + Assert.Null(ExpressionValue.Null.ToStringForEquals()); + Assert.Null(ExpressionValue.Undefined.ToStringForEquals()); + Assert.Equal("true", ExpressionValue.True.ToStringForEquals()); + Assert.Equal("false", ExpressionValue.False.ToStringForEquals()); + Assert.Equal("1.5", ((ExpressionValue)(double?)1.5).ToStringForEquals()); + // Strings that look like primitives are normalized (case-insensitive) + Assert.Equal("true", ((ExpressionValue)"TruE").ToStringForEquals()); + Assert.Equal("false", ((ExpressionValue)"FALSE").ToStringForEquals()); + Assert.Null(((ExpressionValue)"NULL").ToStringForEquals()); + Assert.Equal("other", ((ExpressionValue)"other").ToStringForEquals()); + Assert.Equal("{\"a\":1}", ExpressionValue.FromJsonString("{\"a\":1}").ToStringForEquals()); + Assert.Equal("[1,2]", ExpressionValue.FromJsonString("[1,2]").ToStringForEquals()); + } + + [Fact] + public void Equals_ReturnsFalseForNonExpressionValue() + { + // Equals(object) short-circuits before the throwing Equals(ExpressionValue) overload + Assert.False(ExpressionValue.Null.Equals((object)"not an expression value")); + Assert.False(ExpressionValue.Null.Equals((object?)null)); + } + + [Fact] + public void ToBoolLoose_CoversAllValueKinds() + { + Assert.False(ExpressionValue.Null.ToBoolLoose()); + Assert.Null(ExpressionValue.Undefined.ToBoolLoose()); + Assert.True(ExpressionValue.True.ToBoolLoose()); + Assert.False(ExpressionValue.False.ToBoolLoose()); + Assert.True(((ExpressionValue)"true").ToBoolLoose()); + Assert.False(((ExpressionValue)"false").ToBoolLoose()); + Assert.True(((ExpressionValue)"1").ToBoolLoose()); + Assert.False(((ExpressionValue)"0").ToBoolLoose()); + Assert.True(((ExpressionValue)"TRUE").ToBoolLoose()); + Assert.False(((ExpressionValue)"FALSE").ToBoolLoose()); + Assert.Null(((ExpressionValue)"maybe").ToBoolLoose()); + // Strings that aren't literally "1"/"0" but parse numerically to 1/0 hit the ParseNumber fallback + Assert.True(((ExpressionValue)"1.0").ToBoolLoose()); + Assert.False(((ExpressionValue)"0.0").ToBoolLoose()); + Assert.Null(((ExpressionValue)"7").ToBoolLoose()); + Assert.True(((ExpressionValue)(double?)1).ToBoolLoose()); + Assert.False(((ExpressionValue)(double?)0).ToBoolLoose()); + Assert.Null(((ExpressionValue)(double?)5).ToBoolLoose()); + // Object/Array are not boolean-convertible + Assert.Null(ExpressionValue.FromJsonString("{}").ToBoolLoose()); + Assert.Null(ExpressionValue.FromJsonString("[]").ToBoolLoose()); + } + + [Fact] + public void TryDeserialize_ArraysAndObjects() + { + // Array into a List + Assert.True(ExpressionValue.FromJsonString("[1,2,3]").TryDeserialize>(out var list)); + Assert.Equal(new List { 1, 2, 3 }, list); + + // Array into a non-enumerable type fails (falls through all branches) + Assert.False(ExpressionValue.FromJsonString("[1,2,3]").TryDeserialize(out _)); + + // Object into a Dictionary + Assert.True( + ExpressionValue.FromJsonString("{\"a\":1,\"b\":2}").TryDeserialize>(out var dict) + ); + Assert.Equal(2, dict!["b"]); + + // Object into an incompatible shape fails gracefully (caught JsonException) + Assert.False(ExpressionValue.FromJsonString("{\"a\":1}").TryDeserialize>(out _)); + + // Deserializing an object to an unsupported (abstract) type triggers the caught NotSupportedException + Assert.False(ExpressionValue.FromJsonString("{\"a\":1}").TryDeserialize(out _)); + } + + [Fact] + public void TryDeserialize_NonNullableValueTypeFromNullOrUndefined_Fails() + { + Assert.False(ExpressionValue.Null.TryDeserialize(out _)); + Assert.False(ExpressionValue.Undefined.TryDeserialize(out _)); + } + + [Fact] + public void TryDeserialize_StringToUnsupportedType_Fails() + { + // The string fallback path serializes the value and deserializes to the target type; + // a target type with no supported converter (System.Type) surfaces a NotSupportedException + // that is caught and reported as failure + Assert.False(((ExpressionValue)"hello").TryDeserialize(out _)); + } + + [Fact] + public void ToObject_NullReturnsNull() + { +#pragma warning disable CS0618 // ToObject is obsolete + Assert.Null(ExpressionValue.Null.ToObject()); +#pragma warning restore CS0618 + } } diff --git a/test/Altinn.App.Core.Tests/PublicApiTests.PublicApi_ShouldNotChange_Unintentionally.verified.txt b/test/Altinn.App.Core.Tests/PublicApiTests.PublicApi_ShouldNotChange_Unintentionally.verified.txt index 28c61f26b9..14820e1fdd 100644 --- a/test/Altinn.App.Core.Tests/PublicApiTests.PublicApi_ShouldNotChange_Unintentionally.verified.txt +++ b/test/Altinn.App.Core.Tests/PublicApiTests.PublicApi_ShouldNotChange_Unintentionally.verified.txt @@ -2435,7 +2435,7 @@ namespace Altinn.App.Core.Implementation public Altinn.Platform.Storage.Interface.Models.Application GetApplication() { } public string? GetApplicationBPMNProcess() { } public string? GetApplicationXACMLPolicy() { } - public string? GetCalculationConfiguration(string dataTypeId) { } + public Altinn.App.Core.Models.Calculation.CalculationSchema? GetCalculationConfiguration(string dataTypeId) { } public string GetClassRefForLogicDataType(string dataType) { } public System.Threading.Tasks.Task GetFooter() { } [System.Obsolete("Use GetLayoutModelForTask instead")] @@ -3000,7 +3000,7 @@ namespace Altinn.App.Core.Internal.App [System.Obsolete("GetApplication is scheduled for removal. Use Altinn.App.Core.Internal.App.IAppMet" + "adata.GetApplicationXACMLPolicy instead", false)] string? GetApplicationXACMLPolicy(); - string? GetCalculationConfiguration(string dataTypeId); + Altinn.App.Core.Models.Calculation.CalculationSchema? GetCalculationConfiguration(string dataTypeId); string GetClassRefForLogicDataType(string dataType); System.Threading.Tasks.Task GetFooter(); [System.Obsolete("Use GetLayoutModelForTask instead", false)] @@ -3269,7 +3269,7 @@ namespace Altinn.App.Core.Internal.Expressions public ExpressionEvaluatorTypeErrorException(string msg) { } public ExpressionEvaluatorTypeErrorException(string msg, System.Exception innerException) { } } - [System.Diagnostics.DebuggerDisplay("{ToString(),nq}")] + [System.Diagnostics.DebuggerDisplay("{ToStringForText(),nq}")] [System.Text.Json.Serialization.JsonConverter(typeof(Altinn.App.Core.Internal.Expressions.ExpressionTypeUnionConverter))] public readonly struct ExpressionValue : System.IEquatable { @@ -4368,6 +4368,7 @@ namespace Altinn.App.Core.Models public System.Collections.Generic.IEnumerable BinaryDataChanges { get; } public System.Collections.Generic.IEnumerable FormDataChanges { get; } } + [System.Text.Json.Serialization.JsonConverter(typeof(Altinn.App.Core.Models.DataElementIdentifier.DataElementIdentifierConverter))] public readonly struct DataElementIdentifier : System.IEquatable { public DataElementIdentifier(Altinn.Platform.Storage.Interface.Models.DataElement dataElement) { } @@ -4384,6 +4385,12 @@ namespace Altinn.App.Core.Models public static Altinn.App.Core.Models.DataElementIdentifier? op_Implicit(Altinn.Platform.Storage.Interface.Models.DataElement? dataElement) { } public static bool operator !=(Altinn.App.Core.Models.DataElementIdentifier left, Altinn.App.Core.Models.DataElementIdentifier right) { } public static bool operator ==(Altinn.App.Core.Models.DataElementIdentifier left, Altinn.App.Core.Models.DataElementIdentifier right) { } + public class DataElementIdentifierConverter : System.Text.Json.Serialization.JsonConverter + { + public DataElementIdentifierConverter() { } + public override Altinn.App.Core.Models.DataElementIdentifier Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { } + public override void Write(System.Text.Json.Utf8JsonWriter writer, Altinn.App.Core.Models.DataElementIdentifier value, System.Text.Json.JsonSerializerOptions options) { } + } } public class DataList { @@ -4657,6 +4664,24 @@ namespace Altinn.App.Core.Models public Altinn.Platform.Register.Models.Party UserParty { get; set; } } } +namespace Altinn.App.Core.Models.Calculation +{ + public class CalculationItem + { + public CalculationItem() { } + [System.Text.Json.Serialization.JsonPropertyName("expression")] + public required Altinn.App.Core.Models.Expressions.Expression Expression { get; init; } + [System.Text.Json.Serialization.JsonPropertyName("field")] + public required string Field { get; init; } + } + public class CalculationSchema + { + public CalculationSchema() { } + public required System.Collections.Generic.List Calculations { get; init; } + [System.Text.Json.Serialization.JsonPropertyName("$schema")] + public string Schema { get; } + } +} namespace Altinn.App.Core.Models.Expressions { [System.Diagnostics.DebuggerDisplay("{_debuggerDisplay}", Name="{_debuggerName}")] diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.DataUpload_filenameQuoted=False_useNewEndpoint=True_0_UploadResponse.verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.DataUpload_filenameQuoted=False_useNewEndpoint=True_0_UploadResponse.verified.txt index dce46be59c..a1723170a3 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.DataUpload_filenameQuoted=False_useNewEndpoint=True_0_UploadResponse.verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.DataUpload_filenameQuoted=False_useNewEndpoint=True_0_UploadResponse.verified.txt @@ -68,5 +68,5 @@ }, IsSuccessStatusCode: false }, - Response: {"title":"File validation failed","status":400,"detail":"Common checks failed","uploadValidationIssues":[{"severity":1,"dataElementId":null,"field":null,"code":"MissingFileName","description":"Invalid data provided. Error: The Content-Disposition header must contain a valid filename","source":"DataRestrictionValidation"}]} + Response: {} } \ No newline at end of file diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.DataUpload_filenameQuoted=True_useNewEndpoint=True_0_UploadResponse.verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.DataUpload_filenameQuoted=True_useNewEndpoint=True_0_UploadResponse.verified.txt index 96ecb8d1bb..a885f81674 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.DataUpload_filenameQuoted=True_useNewEndpoint=True_0_UploadResponse.verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.DataUpload_filenameQuoted=True_useNewEndpoint=True_0_UploadResponse.verified.txt @@ -112,7 +112,7 @@ Apps: https://local.altinn.cloud:/ttd/basic/instances/501337//data/, Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 146, + Size: 222, Locked: false, IsRead: true, Created: DateTime_4, @@ -144,6 +144,19 @@ CreatedBy: 1337, LastChanged: DateTime_6, LastChangedBy: 1337 - } + }, + NewDataModels: [ + { + DataElementId: Guid_2, + Data: { + property1: null, + property2: null, + property3: null, + price: 200, + quantity: 1, + total: 200 + } + } + ] } } \ No newline at end of file diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=MultipartNoPrefill_0_Instantiation.verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=MultipartNoPrefill_0_Instantiation.verified.txt index a8cfe10b75..7684d03082 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=MultipartNoPrefill_0_Instantiation.verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=MultipartNoPrefill_0_Instantiation.verified.txt @@ -100,7 +100,7 @@ Apps: https://local.altinn.cloud:/ttd/basic/instances/501337//data/, Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 146, + Size: 222, Locked: false, IsRead: false, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=MultipartNoPrefill_1_Download-Data[0].verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=MultipartNoPrefill_1_Download-Data[0].verified.txt index f24ca5d7e2..67273aac5f 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=MultipartNoPrefill_1_Download-Data[0].verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=MultipartNoPrefill_1_Download-Data[0].verified.txt @@ -61,6 +61,9 @@ Response: { property1: null, property2: null, - property3: null + property3: null, + price: null, + quantity: 1, + total: null } } \ No newline at end of file diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=MultipartNoPrefill_2_PatchFormData.verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=MultipartNoPrefill_2_PatchFormData.verified.txt index 051f857449..f73eaa7720 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=MultipartNoPrefill_2_PatchFormData.verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=MultipartNoPrefill_2_PatchFormData.verified.txt @@ -81,7 +81,12 @@ { DataElementId: Guid_1, Data: { - ValueKind: Object + property1: 2, + property2: 2, + property3: null, + price: 200, + quantity: 1, + total: 200 } } ], @@ -124,7 +129,7 @@ SelfLinks: { Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 146, + Size: 222, Locked: false, IsRead: false, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=MultipartNoPrefill_5_Download-Data[0].verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=MultipartNoPrefill_5_Download-Data[0].verified.txt index a41e41ab36..7dd3ba90f5 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=MultipartNoPrefill_5_Download-Data[0].verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=MultipartNoPrefill_5_Download-Data[0].verified.txt @@ -61,6 +61,9 @@ Response: { property1: 2, property2: 2, - property3: null + property3: null, + price: 200, + quantity: 1, + total: 200 } } \ No newline at end of file diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=MultipartXmlPrefill_0_Instantiation.verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=MultipartXmlPrefill_0_Instantiation.verified.txt index f5a60c6cbd..f37e4ed315 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=MultipartXmlPrefill_0_Instantiation.verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=MultipartXmlPrefill_0_Instantiation.verified.txt @@ -100,7 +100,7 @@ Apps: https://local.altinn.cloud:/ttd/basic/instances/501337//data/, Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 200, + Size: 270, Locked: false, IsRead: false, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=MultipartXmlPrefill_1_Download-Data[0].verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=MultipartXmlPrefill_1_Download-Data[0].verified.txt index 98cf4275d2..645891d381 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=MultipartXmlPrefill_1_Download-Data[0].verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=MultipartXmlPrefill_1_Download-Data[0].verified.txt @@ -61,6 +61,9 @@ Response: { property1: 1, property2: 1, - property3: null + property3: null, + price: null, + quantity: 1, + total: null } } \ No newline at end of file diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=MultipartXmlPrefill_2_PatchFormData.verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=MultipartXmlPrefill_2_PatchFormData.verified.txt index 5fa2c40a9f..19b0643021 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=MultipartXmlPrefill_2_PatchFormData.verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=MultipartXmlPrefill_2_PatchFormData.verified.txt @@ -81,7 +81,12 @@ { DataElementId: Guid_1, Data: { - ValueKind: Object + property1: 2, + property2: 2, + property3: null, + price: 200, + quantity: 1, + total: 200 } } ], @@ -124,7 +129,7 @@ SelfLinks: { Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 200, + Size: 270, Locked: false, IsRead: false, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=MultipartXmlPrefill_5_Download-Data[0].verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=MultipartXmlPrefill_5_Download-Data[0].verified.txt index a41e41ab36..7dd3ba90f5 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=MultipartXmlPrefill_5_Download-Data[0].verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=MultipartXmlPrefill_5_Download-Data[0].verified.txt @@ -61,6 +61,9 @@ Response: { property1: 2, property2: 2, - property3: null + property3: null, + price: 200, + quantity: 1, + total: 200 } } \ No newline at end of file diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=SimplifiedNoPrefill_0_Instantiation.verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=SimplifiedNoPrefill_0_Instantiation.verified.txt index ca7964da3b..8d07383df9 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=SimplifiedNoPrefill_0_Instantiation.verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=SimplifiedNoPrefill_0_Instantiation.verified.txt @@ -109,7 +109,7 @@ Apps: https://local.altinn.cloud:/ttd/basic/instances/501337//data/, Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 146, + Size: 222, Locked: false, IsRead: false, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=SimplifiedNoPrefill_1_Download-Data[0].verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=SimplifiedNoPrefill_1_Download-Data[0].verified.txt index f24ca5d7e2..67273aac5f 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=SimplifiedNoPrefill_1_Download-Data[0].verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=SimplifiedNoPrefill_1_Download-Data[0].verified.txt @@ -61,6 +61,9 @@ Response: { property1: null, property2: null, - property3: null + property3: null, + price: null, + quantity: 1, + total: null } } \ No newline at end of file diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=SimplifiedNoPrefill_2_PatchFormData.verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=SimplifiedNoPrefill_2_PatchFormData.verified.txt index 051f857449..f73eaa7720 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=SimplifiedNoPrefill_2_PatchFormData.verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=SimplifiedNoPrefill_2_PatchFormData.verified.txt @@ -81,7 +81,12 @@ { DataElementId: Guid_1, Data: { - ValueKind: Object + property1: 2, + property2: 2, + property3: null, + price: 200, + quantity: 1, + total: 200 } } ], @@ -124,7 +129,7 @@ SelfLinks: { Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 146, + Size: 222, Locked: false, IsRead: false, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=SimplifiedNoPrefill_5_Download-Data[0].verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=SimplifiedNoPrefill_5_Download-Data[0].verified.txt index a41e41ab36..7dd3ba90f5 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=SimplifiedNoPrefill_5_Download-Data[0].verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=SimplifiedNoPrefill_5_Download-Data[0].verified.txt @@ -61,6 +61,9 @@ Response: { property1: 2, property2: 2, - property3: null + property3: null, + price: 200, + quantity: 1, + total: 200 } } \ No newline at end of file diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=SimplifiedWithPrefill_0_Instantiation.verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=SimplifiedWithPrefill_0_Instantiation.verified.txt index 51346c745f..bf497f5787 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=SimplifiedWithPrefill_0_Instantiation.verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=SimplifiedWithPrefill_0_Instantiation.verified.txt @@ -109,7 +109,7 @@ Apps: https://local.altinn.cloud:/ttd/basic/instances/501337//data/, Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 200, + Size: 270, Locked: false, IsRead: false, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=SimplifiedWithPrefill_1_Download-Data[0].verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=SimplifiedWithPrefill_1_Download-Data[0].verified.txt index 98cf4275d2..645891d381 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=SimplifiedWithPrefill_1_Download-Data[0].verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=SimplifiedWithPrefill_1_Download-Data[0].verified.txt @@ -61,6 +61,9 @@ Response: { property1: 1, property2: 1, - property3: null + property3: null, + price: null, + quantity: 1, + total: null } } \ No newline at end of file diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=SimplifiedWithPrefill_2_PatchFormData.verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=SimplifiedWithPrefill_2_PatchFormData.verified.txt index 5fa2c40a9f..19b0643021 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=SimplifiedWithPrefill_2_PatchFormData.verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=SimplifiedWithPrefill_2_PatchFormData.verified.txt @@ -81,7 +81,12 @@ { DataElementId: Guid_1, Data: { - ValueKind: Object + property1: 2, + property2: 2, + property3: null, + price: 200, + quantity: 1, + total: 200 } } ], @@ -124,7 +129,7 @@ SelfLinks: { Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 200, + Size: 270, Locked: false, IsRead: false, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=SimplifiedWithPrefill_5_Download-Data[0].verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=SimplifiedWithPrefill_5_Download-Data[0].verified.txt index a41e41ab36..7dd3ba90f5 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=SimplifiedWithPrefill_5_Download-Data[0].verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldServiceOwner_testCase=SimplifiedWithPrefill_5_Download-Data[0].verified.txt @@ -61,6 +61,9 @@ Response: { property1: 2, property2: 2, - property3: null + property3: null, + price: 200, + quantity: 1, + total: 200 } } \ No newline at end of file diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=MultipartNoPrefill_0_Instantiation.verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=MultipartNoPrefill_0_Instantiation.verified.txt index 747a8ec789..1a43c05ef0 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=MultipartNoPrefill_0_Instantiation.verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=MultipartNoPrefill_0_Instantiation.verified.txt @@ -101,7 +101,7 @@ Apps: https://local.altinn.cloud:/ttd/basic/instances/501337//data/, Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 146, + Size: 222, Locked: false, IsRead: true, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=MultipartNoPrefill_1_Download-Data[0].verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=MultipartNoPrefill_1_Download-Data[0].verified.txt index f24ca5d7e2..67273aac5f 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=MultipartNoPrefill_1_Download-Data[0].verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=MultipartNoPrefill_1_Download-Data[0].verified.txt @@ -61,6 +61,9 @@ Response: { property1: null, property2: null, - property3: null + property3: null, + price: null, + quantity: 1, + total: null } } \ No newline at end of file diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=MultipartNoPrefill_2_PatchFormData.verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=MultipartNoPrefill_2_PatchFormData.verified.txt index 5a34fef2b9..59ffe9e99c 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=MultipartNoPrefill_2_PatchFormData.verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=MultipartNoPrefill_2_PatchFormData.verified.txt @@ -81,7 +81,12 @@ { DataElementId: Guid_1, Data: { - ValueKind: Object + property1: 2, + property2: 2, + property3: null, + price: 200, + quantity: 1, + total: 200 } } ], @@ -125,7 +130,7 @@ SelfLinks: { Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 146, + Size: 222, Locked: false, IsRead: true, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=MultipartNoPrefill_5_Download-Data[0].verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=MultipartNoPrefill_5_Download-Data[0].verified.txt index a41e41ab36..7dd3ba90f5 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=MultipartNoPrefill_5_Download-Data[0].verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=MultipartNoPrefill_5_Download-Data[0].verified.txt @@ -61,6 +61,9 @@ Response: { property1: 2, property2: 2, - property3: null + property3: null, + price: 200, + quantity: 1, + total: 200 } } \ No newline at end of file diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=MultipartXmlPrefill_0_Instantiation.verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=MultipartXmlPrefill_0_Instantiation.verified.txt index eee7df9a15..8e6de49ee5 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=MultipartXmlPrefill_0_Instantiation.verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=MultipartXmlPrefill_0_Instantiation.verified.txt @@ -101,7 +101,7 @@ Apps: https://local.altinn.cloud:/ttd/basic/instances/501337//data/, Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 200, + Size: 270, Locked: false, IsRead: true, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=MultipartXmlPrefill_1_Download-Data[0].verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=MultipartXmlPrefill_1_Download-Data[0].verified.txt index 98cf4275d2..645891d381 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=MultipartXmlPrefill_1_Download-Data[0].verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=MultipartXmlPrefill_1_Download-Data[0].verified.txt @@ -61,6 +61,9 @@ Response: { property1: 1, property2: 1, - property3: null + property3: null, + price: null, + quantity: 1, + total: null } } \ No newline at end of file diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=MultipartXmlPrefill_2_PatchFormData.verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=MultipartXmlPrefill_2_PatchFormData.verified.txt index 185806bdac..28d18998f1 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=MultipartXmlPrefill_2_PatchFormData.verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=MultipartXmlPrefill_2_PatchFormData.verified.txt @@ -81,7 +81,12 @@ { DataElementId: Guid_1, Data: { - ValueKind: Object + property1: 2, + property2: 2, + property3: null, + price: 200, + quantity: 1, + total: 200 } } ], @@ -125,7 +130,7 @@ SelfLinks: { Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 200, + Size: 270, Locked: false, IsRead: true, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=MultipartXmlPrefill_5_Download-Data[0].verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=MultipartXmlPrefill_5_Download-Data[0].verified.txt index a41e41ab36..7dd3ba90f5 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=MultipartXmlPrefill_5_Download-Data[0].verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=MultipartXmlPrefill_5_Download-Data[0].verified.txt @@ -61,6 +61,9 @@ Response: { property1: 2, property2: 2, - property3: null + property3: null, + price: 200, + quantity: 1, + total: 200 } } \ No newline at end of file diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=SimplifiedNoPrefill_0_Instantiation.verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=SimplifiedNoPrefill_0_Instantiation.verified.txt index 2be4d30c5c..f0a53f907b 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=SimplifiedNoPrefill_0_Instantiation.verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=SimplifiedNoPrefill_0_Instantiation.verified.txt @@ -110,7 +110,7 @@ Apps: https://local.altinn.cloud:/ttd/basic/instances/501337//data/, Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 146, + Size: 222, Locked: false, IsRead: true, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=SimplifiedNoPrefill_1_Download-Data[0].verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=SimplifiedNoPrefill_1_Download-Data[0].verified.txt index f24ca5d7e2..67273aac5f 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=SimplifiedNoPrefill_1_Download-Data[0].verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=SimplifiedNoPrefill_1_Download-Data[0].verified.txt @@ -61,6 +61,9 @@ Response: { property1: null, property2: null, - property3: null + property3: null, + price: null, + quantity: 1, + total: null } } \ No newline at end of file diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=SimplifiedNoPrefill_2_PatchFormData.verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=SimplifiedNoPrefill_2_PatchFormData.verified.txt index 5a34fef2b9..59ffe9e99c 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=SimplifiedNoPrefill_2_PatchFormData.verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=SimplifiedNoPrefill_2_PatchFormData.verified.txt @@ -81,7 +81,12 @@ { DataElementId: Guid_1, Data: { - ValueKind: Object + property1: 2, + property2: 2, + property3: null, + price: 200, + quantity: 1, + total: 200 } } ], @@ -125,7 +130,7 @@ SelfLinks: { Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 146, + Size: 222, Locked: false, IsRead: true, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=SimplifiedNoPrefill_5_Download-Data[0].verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=SimplifiedNoPrefill_5_Download-Data[0].verified.txt index a41e41ab36..7dd3ba90f5 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=SimplifiedNoPrefill_5_Download-Data[0].verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=SimplifiedNoPrefill_5_Download-Data[0].verified.txt @@ -61,6 +61,9 @@ Response: { property1: 2, property2: 2, - property3: null + property3: null, + price: 200, + quantity: 1, + total: 200 } } \ No newline at end of file diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=SimplifiedWithPrefill_0_Instantiation.verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=SimplifiedWithPrefill_0_Instantiation.verified.txt index 9fd96d0698..eed516f114 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=SimplifiedWithPrefill_0_Instantiation.verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=SimplifiedWithPrefill_0_Instantiation.verified.txt @@ -110,7 +110,7 @@ Apps: https://local.altinn.cloud:/ttd/basic/instances/501337//data/, Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 200, + Size: 270, Locked: false, IsRead: true, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=SimplifiedWithPrefill_1_Download-Data[0].verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=SimplifiedWithPrefill_1_Download-Data[0].verified.txt index 98cf4275d2..645891d381 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=SimplifiedWithPrefill_1_Download-Data[0].verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=SimplifiedWithPrefill_1_Download-Data[0].verified.txt @@ -61,6 +61,9 @@ Response: { property1: 1, property2: 1, - property3: null + property3: null, + price: null, + quantity: 1, + total: null } } \ No newline at end of file diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=SimplifiedWithPrefill_2_PatchFormData.verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=SimplifiedWithPrefill_2_PatchFormData.verified.txt index 185806bdac..28d18998f1 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=SimplifiedWithPrefill_2_PatchFormData.verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=SimplifiedWithPrefill_2_PatchFormData.verified.txt @@ -81,7 +81,12 @@ { DataElementId: Guid_1, Data: { - ValueKind: Object + property1: 2, + property2: 2, + property3: null, + price: 200, + quantity: 1, + total: 200 } } ], @@ -125,7 +130,7 @@ SelfLinks: { Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 200, + Size: 270, Locked: false, IsRead: true, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=SimplifiedWithPrefill_5_Download-Data[0].verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=SimplifiedWithPrefill_5_Download-Data[0].verified.txt index a41e41ab36..7dd3ba90f5 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=SimplifiedWithPrefill_5_Download-Data[0].verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=OldUser_testCase=SimplifiedWithPrefill_5_Download-Data[0].verified.txt @@ -61,6 +61,9 @@ Response: { property1: 2, property2: 2, - property3: null + property3: null, + price: 200, + quantity: 1, + total: 200 } } \ No newline at end of file diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=MultipartNoPrefill_0_Instantiation.verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=MultipartNoPrefill_0_Instantiation.verified.txt index a8cfe10b75..7684d03082 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=MultipartNoPrefill_0_Instantiation.verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=MultipartNoPrefill_0_Instantiation.verified.txt @@ -100,7 +100,7 @@ Apps: https://local.altinn.cloud:/ttd/basic/instances/501337//data/, Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 146, + Size: 222, Locked: false, IsRead: false, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=MultipartNoPrefill_1_Download-Data[0].verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=MultipartNoPrefill_1_Download-Data[0].verified.txt index f24ca5d7e2..67273aac5f 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=MultipartNoPrefill_1_Download-Data[0].verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=MultipartNoPrefill_1_Download-Data[0].verified.txt @@ -61,6 +61,9 @@ Response: { property1: null, property2: null, - property3: null + property3: null, + price: null, + quantity: 1, + total: null } } \ No newline at end of file diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=MultipartNoPrefill_2_PatchFormData.verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=MultipartNoPrefill_2_PatchFormData.verified.txt index 051f857449..f73eaa7720 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=MultipartNoPrefill_2_PatchFormData.verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=MultipartNoPrefill_2_PatchFormData.verified.txt @@ -81,7 +81,12 @@ { DataElementId: Guid_1, Data: { - ValueKind: Object + property1: 2, + property2: 2, + property3: null, + price: 200, + quantity: 1, + total: 200 } } ], @@ -124,7 +129,7 @@ SelfLinks: { Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 146, + Size: 222, Locked: false, IsRead: false, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=MultipartNoPrefill_5_Download-Data[0].verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=MultipartNoPrefill_5_Download-Data[0].verified.txt index a41e41ab36..7dd3ba90f5 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=MultipartNoPrefill_5_Download-Data[0].verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=MultipartNoPrefill_5_Download-Data[0].verified.txt @@ -61,6 +61,9 @@ Response: { property1: 2, property2: 2, - property3: null + property3: null, + price: 200, + quantity: 1, + total: 200 } } \ No newline at end of file diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=MultipartXmlPrefill_0_Instantiation.verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=MultipartXmlPrefill_0_Instantiation.verified.txt index f5a60c6cbd..f37e4ed315 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=MultipartXmlPrefill_0_Instantiation.verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=MultipartXmlPrefill_0_Instantiation.verified.txt @@ -100,7 +100,7 @@ Apps: https://local.altinn.cloud:/ttd/basic/instances/501337//data/, Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 200, + Size: 270, Locked: false, IsRead: false, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=MultipartXmlPrefill_1_Download-Data[0].verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=MultipartXmlPrefill_1_Download-Data[0].verified.txt index 98cf4275d2..645891d381 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=MultipartXmlPrefill_1_Download-Data[0].verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=MultipartXmlPrefill_1_Download-Data[0].verified.txt @@ -61,6 +61,9 @@ Response: { property1: 1, property2: 1, - property3: null + property3: null, + price: null, + quantity: 1, + total: null } } \ No newline at end of file diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=MultipartXmlPrefill_2_PatchFormData.verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=MultipartXmlPrefill_2_PatchFormData.verified.txt index 5fa2c40a9f..19b0643021 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=MultipartXmlPrefill_2_PatchFormData.verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=MultipartXmlPrefill_2_PatchFormData.verified.txt @@ -81,7 +81,12 @@ { DataElementId: Guid_1, Data: { - ValueKind: Object + property1: 2, + property2: 2, + property3: null, + price: 200, + quantity: 1, + total: 200 } } ], @@ -124,7 +129,7 @@ SelfLinks: { Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 200, + Size: 270, Locked: false, IsRead: false, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=MultipartXmlPrefill_5_Download-Data[0].verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=MultipartXmlPrefill_5_Download-Data[0].verified.txt index a41e41ab36..7dd3ba90f5 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=MultipartXmlPrefill_5_Download-Data[0].verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=MultipartXmlPrefill_5_Download-Data[0].verified.txt @@ -61,6 +61,9 @@ Response: { property1: 2, property2: 2, - property3: null + property3: null, + price: 200, + quantity: 1, + total: 200 } } \ No newline at end of file diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=SimplifiedNoPrefill_0_Instantiation.verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=SimplifiedNoPrefill_0_Instantiation.verified.txt index ca7964da3b..8d07383df9 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=SimplifiedNoPrefill_0_Instantiation.verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=SimplifiedNoPrefill_0_Instantiation.verified.txt @@ -109,7 +109,7 @@ Apps: https://local.altinn.cloud:/ttd/basic/instances/501337//data/, Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 146, + Size: 222, Locked: false, IsRead: false, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=SimplifiedNoPrefill_1_Download-Data[0].verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=SimplifiedNoPrefill_1_Download-Data[0].verified.txt index f24ca5d7e2..67273aac5f 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=SimplifiedNoPrefill_1_Download-Data[0].verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=SimplifiedNoPrefill_1_Download-Data[0].verified.txt @@ -61,6 +61,9 @@ Response: { property1: null, property2: null, - property3: null + property3: null, + price: null, + quantity: 1, + total: null } } \ No newline at end of file diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=SimplifiedNoPrefill_2_PatchFormData.verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=SimplifiedNoPrefill_2_PatchFormData.verified.txt index 051f857449..f73eaa7720 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=SimplifiedNoPrefill_2_PatchFormData.verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=SimplifiedNoPrefill_2_PatchFormData.verified.txt @@ -81,7 +81,12 @@ { DataElementId: Guid_1, Data: { - ValueKind: Object + property1: 2, + property2: 2, + property3: null, + price: 200, + quantity: 1, + total: 200 } } ], @@ -124,7 +129,7 @@ SelfLinks: { Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 146, + Size: 222, Locked: false, IsRead: false, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=SimplifiedNoPrefill_5_Download-Data[0].verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=SimplifiedNoPrefill_5_Download-Data[0].verified.txt index a41e41ab36..7dd3ba90f5 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=SimplifiedNoPrefill_5_Download-Data[0].verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=SimplifiedNoPrefill_5_Download-Data[0].verified.txt @@ -61,6 +61,9 @@ Response: { property1: 2, property2: 2, - property3: null + property3: null, + price: 200, + quantity: 1, + total: 200 } } \ No newline at end of file diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=SimplifiedWithPrefill_0_Instantiation.verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=SimplifiedWithPrefill_0_Instantiation.verified.txt index 51346c745f..bf497f5787 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=SimplifiedWithPrefill_0_Instantiation.verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=SimplifiedWithPrefill_0_Instantiation.verified.txt @@ -109,7 +109,7 @@ Apps: https://local.altinn.cloud:/ttd/basic/instances/501337//data/, Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 200, + Size: 270, Locked: false, IsRead: false, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=SimplifiedWithPrefill_1_Download-Data[0].verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=SimplifiedWithPrefill_1_Download-Data[0].verified.txt index 98cf4275d2..645891d381 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=SimplifiedWithPrefill_1_Download-Data[0].verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=SimplifiedWithPrefill_1_Download-Data[0].verified.txt @@ -61,6 +61,9 @@ Response: { property1: 1, property2: 1, - property3: null + property3: null, + price: null, + quantity: 1, + total: null } } \ No newline at end of file diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=SimplifiedWithPrefill_2_PatchFormData.verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=SimplifiedWithPrefill_2_PatchFormData.verified.txt index 5fa2c40a9f..19b0643021 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=SimplifiedWithPrefill_2_PatchFormData.verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=SimplifiedWithPrefill_2_PatchFormData.verified.txt @@ -81,7 +81,12 @@ { DataElementId: Guid_1, Data: { - ValueKind: Object + property1: 2, + property2: 2, + property3: null, + price: 200, + quantity: 1, + total: 200 } } ], @@ -124,7 +129,7 @@ SelfLinks: { Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 200, + Size: 270, Locked: false, IsRead: false, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=SimplifiedWithPrefill_5_Download-Data[0].verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=SimplifiedWithPrefill_5_Download-Data[0].verified.txt index a41e41ab36..7dd3ba90f5 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=SimplifiedWithPrefill_5_Download-Data[0].verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=ServiceOwner_testCase=SimplifiedWithPrefill_5_Download-Data[0].verified.txt @@ -61,6 +61,9 @@ Response: { property1: 2, property2: 2, - property3: null + property3: null, + price: 200, + quantity: 1, + total: 200 } } \ No newline at end of file diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=MultipartNoPrefill_0_Instantiation.verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=MultipartNoPrefill_0_Instantiation.verified.txt index 747a8ec789..1a43c05ef0 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=MultipartNoPrefill_0_Instantiation.verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=MultipartNoPrefill_0_Instantiation.verified.txt @@ -101,7 +101,7 @@ Apps: https://local.altinn.cloud:/ttd/basic/instances/501337//data/, Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 146, + Size: 222, Locked: false, IsRead: true, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=MultipartNoPrefill_1_Download-Data[0].verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=MultipartNoPrefill_1_Download-Data[0].verified.txt index f24ca5d7e2..67273aac5f 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=MultipartNoPrefill_1_Download-Data[0].verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=MultipartNoPrefill_1_Download-Data[0].verified.txt @@ -61,6 +61,9 @@ Response: { property1: null, property2: null, - property3: null + property3: null, + price: null, + quantity: 1, + total: null } } \ No newline at end of file diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=MultipartNoPrefill_2_PatchFormData.verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=MultipartNoPrefill_2_PatchFormData.verified.txt index 5a34fef2b9..59ffe9e99c 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=MultipartNoPrefill_2_PatchFormData.verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=MultipartNoPrefill_2_PatchFormData.verified.txt @@ -81,7 +81,12 @@ { DataElementId: Guid_1, Data: { - ValueKind: Object + property1: 2, + property2: 2, + property3: null, + price: 200, + quantity: 1, + total: 200 } } ], @@ -125,7 +130,7 @@ SelfLinks: { Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 146, + Size: 222, Locked: false, IsRead: true, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=MultipartNoPrefill_5_Download-Data[0].verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=MultipartNoPrefill_5_Download-Data[0].verified.txt index a41e41ab36..7dd3ba90f5 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=MultipartNoPrefill_5_Download-Data[0].verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=MultipartNoPrefill_5_Download-Data[0].verified.txt @@ -61,6 +61,9 @@ Response: { property1: 2, property2: 2, - property3: null + property3: null, + price: 200, + quantity: 1, + total: 200 } } \ No newline at end of file diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=MultipartXmlPrefill_0_Instantiation.verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=MultipartXmlPrefill_0_Instantiation.verified.txt index eee7df9a15..8e6de49ee5 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=MultipartXmlPrefill_0_Instantiation.verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=MultipartXmlPrefill_0_Instantiation.verified.txt @@ -101,7 +101,7 @@ Apps: https://local.altinn.cloud:/ttd/basic/instances/501337//data/, Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 200, + Size: 270, Locked: false, IsRead: true, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=MultipartXmlPrefill_1_Download-Data[0].verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=MultipartXmlPrefill_1_Download-Data[0].verified.txt index 98cf4275d2..645891d381 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=MultipartXmlPrefill_1_Download-Data[0].verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=MultipartXmlPrefill_1_Download-Data[0].verified.txt @@ -61,6 +61,9 @@ Response: { property1: 1, property2: 1, - property3: null + property3: null, + price: null, + quantity: 1, + total: null } } \ No newline at end of file diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=MultipartXmlPrefill_2_PatchFormData.verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=MultipartXmlPrefill_2_PatchFormData.verified.txt index 185806bdac..28d18998f1 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=MultipartXmlPrefill_2_PatchFormData.verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=MultipartXmlPrefill_2_PatchFormData.verified.txt @@ -81,7 +81,12 @@ { DataElementId: Guid_1, Data: { - ValueKind: Object + property1: 2, + property2: 2, + property3: null, + price: 200, + quantity: 1, + total: 200 } } ], @@ -125,7 +130,7 @@ SelfLinks: { Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 200, + Size: 270, Locked: false, IsRead: true, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=MultipartXmlPrefill_5_Download-Data[0].verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=MultipartXmlPrefill_5_Download-Data[0].verified.txt index a41e41ab36..7dd3ba90f5 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=MultipartXmlPrefill_5_Download-Data[0].verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=MultipartXmlPrefill_5_Download-Data[0].verified.txt @@ -61,6 +61,9 @@ Response: { property1: 2, property2: 2, - property3: null + property3: null, + price: 200, + quantity: 1, + total: 200 } } \ No newline at end of file diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=SimplifiedNoPrefill_0_Instantiation.verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=SimplifiedNoPrefill_0_Instantiation.verified.txt index 2be4d30c5c..f0a53f907b 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=SimplifiedNoPrefill_0_Instantiation.verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=SimplifiedNoPrefill_0_Instantiation.verified.txt @@ -110,7 +110,7 @@ Apps: https://local.altinn.cloud:/ttd/basic/instances/501337//data/, Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 146, + Size: 222, Locked: false, IsRead: true, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=SimplifiedNoPrefill_1_Download-Data[0].verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=SimplifiedNoPrefill_1_Download-Data[0].verified.txt index f24ca5d7e2..67273aac5f 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=SimplifiedNoPrefill_1_Download-Data[0].verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=SimplifiedNoPrefill_1_Download-Data[0].verified.txt @@ -61,6 +61,9 @@ Response: { property1: null, property2: null, - property3: null + property3: null, + price: null, + quantity: 1, + total: null } } \ No newline at end of file diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=SimplifiedNoPrefill_2_PatchFormData.verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=SimplifiedNoPrefill_2_PatchFormData.verified.txt index 5a34fef2b9..59ffe9e99c 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=SimplifiedNoPrefill_2_PatchFormData.verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=SimplifiedNoPrefill_2_PatchFormData.verified.txt @@ -81,7 +81,12 @@ { DataElementId: Guid_1, Data: { - ValueKind: Object + property1: 2, + property2: 2, + property3: null, + price: 200, + quantity: 1, + total: 200 } } ], @@ -125,7 +130,7 @@ SelfLinks: { Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 146, + Size: 222, Locked: false, IsRead: true, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=SimplifiedNoPrefill_5_Download-Data[0].verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=SimplifiedNoPrefill_5_Download-Data[0].verified.txt index a41e41ab36..7dd3ba90f5 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=SimplifiedNoPrefill_5_Download-Data[0].verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=SimplifiedNoPrefill_5_Download-Data[0].verified.txt @@ -61,6 +61,9 @@ Response: { property1: 2, property2: 2, - property3: null + property3: null, + price: 200, + quantity: 1, + total: 200 } } \ No newline at end of file diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=SimplifiedWithPrefill_0_Instantiation.verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=SimplifiedWithPrefill_0_Instantiation.verified.txt index 9fd96d0698..eed516f114 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=SimplifiedWithPrefill_0_Instantiation.verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=SimplifiedWithPrefill_0_Instantiation.verified.txt @@ -110,7 +110,7 @@ Apps: https://local.altinn.cloud:/ttd/basic/instances/501337//data/, Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 200, + Size: 270, Locked: false, IsRead: true, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=SimplifiedWithPrefill_1_Download-Data[0].verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=SimplifiedWithPrefill_1_Download-Data[0].verified.txt index 98cf4275d2..645891d381 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=SimplifiedWithPrefill_1_Download-Data[0].verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=SimplifiedWithPrefill_1_Download-Data[0].verified.txt @@ -61,6 +61,9 @@ Response: { property1: 1, property2: 1, - property3: null + property3: null, + price: null, + quantity: 1, + total: null } } \ No newline at end of file diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=SimplifiedWithPrefill_2_PatchFormData.verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=SimplifiedWithPrefill_2_PatchFormData.verified.txt index 185806bdac..28d18998f1 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=SimplifiedWithPrefill_2_PatchFormData.verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=SimplifiedWithPrefill_2_PatchFormData.verified.txt @@ -81,7 +81,12 @@ { DataElementId: Guid_1, Data: { - ValueKind: Object + property1: 2, + property2: 2, + property3: null, + price: 200, + quantity: 1, + total: 200 } } ], @@ -125,7 +130,7 @@ SelfLinks: { Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 200, + Size: 270, Locked: false, IsRead: true, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=SimplifiedWithPrefill_5_Download-Data[0].verified.txt b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=SimplifiedWithPrefill_5_Download-Data[0].verified.txt index a41e41ab36..7dd3ba90f5 100644 --- a/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=SimplifiedWithPrefill_5_Download-Data[0].verified.txt +++ b/test/Altinn.App.Integration.Tests/Basic/_snapshots/BasicAppTests.Full_auth=User_testCase=SimplifiedWithPrefill_5_Download-Data[0].verified.txt @@ -61,6 +61,9 @@ Response: { property1: 2, property2: 2, - property3: null + property3: null, + price: 200, + quantity: 1, + total: 200 } } \ No newline at end of file diff --git a/test/Altinn.App.Integration.Tests/CustomScopes/_snapshots/CustomScopesTests.Full_auth=ServiceOwner_scope=custom-serviceowner-instances.read-custom-serviceowner-instances.write_1_Instantiation.verified.txt b/test/Altinn.App.Integration.Tests/CustomScopes/_snapshots/CustomScopesTests.Full_auth=ServiceOwner_scope=custom-serviceowner-instances.read-custom-serviceowner-instances.write_1_Instantiation.verified.txt index 51346c745f..bf497f5787 100644 --- a/test/Altinn.App.Integration.Tests/CustomScopes/_snapshots/CustomScopesTests.Full_auth=ServiceOwner_scope=custom-serviceowner-instances.read-custom-serviceowner-instances.write_1_Instantiation.verified.txt +++ b/test/Altinn.App.Integration.Tests/CustomScopes/_snapshots/CustomScopesTests.Full_auth=ServiceOwner_scope=custom-serviceowner-instances.read-custom-serviceowner-instances.write_1_Instantiation.verified.txt @@ -109,7 +109,7 @@ Apps: https://local.altinn.cloud:/ttd/basic/instances/501337//data/, Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 200, + Size: 270, Locked: false, IsRead: false, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/CustomScopes/_snapshots/CustomScopesTests.Full_auth=SystemUser_scope=custom-instances.read-custom-instances.write_1_Instantiation.verified.txt b/test/Altinn.App.Integration.Tests/CustomScopes/_snapshots/CustomScopesTests.Full_auth=SystemUser_scope=custom-instances.read-custom-instances.write_1_Instantiation.verified.txt index bc381f711b..f2bafe53cf 100644 --- a/test/Altinn.App.Integration.Tests/CustomScopes/_snapshots/CustomScopesTests.Full_auth=SystemUser_scope=custom-instances.read-custom-instances.write_1_Instantiation.verified.txt +++ b/test/Altinn.App.Integration.Tests/CustomScopes/_snapshots/CustomScopesTests.Full_auth=SystemUser_scope=custom-instances.read-custom-instances.write_1_Instantiation.verified.txt @@ -110,7 +110,7 @@ Apps: https://local.altinn.cloud:/ttd/basic/instances/501337//data/, Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 200, + Size: 270, Locked: false, IsRead: true, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/CustomScopes/_snapshots/CustomScopesTests.Full_auth=User_scope=altinn-portal-enduser_1_Instantiation.verified.txt b/test/Altinn.App.Integration.Tests/CustomScopes/_snapshots/CustomScopesTests.Full_auth=User_scope=altinn-portal-enduser_1_Instantiation.verified.txt index 9fd96d0698..eed516f114 100644 --- a/test/Altinn.App.Integration.Tests/CustomScopes/_snapshots/CustomScopesTests.Full_auth=User_scope=altinn-portal-enduser_1_Instantiation.verified.txt +++ b/test/Altinn.App.Integration.Tests/CustomScopes/_snapshots/CustomScopesTests.Full_auth=User_scope=altinn-portal-enduser_1_Instantiation.verified.txt @@ -110,7 +110,7 @@ Apps: https://local.altinn.cloud:/ttd/basic/instances/501337//data/, Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 200, + Size: 270, Locked: false, IsRead: true, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/CustomScopes/_snapshots/CustomScopesTests.Full_auth=User_scope=custom-instances.read-custom-instances.write_1_Instantiation.verified.txt b/test/Altinn.App.Integration.Tests/CustomScopes/_snapshots/CustomScopesTests.Full_auth=User_scope=custom-instances.read-custom-instances.write_1_Instantiation.verified.txt index 9fd96d0698..eed516f114 100644 --- a/test/Altinn.App.Integration.Tests/CustomScopes/_snapshots/CustomScopesTests.Full_auth=User_scope=custom-instances.read-custom-instances.write_1_Instantiation.verified.txt +++ b/test/Altinn.App.Integration.Tests/CustomScopes/_snapshots/CustomScopesTests.Full_auth=User_scope=custom-instances.read-custom-instances.write_1_Instantiation.verified.txt @@ -110,7 +110,7 @@ Apps: https://local.altinn.cloud:/ttd/basic/instances/501337//data/, Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 200, + Size: 270, Locked: false, IsRead: true, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/CustomScopes/_snapshots/CustomScopesWithPlaceholderTests.Full_auth=ServiceOwner_scope=custom-basic-serviceowner-instances.read-custom-basic-serviceowner-instances.write_1_Instantiation.verified.txt b/test/Altinn.App.Integration.Tests/CustomScopes/_snapshots/CustomScopesWithPlaceholderTests.Full_auth=ServiceOwner_scope=custom-basic-serviceowner-instances.read-custom-basic-serviceowner-instances.write_1_Instantiation.verified.txt index 51346c745f..bf497f5787 100644 --- a/test/Altinn.App.Integration.Tests/CustomScopes/_snapshots/CustomScopesWithPlaceholderTests.Full_auth=ServiceOwner_scope=custom-basic-serviceowner-instances.read-custom-basic-serviceowner-instances.write_1_Instantiation.verified.txt +++ b/test/Altinn.App.Integration.Tests/CustomScopes/_snapshots/CustomScopesWithPlaceholderTests.Full_auth=ServiceOwner_scope=custom-basic-serviceowner-instances.read-custom-basic-serviceowner-instances.write_1_Instantiation.verified.txt @@ -109,7 +109,7 @@ Apps: https://local.altinn.cloud:/ttd/basic/instances/501337//data/, Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 200, + Size: 270, Locked: false, IsRead: false, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/CustomScopes/_snapshots/CustomScopesWithPlaceholderTests.Full_auth=SystemUser_scope=custom-basic-instances.read-custom-basic-instances.write_1_Instantiation.verified.txt b/test/Altinn.App.Integration.Tests/CustomScopes/_snapshots/CustomScopesWithPlaceholderTests.Full_auth=SystemUser_scope=custom-basic-instances.read-custom-basic-instances.write_1_Instantiation.verified.txt index bc381f711b..f2bafe53cf 100644 --- a/test/Altinn.App.Integration.Tests/CustomScopes/_snapshots/CustomScopesWithPlaceholderTests.Full_auth=SystemUser_scope=custom-basic-instances.read-custom-basic-instances.write_1_Instantiation.verified.txt +++ b/test/Altinn.App.Integration.Tests/CustomScopes/_snapshots/CustomScopesWithPlaceholderTests.Full_auth=SystemUser_scope=custom-basic-instances.read-custom-basic-instances.write_1_Instantiation.verified.txt @@ -110,7 +110,7 @@ Apps: https://local.altinn.cloud:/ttd/basic/instances/501337//data/, Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 200, + Size: 270, Locked: false, IsRead: true, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/CustomScopes/_snapshots/CustomScopesWithPlaceholderTests.Full_auth=User_scope=custom-basic-instances.read-custom-basic-instances.write_1_Instantiation.verified.txt b/test/Altinn.App.Integration.Tests/CustomScopes/_snapshots/CustomScopesWithPlaceholderTests.Full_auth=User_scope=custom-basic-instances.read-custom-basic-instances.write_1_Instantiation.verified.txt index 9fd96d0698..eed516f114 100644 --- a/test/Altinn.App.Integration.Tests/CustomScopes/_snapshots/CustomScopesWithPlaceholderTests.Full_auth=User_scope=custom-basic-instances.read-custom-basic-instances.write_1_Instantiation.verified.txt +++ b/test/Altinn.App.Integration.Tests/CustomScopes/_snapshots/CustomScopesWithPlaceholderTests.Full_auth=User_scope=custom-basic-instances.read-custom-basic-instances.write_1_Instantiation.verified.txt @@ -110,7 +110,7 @@ Apps: https://local.altinn.cloud:/ttd/basic/instances/501337//data/, Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/501337//data/ }, - Size: 200, + Size: 270, Locked: false, IsRead: true, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/PartyTypesAllowed/_snapshots/SubunitOnlyAppTests.Instantiate_partyId=500002_0_Instance.verified.txt b/test/Altinn.App.Integration.Tests/PartyTypesAllowed/_snapshots/SubunitOnlyAppTests.Instantiate_partyId=500002_0_Instance.verified.txt index 3d0d24d88b..8a59479477 100644 --- a/test/Altinn.App.Integration.Tests/PartyTypesAllowed/_snapshots/SubunitOnlyAppTests.Instantiate_partyId=500002_0_Instance.verified.txt +++ b/test/Altinn.App.Integration.Tests/PartyTypesAllowed/_snapshots/SubunitOnlyAppTests.Instantiate_partyId=500002_0_Instance.verified.txt @@ -110,7 +110,7 @@ Apps: https://local.altinn.cloud:/ttd/basic/instances/500002//data/, Platform: https://platform.local.altinn.cloud/storage/api/v1/instances/500002//data/ }, - Size: 146, + Size: 222, Locked: false, IsRead: true, Created: DateTime_4, diff --git a/test/Altinn.App.Integration.Tests/_fixture/AppFixture.ApiResponse.cs b/test/Altinn.App.Integration.Tests/_fixture/AppFixture.ApiResponse.cs index f3e0e373ec..f769b905ed 100644 --- a/test/Altinn.App.Integration.Tests/_fixture/AppFixture.ApiResponse.cs +++ b/test/Altinn.App.Integration.Tests/_fixture/AppFixture.ApiResponse.cs @@ -75,7 +75,7 @@ public async Task> Read() } else { - model = JsonSerializer.Deserialize(body, _jsonSerializerOptions); + model = Argon.JsonConvert.DeserializeObject(body); } } catch (Exception ex) diff --git a/test/Altinn.App.Integration.Tests/_testapps/basic/App/models/model.calculation.json b/test/Altinn.App.Integration.Tests/_testapps/basic/App/models/model.calculation.json new file mode 100644 index 0000000000..be33700474 --- /dev/null +++ b/test/Altinn.App.Integration.Tests/_testapps/basic/App/models/model.calculation.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://altinncdn.no/toolkits/altinn-app-frontend/4/schemas/json/calculation/calculation.schema.v1.json", + "calculations": { + "price": { + "expression": 200 + }, + "total": { + "expression": ["multiply", ["dataModel", "price"], ["dataModel", "quantity"]] + } + } +} diff --git a/test/Altinn.App.Integration.Tests/_testapps/basic/App/models/model.cs b/test/Altinn.App.Integration.Tests/_testapps/basic/App/models/model.cs index f8a39d9658..1d33ab021a 100644 --- a/test/Altinn.App.Integration.Tests/_testapps/basic/App/models/model.cs +++ b/test/Altinn.App.Integration.Tests/_testapps/basic/App/models/model.cs @@ -26,5 +26,20 @@ public class model [JsonProperty("property3")] [JsonPropertyName("property3")] public string property3 { get; set; } + + [XmlElement("price", Order = 4)] + [JsonProperty("price")] + [JsonPropertyName("price")] + public decimal? price { get; set; } + + [XmlElement("quantity", Order = 5)] + [JsonProperty("quantity")] + [JsonPropertyName("quantity")] + public decimal quantity { get; set; } = 1; + + [XmlElement("total", Order = 6)] + [JsonProperty("total")] + [JsonPropertyName("total")] + public decimal? total { get; set; } } } diff --git a/test/Altinn.App.Integration.Tests/_testapps/basic/App/models/model.metadata.json b/test/Altinn.App.Integration.Tests/_testapps/basic/App/models/model.metadata.json deleted file mode 100644 index 92277366f3..0000000000 --- a/test/Altinn.App.Integration.Tests/_testapps/basic/App/models/model.metadata.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "Org": null, - "ServiceName": null, - "RepositoryName": null, - "ServiceId": null, - "TargetNamespace": null, - "elements": { - "model": { - "id": "model", - "parentElement": null, - "typeName": "model", - "name": "model", - "dataBindingName": null, - "xPath": "/model", - "restrictions": {}, - "type": 0, - "xsdValueType": null, - "texts": {}, - "customProperties": {}, - "maxOccurs": 1, - "minOccurs": 0, - "xName": "model", - "isTagContent": false, - "fixedValue": null, - "isReadOnly": false, - "xmlSchemaXPath": null, - "jsonSchemaPointer": "", - "displayString": "model : [0..1] 0", - "nillable": false - }, - "model.property1": { - "id": "model.property1", - "parentElement": "model", - "typeName": "property1", - "name": "property1", - "dataBindingName": "property1", - "xPath": "/model/property1", - "restrictions": {}, - "type": 0, - "xsdValueType": 0, - "texts": {}, - "customProperties": {}, - "maxOccurs": 1, - "minOccurs": 1, - "xName": "property1", - "isTagContent": false, - "fixedValue": null, - "isReadOnly": false, - "xmlSchemaXPath": null, - "jsonSchemaPointer": "/properties/property1", - "displayString": "model.property1 : [1..1] String", - "nillable": false - }, - "model.property2": { - "id": "model.property2", - "parentElement": "model", - "typeName": "property2", - "name": "property2", - "dataBindingName": "property2", - "xPath": "/model/property2", - "restrictions": {}, - "type": 0, - "xsdValueType": 0, - "texts": {}, - "customProperties": {}, - "maxOccurs": 1, - "minOccurs": 1, - "xName": "property2", - "isTagContent": false, - "fixedValue": null, - "isReadOnly": false, - "xmlSchemaXPath": null, - "jsonSchemaPointer": "/properties/property2", - "displayString": "model.property2 : [1..1] String", - "nillable": false - }, - "model.property3": { - "id": "model.property3", - "parentElement": "model", - "typeName": "property3", - "name": "property3", - "dataBindingName": "property3", - "xPath": "/model/property3", - "restrictions": {}, - "type": 0, - "xsdValueType": 0, - "texts": {}, - "customProperties": {}, - "maxOccurs": 1, - "minOccurs": 0, - "xName": "property3", - "isTagContent": false, - "fixedValue": null, - "isReadOnly": false, - "xmlSchemaXPath": null, - "jsonSchemaPointer": "/properties/property3", - "displayString": "model.property3 : [0..1] String", - "nillable": false - } - } -} \ No newline at end of file diff --git a/test/Altinn.App.Integration.Tests/_testapps/basic/App/models/model.schema.json b/test/Altinn.App.Integration.Tests/_testapps/basic/App/models/model.schema.json index b0fe262996..d25c3c190c 100644 --- a/test/Altinn.App.Integration.Tests/_testapps/basic/App/models/model.schema.json +++ b/test/Altinn.App.Integration.Tests/_testapps/basic/App/models/model.schema.json @@ -26,10 +26,19 @@ }, "property3": { "type": "string" + }, + "price": { + "type": "number" + }, + "quantity": { + "type": "number" + }, + "total": { + "type": "number" } }, "required": [ "property1", "property2" ] -} \ No newline at end of file +} diff --git a/test/Altinn.App.Integration.Tests/_testapps/basic/App/models/model.xsd b/test/Altinn.App.Integration.Tests/_testapps/basic/App/models/model.xsd index d13e8546b3..41e3bb4f2f 100644 --- a/test/Altinn.App.Integration.Tests/_testapps/basic/App/models/model.xsd +++ b/test/Altinn.App.Integration.Tests/_testapps/basic/App/models/model.xsd @@ -11,7 +11,10 @@ + + + - \ No newline at end of file +