예제 #1
0
                public static void TestNoAlloc <T>(List2D <T> list, List2D <T> expected)
                {
                    list.IncreaseCapacity(expected.Capacity);
                    Bounds2D expectedCapacity = list.Capacity;

                    list.AddRow();
                    Assert.AreEqual(expected.Boundaries, list.Boundaries);
                    Assert.AreEqual(expectedCapacity, list.Capacity);
                    CollectionAssert.AreEqual(expected, list);
                }
예제 #2
0
 public static void Test <T>(List2D <T> list, List2D <T> expected)
 {
     list.AddRow();
     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);
 }
예제 #3
0
                public static void ThrowsExceptionUponListModification()
                {
                    var list = new List2D <byte>(1, 1);

                    list.AddRow();
                    list.AddColumn();

                    Assert.Throws <InvalidOperationException>(
                        () => list.ForEach(new BoxedAction <byte>(o => list.AddColumn())));
                }
            public static void MoveNextThrowsExceptionUponListModification()
            {
                var list = new List2D <byte>(1, 1);

                list.AddRow();
                list.AddColumn();

                Assert.Throws <InvalidOperationException>(() =>
                {
                    foreach (byte item in list)
                    {
                        list.AddColumn();
                    }
                });
            }