elsa-core/test/unit/Elsa.Common.Core/EnumerableExtensionsTests.cs
raymonddenhaan 4b151ff8af
Feature/cancel dispatched workflows (#5136)
* Made cancel API call dispatch the request

* Added ParentWorkflowInstanceId

* Recursively cancel child workflows

* Made single workflow cancellation include child workflows

* Updated migrations

* Processed comments
2024-03-27 12:07:55 +01:00

29 lines
737 B
C#

using Elsa.Extensions;
using Xunit;
namespace Elsa.Common.Core;
public class EnumerableExtensionsTests
{
[Fact]
public void ToBatches_ReturnsItemsInListOfPages()
{
var items = new List<int>
{
1,
2,
3,
4,
5
};
var batchSize = 2;
var batches = items.ToBatches(batchSize).ToList();
Assert.Equal(3, batches.Count);
Assert.Equal(2, batches.ElementAt(0).Count());
Assert.Equal(2, batches.ElementAt(1).Count());
Assert.Equal(1, batches.ElementAt(2).Count());
Assert.Equal(3, batches.ElementAt(1).ElementAt(0));
Assert.Equal(4, batches.ElementAt(1).ElementAt(1));
}
}