[TestCase(new[] { 1, 1, 1, 1 }, 1, new[] { 1, 1, 1 }, new[] { 1, 2, 3, 4 })] // invalid input might cause some of id mapping will be lost. public void TestResortOrder(int[] orders, int startFrom, int[] movingOrders, int[] newOrder) { var objects = orders?.Select(x => new TestOrderObject { Order = x }).ToArray(); var movingStepResult = new List <int>(); OrderUtils.ResortOrder(objects, startFrom, (_, o, _) => { movingStepResult.Add(o); }); // convert order result. var result = objects?.Select(x => x.Order).ToArray(); Assert.AreEqual(result, newOrder); // should check moving order step also. Assert.AreEqual(movingStepResult.ToArray(), movingOrders); }