public static void CleanNullsChangeIndices() { var input = new ArrayList { new ArrayList { 1, null, 2, null, null }, new ArrayList { null, null, 3, 4, null }, new ArrayList { null, null }, new ArrayList { 1, 2 } }; var output = List.Clean(input, false); var expected = new ArrayList { new ArrayList { 1, 2 }, new ArrayList { 3, 4 }, new ArrayList { 1, 2 } }; Assert.AreEqual(expected, output); }
public static void CleanNullsPreserveIndicesEdgeCases() { // 1D array of nulls var input = new ArrayList { null }; var output = List.Clean(input); Assert.AreEqual(null, output); // list is null itself input = null; output = List.Clean(input); Assert.AreEqual(null, output); // nested array of nulls input = new ArrayList { new ArrayList { null } }; output = List.Clean(input); var expected = new ArrayList { null }; Assert.AreEqual(expected, output); // empty list input = new ArrayList(); output = List.Clean(input); expected = new ArrayList(); Assert.AreEqual(expected, output); // nested empty list input = new ArrayList { new ArrayList() }; output = List.Clean(input); expected = new ArrayList { new ArrayList() }; Assert.AreEqual(expected, output); }