Bounds2DIndex2DInvalidSectorSizeTestCases() { var list3x5 = new List2D <byte>(6, 10); list3x5.AddRows(3); list3x5.AddColumns(5); yield return(new TestCaseData( list3x5, new byte[4, 5], new Bounds2D(4, 5), new Index2D(0, 0))); yield return(new TestCaseData( list3x5, new byte[3, 6], new Bounds2D(3, 6), new Index2D(0, 0))); yield return(new TestCaseData( list3x5, new byte[2, 5], new Bounds2D(3, 5), new Index2D(0, 0))); yield return(new TestCaseData( list3x5, new byte[3, 4], new Bounds2D(3, 5), new Index2D(0, 0))); yield return(new TestCaseData( list3x5, new byte[3, 5], new Bounds2D(3, 5), new Index2D(1, 0))); yield return(new TestCaseData( list3x5, new byte[3, 5], new Bounds2D(3, 5), new Index2D(0, 1))); }
public static void TestRows(int rows) { var list = new List2D <int>(); list.AddRows(rows); Assert.AreEqual(rows, list.Rows); }
private static IEnumerable <TestCaseData> RowsInvalidCountTestCases() { var list3x2 = new List2D <byte>(7, 8); list3x2.AddRows(3); list3x2.AddColumns(2); yield return(new TestCaseData(list3x2, 0, -1)); }
public static List2D <T> CreateList2DWithBounds <T>(int rows, int columns) { var result = new List2D <T>(rows, columns); result.AddRows(rows); result.AddColumns(columns); return(result); }
public static void TestNoAlloc <T>(List2D <T> list, int count, List2D <T> expected) { list.IncreaseCapacity(expected.Capacity); Bounds2D expectedCapacity = list.Capacity; list.AddRows(count); Assert.AreEqual(expected.Boundaries, list.Boundaries); Assert.AreEqual(expectedCapacity, list.Capacity); CollectionAssert.AreEqual(expected, list); }
public static void Test <T>(List2D <T> list, int count, List2D <T> expected) { list.AddRows(count); Assert.AreEqual(expected.Boundaries, list.Boundaries, $"Expected: {expected.Boundaries.ToValueTuple()}\n" + $"But was: {list.Boundaries.ToValueTuple()}"); Assert.That(list.Capacity.Rows >= list.Rows); Assert.That(list.Capacity.Columns >= list.Columns); CollectionAssert.AreEqual(expected, list); }
private static IEnumerable <TestCaseData> InvalidDestArrayTestCases() { var list3x5 = new List2D <byte>(6, 10); list3x5.AddRows(3); list3x5.AddColumns(5); yield return(new TestCaseData(list3x5, new byte[2, 5])); yield return(new TestCaseData(list3x5, new byte[3, 4])); }
private static IEnumerable <TestCaseData> InvalidSourceIndexTestCases() { var list4x5 = new List2D <byte>(8, 10); list4x5.AddRows(4); list4x5.AddColumns(5); yield return(new TestCaseData(list4x5, new Index2D(0, -1))); yield return(new TestCaseData(list4x5, new Index2D(-1, 0))); yield return(new TestCaseData(list4x5, new Index2D(4, 0))); yield return(new TestCaseData(list4x5, new Index2D(0, 5))); }
private static IEnumerable <TestCaseData> Bounds2DInvalidSectorSizeTestCases() { var list3x5 = new List2D <byte>(6, 10); list3x5.AddRows(3); list3x5.AddColumns(5); yield return(new TestCaseData( list3x5, new byte[4, 5], new Bounds2D(4, 5))); yield return(new TestCaseData( list3x5, new byte[3, 6], new Bounds2D(3, 6))); yield return(new TestCaseData( list3x5, new byte[2, 5], new Bounds2D(3, 5))); yield return(new TestCaseData( list3x5, new byte[3, 4], new Bounds2D(3, 5))); }
private static IEnumerable <TestCaseData> Index2DInvalidDestArrayTestCases() { var list3x5 = new List2D <byte>(6, 10); list3x5.AddRows(3); list3x5.AddColumns(5); yield return(new TestCaseData( list3x5, new Array2D <byte>(3, 5), new Index2D(1, 0))); yield return(new TestCaseData( list3x5, new Array2D <byte>(3, 5), new Index2D(0, 1))); yield return(new TestCaseData( list3x5, new Array2D <byte>(2, 5), new Index2D(0, 0))); yield return(new TestCaseData( list3x5, new Array2D <byte>(3, 4), new Index2D(0, 0))); }
public static void ThrowsExceptionIfCountIsInvalid <T>(List2D <T> list, int count) => Assert.Throws <ArgumentOutOfRangeException>( () => list.AddRows(count));