diff --git a/src/modules/Elsa.Workflows.Management/Filters/WorkflowInstanceFilter.cs b/src/modules/Elsa.Workflows.Management/Filters/WorkflowInstanceFilter.cs index 27cc86ac2..6eeb37022 100644 --- a/src/modules/Elsa.Workflows.Management/Filters/WorkflowInstanceFilter.cs +++ b/src/modules/Elsa.Workflows.Management/Filters/WorkflowInstanceFilter.cs @@ -218,16 +218,16 @@ public class WorkflowInstanceFilter if (timestampFilters == null) yield break; - foreach (var timestampFilter in timestampFilters) + foreach (var (timestampFilter, index) in timestampFilters.Select((value, index) => (value, index))) { if (timestampFilter == null) { - yield return "Timestamp filter must be specified."; + yield return $"Timestamp filter at index {index} must be specified."; continue; } if (!TryNormalizeTimestampFilterColumn(timestampFilter.Column, out _, out var error)) - yield return error; + yield return $"Timestamp filter at index {index}: {error}"; } } @@ -251,7 +251,7 @@ public class WorkflowInstanceFilter if (normalizedColumn != null) return true; - error = $"Invalid timestamp filter column '{column}'. Allowed columns are: {string.Join(", ", TimestampFilterColumns)}."; + error = $"Invalid timestamp filter column. Allowed columns are: {string.Join(", ", TimestampFilterColumns)}."; return false; } diff --git a/test/integration/Elsa.Alterations.IntegrationTests/AlterationsApiTimestampFilterTests.cs b/test/integration/Elsa.Alterations.IntegrationTests/AlterationsApiTimestampFilterTests.cs index 372e866eb..f3b714770 100644 --- a/test/integration/Elsa.Alterations.IntegrationTests/AlterationsApiTimestampFilterTests.cs +++ b/test/integration/Elsa.Alterations.IntegrationTests/AlterationsApiTimestampFilterTests.cs @@ -97,7 +97,7 @@ public class AlterationsApiTimestampFilterTests : IAsyncLifetime var body = await response.Content.ReadAsStringAsync(); Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); - Assert.Contains("Timestamp filter must be specified.", body); + Assert.Contains("Timestamp filter at index 0 must be specified.", body); } [Theory] @@ -109,8 +109,8 @@ public class AlterationsApiTimestampFilterTests : IAsyncLifetime var body = await response.Content.ReadAsStringAsync(); Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); - Assert.Contains("Timestamp filter column must be specified.", body); - Assert.Contains("Timestamp filter must be specified.", body); + Assert.Contains("Timestamp filter at index 0: Timestamp filter column must be specified.", body); + Assert.Contains("Timestamp filter at index 1 must be specified.", body); } private static object CreateRequest(string path) diff --git a/test/integration/Elsa.Alterations.IntegrationTests/AssemblyInfo.cs b/test/integration/Elsa.Alterations.IntegrationTests/AssemblyInfo.cs deleted file mode 100644 index 217120083..000000000 --- a/test/integration/Elsa.Alterations.IntegrationTests/AssemblyInfo.cs +++ /dev/null @@ -1,3 +0,0 @@ -using Xunit; - -[assembly: CollectionBehavior(DisableTestParallelization = true)] diff --git a/test/unit/Elsa.Workflows.Management.UnitTests/Filters/WorkflowInstanceFilterTimestampTests.cs b/test/unit/Elsa.Workflows.Management.UnitTests/Filters/WorkflowInstanceFilterTimestampTests.cs index ad3978d56..833731126 100644 --- a/test/unit/Elsa.Workflows.Management.UnitTests/Filters/WorkflowInstanceFilterTimestampTests.cs +++ b/test/unit/Elsa.Workflows.Management.UnitTests/Filters/WorkflowInstanceFilterTimestampTests.cs @@ -67,7 +67,9 @@ public class WorkflowInstanceFilterTimestampTests var exception = Assert.Throws(() => filter.Apply(_workflowInstances).ToList()); Assert.Contains("Invalid timestamp filter column", exception.Message); - Assert.Contains("CreatedAt, UpdatedAt, FinishedAt", exception.Message); + Assert.DoesNotContain("CreatedAt == @0", exception.Message); + foreach (var column in WorkflowInstanceFilter.AllowedTimestampFilterColumns) + Assert.Contains(column, exception.Message); Assert.Equal($"{nameof(WorkflowInstanceFilter.TimestampFilters)}.Column", exception.ParamName); } @@ -99,7 +101,7 @@ public class WorkflowInstanceFilterTimestampTests ]).ToList(); var error = Assert.Single(errors); - Assert.Equal("Timestamp filter column must be specified.", error); + Assert.Equal("Timestamp filter at index 0: Timestamp filter column must be specified.", error); } [Fact] @@ -108,7 +110,7 @@ public class WorkflowInstanceFilterTimestampTests var errors = WorkflowInstanceFilter.ValidateTimestampFilters([null!]).ToList(); var error = Assert.Single(errors); - Assert.Equal("Timestamp filter must be specified.", error); + Assert.Equal("Timestamp filter at index 0 must be specified.", error); } private DateTimeOffset GetMatchingTimestamp(string column) => column switch