From 207980788597b0baa5df36bc02f96b8346e9c5bc Mon Sep 17 00:00:00 2001 From: Henning Normann Date: Fri, 22 Mar 2024 10:57:14 +0100 Subject: [PATCH 1/2] Changed instance update to reflect various json merge needs. Cases: - Process: Insert complete json - Substatus: Insert complete json - Status: Merge propertis based on updateProperties in repo api - CompleteConfirmations: Merge properties - Datavalues: Merge properties - PresentationTexts: Merge properties - Other top level properties (lastchanged and lastchangedby): Merge properties - "Complications": Process and Substatus might be combined, and the different combinations must be treated separately --- .../Controllers/InstancesController.cs | 3 - src/Storage/Controllers/ProcessController.cs | 15 -- .../v0.06/01-functions-and-procedures.sql | 135 +++++++++++++++ .../Repository/PgInstanceRepository.cs | 18 +- .../TestingRepositories/InstanceTests.cs | 158 ++++++++++++++---- 5 files changed, 273 insertions(+), 56 deletions(-) create mode 100644 src/Storage/Migration/v0.06/01-functions-and-procedures.sql diff --git a/src/Storage/Controllers/InstancesController.cs b/src/Storage/Controllers/InstancesController.cs index 513af5b7..ced7099e 100644 --- a/src/Storage/Controllers/InstancesController.cs +++ b/src/Storage/Controllers/InstancesController.cs @@ -610,10 +610,7 @@ public async Task> UpdateSubstatus( try { List updateProperties = [ - nameof(instance.Status), nameof(instance.Status.Substatus), - nameof(instance.Status.Substatus.Description), - nameof(instance.Status.Substatus.Label), nameof(instance.LastChanged), nameof(instance.LastChangedBy) ]; diff --git a/src/Storage/Controllers/ProcessController.cs b/src/Storage/Controllers/ProcessController.cs index 49bdfd24..fe321d0a 100644 --- a/src/Storage/Controllers/ProcessController.cs +++ b/src/Storage/Controllers/ProcessController.cs @@ -118,21 +118,6 @@ public async Task> PutProcess( // Archiving instance if process was ended List updateProperties = [ nameof(existingInstance.Process), - nameof(existingInstance.Process.CurrentTask), - nameof(existingInstance.Process.CurrentTask.AltinnTaskType), - nameof(existingInstance.Process.CurrentTask.ElementId), - nameof(existingInstance.Process.CurrentTask.Ended), - nameof(existingInstance.Process.CurrentTask.Flow), - nameof(existingInstance.Process.CurrentTask.FlowType), - nameof(existingInstance.Process.CurrentTask.Name), - nameof(existingInstance.Process.CurrentTask.Started), - nameof(existingInstance.Process.CurrentTask.Validated), - nameof(existingInstance.Process.CurrentTask.Validated.Timestamp), - nameof(existingInstance.Process.CurrentTask.Validated.CanCompleteTask), - nameof(existingInstance.Process.Ended), - nameof(existingInstance.Process.EndEvent), - nameof(existingInstance.Process.Started), - nameof(existingInstance.Process.StartEvent), nameof(existingInstance.LastChanged), nameof(existingInstance.LastChangedBy) ]; diff --git a/src/Storage/Migration/v0.06/01-functions-and-procedures.sql b/src/Storage/Migration/v0.06/01-functions-and-procedures.sql new file mode 100644 index 00000000..b5d455bb --- /dev/null +++ b/src/Storage/Migration/v0.06/01-functions-and-procedures.sql @@ -0,0 +1,135 @@ +CREATE OR REPLACE FUNCTION storage.updateinstance_v2( + _alternateid UUID, + _toplevelsimpleprops JSONB, + _datavalues JSONB, + _completeconfirmations JSONB, + _presentationtexts JSONB, + _status JSONB, + _substatus JSONB, + _process JSONB, + _lastchanged TIMESTAMPTZ, + _taskid TEXT) + RETURNS TABLE (updatedInstance JSONB) + LANGUAGE 'plpgsql' +AS $BODY$ +BEGIN + IF _datavalues IS NOT NULL THEN + RETURN QUERY + UPDATE storage.instances SET + instance = instance || _toplevelsimpleprops || + jsonb_strip_nulls( + jsonb_set( + '{"DataValues":""}', + '{DataValues}', + CASE WHEN instance -> 'DataValues' IS NOT NULL THEN + instance -> 'DataValues' || _datavalues + ELSE + _datavalues + END + ) + ), + lastchanged = _lastchanged + WHERE _alternateid = alternateid + RETURNING instance; + ELSIF _presentationtexts IS NOT NULL THEN + RETURN QUERY + UPDATE storage.instances SET + instance = instance || _toplevelsimpleprops || + jsonb_strip_nulls( + jsonb_set( + '{"PresentationTexts":""}', + '{PresentationTexts}', + CASE WHEN instance -> 'PresentationTexts' IS NOT NULL THEN + instance -> 'PresentationTexts' || _presentationtexts + ELSE + _presentationtexts + END + ) + ), + lastchanged = _lastchanged + WHERE _alternateid = alternateid + RETURNING instance; + ELSIF _completeconfirmations IS NOT NULL THEN + RETURN QUERY + UPDATE storage.instances SET + instance = instance || _toplevelsimpleprops || + jsonb_set( + '{"CompleteConfirmations":""}', + '{CompleteConfirmations}', + CASE WHEN instance -> 'CompleteConfirmations' IS NOT NULL THEN + instance -> 'CompleteConfirmations' || _completeconfirmations + ELSE + _completeconfirmations + END + ), + lastchanged = _lastchanged + WHERE _alternateid = alternateid + RETURNING instance; + ELSIF _status IS NOT NULL AND _process IS NULL THEN + RETURN QUERY + UPDATE storage.instances SET + instance = instance || + jsonb_set( + instance || _toplevelsimpleprops, + '{Status}', + CASE WHEN instance -> 'Status' IS NOT NULL THEN + instance -> 'Status' || _status + ELSE + _status + END + ), + lastchanged = _lastchanged + WHERE _alternateid = alternateid + RETURNING instance; + ELSIF _substatus IS NOT NULL THEN + RETURN QUERY + UPDATE storage.instances SET + instance = instance || + jsonb_set( + instance || _toplevelsimpleprops, + '{Status, Substatus}', + jsonb_strip_nulls(_substatus) + ), + lastchanged = _lastchanged + WHERE _alternateid = alternateid + RETURNING instance; + ELSIF _process IS NOT NULL AND _status IS NOT NULL THEN + RETURN QUERY + UPDATE storage.instances SET + instance = instance || + jsonb_set( + instance || _toplevelsimpleprops, + '{Process}', + jsonb_strip_nulls(_process) + ) || + jsonb_set( + '{"Status":""}', + '{Status}', + CASE WHEN instance -> 'Status' IS NOT NULL THEN + instance -> 'Status' || _status + ELSE + _status + END + ), + lastchanged = _lastchanged, + taskid = _taskid + WHERE _alternateid = alternateid + RETURNING instance; + ELSIF _process IS NOT NULL THEN + RETURN QUERY + UPDATE storage.instances SET + instance = instance || + jsonb_set( + instance || _toplevelsimpleprops, + '{Process}', + jsonb_strip_nulls(_process) + ), + lastchanged = _lastchanged, + taskid = _taskid + WHERE _alternateid = alternateid + RETURNING instance; + ELSE + RAISE EXCEPTION 'Unexpected parameters to update instance'; + END IF; +END; +$BODY$; diff --git a/src/Storage/Repository/PgInstanceRepository.cs b/src/Storage/Repository/PgInstanceRepository.cs index 10ee33f5..c3431d88 100644 --- a/src/Storage/Repository/PgInstanceRepository.cs +++ b/src/Storage/Repository/PgInstanceRepository.cs @@ -24,7 +24,7 @@ public class PgInstanceRepository: IInstanceRepository private const string _readSqlFilteredInitial = "select * from storage.readinstancefromquery_v2 ("; private readonly string _deleteSql = "select * from storage.deleteinstance ($1)"; private readonly string _insertSql = "call storage.insertinstance ($1, $2, $3, $4, $5, $6, $7, $8)"; - private readonly string _updateSql = "select * from storage.updateinstance ($1, $2, $3, $4, $5, $6)"; + private readonly string _updateSql = "select * from storage.updateinstance_v2 (@_alternateid, @_toplevelsimpleprops, @_datavalues, @_completeconfirmations, @_presentationtexts, @_status, @_substatus, @_process, @_lastchanged, @_taskid)"; private readonly string _readSql = "select * from storage.readinstance ($1)"; private readonly string _readSqlFiltered = _readSqlFilteredInitial; private readonly string _readDeletedSql = "select * from storage.readdeletedinstances ()"; @@ -377,12 +377,16 @@ public async Task Update(Instance instance, List updatePropert instance.Data = null; await using NpgsqlCommand pgcom = _dataSource.CreateCommand(_updateSql); using TelemetryTracker tracker = new(_telemetryClient, pgcom); - pgcom.Parameters.AddWithValue(NpgsqlDbType.Uuid, new Guid(instance.Id)); - pgcom.Parameters.AddWithValue(NpgsqlDbType.Jsonb, CustomSerializer.Serialize(instance, updateProperties)); - pgcom.Parameters.AddWithValue(NpgsqlDbType.Jsonb, updateProperties.Contains(nameof(instance.DataValues)) ? instance.DataValues : DBNull.Value); - pgcom.Parameters.AddWithValue(NpgsqlDbType.Jsonb, updateProperties.Contains(nameof(instance.CompleteConfirmations)) ? instance.CompleteConfirmations : DBNull.Value); - pgcom.Parameters.AddWithValue(NpgsqlDbType.TimestampTz, instance.LastChanged ?? DateTime.UtcNow); - pgcom.Parameters.AddWithValue(NpgsqlDbType.Text, instance.Process?.CurrentTask?.ElementId ?? (object)DBNull.Value); + pgcom.Parameters.AddWithValue("_alternateid", NpgsqlDbType.Uuid, new Guid(instance.Id)); + pgcom.Parameters.AddWithValue("_toplevelsimpleprops", NpgsqlDbType.Jsonb, CustomSerializer.Serialize(instance, updateProperties)); + pgcom.Parameters.AddWithValue("_datavalues", NpgsqlDbType.Jsonb, updateProperties.Contains(nameof(instance.DataValues)) ? instance.DataValues : DBNull.Value); + pgcom.Parameters.AddWithValue("_completeconfirmations", NpgsqlDbType.Jsonb, updateProperties.Contains(nameof(instance.CompleteConfirmations)) ? instance.CompleteConfirmations : DBNull.Value); + pgcom.Parameters.AddWithValue("_presentationtexts", NpgsqlDbType.Jsonb, updateProperties.Contains(nameof(instance.PresentationTexts)) ? instance.PresentationTexts : DBNull.Value); + pgcom.Parameters.AddWithValue("_status", NpgsqlDbType.Jsonb, updateProperties.Contains(nameof(instance.Status)) ? CustomSerializer.Serialize(instance.Status, updateProperties) : DBNull.Value); + pgcom.Parameters.AddWithValue("_substatus", NpgsqlDbType.Jsonb, updateProperties.Contains(nameof(instance.Status.Substatus)) ? instance.Status.Substatus : DBNull.Value); + pgcom.Parameters.AddWithValue("_process", NpgsqlDbType.Jsonb, updateProperties.Contains(nameof(instance.Process)) ? instance.Process : DBNull.Value); + pgcom.Parameters.AddWithValue("_lastchanged", NpgsqlDbType.TimestampTz, instance.LastChanged ?? DateTime.UtcNow); + pgcom.Parameters.AddWithValue("_taskid", NpgsqlDbType.Text, instance.Process?.CurrentTask?.ElementId ?? (object)DBNull.Value); await using NpgsqlDataReader reader = await pgcom.ExecuteReaderAsync(); if (await reader.ReadAsync()) diff --git a/test/UnitTest/TestingRepositories/InstanceTests.cs b/test/UnitTest/TestingRepositories/InstanceTests.cs index de8e4d8a..65179ea4 100644 --- a/test/UnitTest/TestingRepositories/InstanceTests.cs +++ b/test/UnitTest/TestingRepositories/InstanceTests.cs @@ -50,9 +50,13 @@ public async Task Instance_Update_Task_Ok() { // Arrange Instance newInstance = TestData.Instance_1_1.Clone(); + newInstance.Process.CurrentTask.Name = "Before update"; + newInstance.Process.StartEvent = "s1"; newInstance = await _instanceFixture.InstanceRepo.Create(newInstance); newInstance.Process.CurrentTask.ElementId = "Task_2"; - newInstance.Process.CurrentTask.Name = "Shouldn't be updated"; + newInstance.Process.CurrentTask.Name = "After update"; + newInstance.Process.StartEvent = null; + newInstance.Process.EndEvent = "e1"; newInstance.LastChanged = DateTime.UtcNow; newInstance.LastChangedBy = "unittest"; @@ -60,8 +64,6 @@ public async Task Instance_Update_Task_Ok() updateProperties.Add(nameof(newInstance.LastChanged)); updateProperties.Add(nameof(newInstance.LastChangedBy)); updateProperties.Add(nameof(newInstance.Process)); - updateProperties.Add(nameof(newInstance.Process.CurrentTask)); - updateProperties.Add(nameof(newInstance.Process.CurrentTask.ElementId)); // Act Instance updatedInstance = await _instanceFixture.InstanceRepo.Update(newInstance, updateProperties); @@ -72,7 +74,48 @@ public async Task Instance_Update_Task_Ok() int count = await PostgresUtil.RunCountQuery(sql); Assert.Equal(1, count); Assert.Equal("Task_2", updatedInstance.Process.CurrentTask.ElementId); - Assert.NotEqual("Shouldn't be updated", updatedInstance.Process.CurrentTask.Name); + Assert.Equal(newInstance.Process.CurrentTask.Name, updatedInstance.Process.CurrentTask.Name); + Assert.Equal("After update", updatedInstance.Process.CurrentTask.Name); + Assert.Equal("e1", newInstance.Process.EndEvent); + Assert.Null(newInstance.Process.StartEvent); + Assert.Equal(newInstance.LastChanged, updatedInstance.LastChanged); + Assert.Equal(newInstance.LastChangedBy, updatedInstance.LastChangedBy); + } + + /// + /// Test update status + /// + [Fact] + public async Task Instance_Update_Status_Ok() + { + // Arrange + Instance newInstance = TestData.Instance_1_1.Clone(); + newInstance.Status.IsArchived = true; + newInstance.Status.Substatus = new() { Description = "desc " }; + newInstance = await _instanceFixture.InstanceRepo.Create(newInstance); + newInstance.LastChanged = DateTime.UtcNow; + newInstance.Status.IsSoftDeleted = true; + newInstance.LastChangedBy = "unittest"; + + List updateProperties = [ + nameof(newInstance.Status), + nameof(newInstance.Status.IsSoftDeleted), + nameof(newInstance.LastChanged), + nameof(newInstance.LastChangedBy) + ]; + + // Act + Instance updatedInstance = await _instanceFixture.InstanceRepo.Update(newInstance, updateProperties); + + // Assert + string sql = $"select count(*) from storage.instances where alternateid = '{TestData.Instance_1_1.Id.Split('/').Last()}'"; + int count = await PostgresUtil.RunCountQuery(sql); + Assert.Equal(1, count); + Assert.Equal(newInstance.Status.IsArchived, updatedInstance.Status.IsArchived); + Assert.Equal(newInstance.Status.IsSoftDeleted, updatedInstance.Status.IsSoftDeleted); + Assert.Equal(newInstance.LastChanged, updatedInstance.LastChanged); + Assert.Equal(newInstance.LastChangedBy, updatedInstance.LastChangedBy); + Assert.Equal(newInstance.Status.Substatus.Description, updatedInstance.Status.Substatus.Description); } /// @@ -83,16 +126,16 @@ public async Task Instance_Update_Substatus_Ok() { // Arrange Instance newInstance = TestData.Instance_1_1.Clone(); + newInstance.Status.IsArchived = true; + newInstance.Status.Substatus = new() { Description = "substatustest-desc" }; newInstance = await _instanceFixture.InstanceRepo.Create(newInstance); - newInstance.Status.Substatus = new() { Description = "substatustest" }; + newInstance.Status.Substatus = new() { Label = "substatustest-label" }; newInstance.LastChanged = DateTime.UtcNow; newInstance.LastChangedBy = "unittest"; + newInstance.Status.IsArchived = false; List updateProperties = [ - nameof(newInstance.Status), nameof(newInstance.Status.Substatus), - nameof(newInstance.Status.Substatus.Description), - nameof(newInstance.Status.Substatus.Label), nameof(newInstance.LastChanged), nameof(newInstance.LastChangedBy) ]; @@ -104,7 +147,11 @@ public async Task Instance_Update_Substatus_Ok() string sql = $"select count(*) from storage.instances where alternateid = '{TestData.Instance_1_1.Id.Split('/').Last()}'"; int count = await PostgresUtil.RunCountQuery(sql); Assert.Equal(1, count); - Assert.Equal(newInstance.Status.Substatus.Description, updatedInstance.Status.Substatus.Description); + Assert.Equal("substatustest-label", updatedInstance.Status.Substatus.Label); + Assert.Null(updatedInstance.Status.Substatus.Description); + Assert.True(updatedInstance.Status.IsArchived); + Assert.Equal(newInstance.LastChanged, updatedInstance.LastChanged); + Assert.Equal(newInstance.LastChangedBy, updatedInstance.LastChangedBy); } /// @@ -115,9 +162,9 @@ public async Task Instance_Update_PresentationTexts_Ok() { // Arrange Instance newInstance = TestData.Instance_1_1.Clone(); - newInstance.PresentationTexts = new() { { "k1", "v1" } }; + newInstance.PresentationTexts = new() { { "k1", "v1" }, { "k2", "v2" } }; newInstance = await _instanceFixture.InstanceRepo.Create(newInstance); - newInstance.PresentationTexts = new() { { "k2", "v2" }, { "k3", "v3" } }; + newInstance.PresentationTexts = new() { { "k2", null }, { "k3", "v3" } }; newInstance.LastChanged = DateTime.UtcNow; newInstance.LastChangedBy = "unittest"; @@ -135,16 +182,22 @@ public async Task Instance_Update_PresentationTexts_Ok() int count = await PostgresUtil.RunCountQuery(sql); Assert.Equal(1, count); Assert.Equal(2, updatedInstance.PresentationTexts.Count); + Assert.True(updatedInstance.PresentationTexts.ContainsKey("k1")); + Assert.True(updatedInstance.PresentationTexts.ContainsKey("k3")); + Assert.Equal(newInstance.LastChanged, updatedInstance.LastChanged); + Assert.Equal(newInstance.LastChangedBy, updatedInstance.LastChangedBy); } /// /// Test update process /// [Fact] - public async Task Instance_Update_Process_Ok() + public async Task Instance_Update_Process_And_Status_Ok() { // Arrange + DateTime unchangedSofteDeleted = DateTime.UtcNow.AddYears(-2); Instance newInstance = TestData.Instance_1_1.Clone(); + newInstance.Status.SoftDeleted = unchangedSofteDeleted; newInstance = await _instanceFixture.InstanceRepo.Create(newInstance); newInstance.Process = new() { @@ -156,26 +209,60 @@ public async Task Instance_Update_Process_Ok() }; newInstance.LastChanged = DateTime.UtcNow; newInstance.LastChangedBy = "unittest"; + newInstance.Status.HardDeleted = DateTime.UtcNow; + newInstance.Status.SoftDeleted = unchangedSofteDeleted.AddYears(1); List updateProperties = [ nameof(newInstance.Process), - nameof(newInstance.Process.CurrentTask), - nameof(newInstance.Process.CurrentTask.AltinnTaskType), - nameof(newInstance.Process.CurrentTask.ElementId), - nameof(newInstance.Process.CurrentTask.Ended), - nameof(newInstance.Process.CurrentTask.Flow), - nameof(newInstance.Process.CurrentTask.FlowType), - nameof(newInstance.Process.CurrentTask.Name), - nameof(newInstance.Process.CurrentTask.Started), - nameof(newInstance.Process.CurrentTask.Validated), - nameof(newInstance.Process.CurrentTask.Validated.Timestamp), - nameof(newInstance.Process.CurrentTask.Validated.CanCompleteTask), - nameof(newInstance.Process.Ended), - nameof(newInstance.Process.EndEvent), - nameof(newInstance.Process.Started), - nameof(newInstance.Process.StartEvent), nameof(newInstance.LastChanged), - nameof(newInstance.LastChangedBy) + nameof(newInstance.LastChangedBy), + nameof(newInstance.Status), + nameof(newInstance.Status.HardDeleted), + ]; + + // Act + Instance updatedInstance = await _instanceFixture.InstanceRepo.Update(newInstance, updateProperties); + + // Assert + string sql = $"select count(*) from storage.instances where alternateid = '{TestData.Instance_1_1.Id.Split('/').Last()}'" + + $" and instance ->> 'LastChangedBy' = 'unittest'"; + int count = await PostgresUtil.RunCountQuery(sql); + Assert.Equal(1, count); + Assert.Equal(newInstance.Process.CurrentTask.AltinnTaskType, updatedInstance.Process.CurrentTask.AltinnTaskType); + Assert.Equal(newInstance.Process.Ended, updatedInstance.Process.Ended); + Assert.Equal(newInstance.LastChanged, updatedInstance.LastChanged); + Assert.Equal(newInstance.LastChangedBy, updatedInstance.LastChangedBy); + Assert.Equal(newInstance.Status.HardDeleted, updatedInstance.Status.HardDeleted); + Assert.Equal(unchangedSofteDeleted, updatedInstance.Status.SoftDeleted); + } + + /// + /// Test update process without updating status + /// + [Fact] + public async Task Instance_Update_Process_And_No_Status_Ok() + { + // Arrange + DateTime unchangedSofteDeleted = DateTime.UtcNow.AddYears(-2); + Instance newInstance = TestData.Instance_1_1.Clone(); + newInstance.Status.SoftDeleted = unchangedSofteDeleted; + newInstance = await _instanceFixture.InstanceRepo.Create(newInstance); + newInstance.Process = new() + { + CurrentTask = new() + { + AltinnTaskType = "Task_3" + }, + Ended = DateTime.Parse("2023-12-24") + }; + newInstance.LastChanged = DateTime.UtcNow; + newInstance.LastChangedBy = "unittest"; + newInstance.Status.SoftDeleted = unchangedSofteDeleted.AddYears(1); + + List updateProperties = [ + nameof(newInstance.Process), + nameof(newInstance.LastChanged), + nameof(newInstance.LastChangedBy), ]; // Act @@ -188,6 +275,9 @@ public async Task Instance_Update_Process_Ok() Assert.Equal(1, count); Assert.Equal(newInstance.Process.CurrentTask.AltinnTaskType, updatedInstance.Process.CurrentTask.AltinnTaskType); Assert.Equal(newInstance.Process.Ended, updatedInstance.Process.Ended); + Assert.Equal(newInstance.LastChanged, updatedInstance.LastChanged); + Assert.Equal(newInstance.LastChangedBy, updatedInstance.LastChangedBy); + Assert.Equal(unchangedSofteDeleted, updatedInstance.Status.SoftDeleted); } /// @@ -198,9 +288,9 @@ public async Task Instance_Update_DataValues_Ok() { // Arrange Instance newInstance = TestData.Instance_1_1.Clone(); - newInstance.DataValues = new() { { "k1", "v1" } }; + newInstance.DataValues = new() { { "k1", "v1" }, { "k2", "v2" } }; newInstance = await _instanceFixture.InstanceRepo.Create(newInstance); - newInstance.DataValues = new() { { "k2", "v2" }, { "k3", "v3" } }; + newInstance.DataValues = new() { { "k2", null }, { "k3", "v3" } }; newInstance.LastChanged = DateTime.UtcNow; newInstance.LastChangedBy = "unittest"; @@ -217,7 +307,11 @@ public async Task Instance_Update_DataValues_Ok() $" and instance ->> 'LastChangedBy' = 'unittest'"; int count = await PostgresUtil.RunCountQuery(sql); Assert.Equal(1, count); - Assert.Equal(3, updatedInstance.DataValues.Count); + Assert.Equal(2, updatedInstance.DataValues.Count); + Assert.True(updatedInstance.DataValues.ContainsKey("k1")); + Assert.True(updatedInstance.DataValues.ContainsKey("k3")); + Assert.Equal(newInstance.LastChanged, updatedInstance.LastChanged); + Assert.Equal(newInstance.LastChangedBy, updatedInstance.LastChangedBy); } /// @@ -248,6 +342,8 @@ public async Task Instance_Update_CompleteConfirmations_Ok() int count = await PostgresUtil.RunCountQuery(sql); Assert.Equal(1, count); Assert.Equal(2, updatedInstance.CompleteConfirmations.Count); + Assert.Equal(newInstance.LastChanged, updatedInstance.LastChanged); + Assert.Equal(newInstance.LastChangedBy, updatedInstance.LastChangedBy); } /// From 5be03a8185caa69650626de26118700b253c002d Mon Sep 17 00:00:00 2001 From: Henning Normann Date: Mon, 8 Apr 2024 10:29:15 +0200 Subject: [PATCH 2/2] Changed property of appsettings.json to "copy allways" --- test/UnitTest/Altinn.Platform.Storage.UnitTest.csproj | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/UnitTest/Altinn.Platform.Storage.UnitTest.csproj b/test/UnitTest/Altinn.Platform.Storage.UnitTest.csproj index 7147b764..c16ac346 100644 --- a/test/UnitTest/Altinn.Platform.Storage.UnitTest.csproj +++ b/test/UnitTest/Altinn.Platform.Storage.UnitTest.csproj @@ -174,4 +174,10 @@ <_ContentIncludedByDefault Remove="data\roles\user_5\party_1337\roles.json" /> + + + Always + + +