public void GetValueAt() { // Empty path Assert.Throws(typeof(IndexOutOfRangeException), () => { path.GetValueAt(0, SnakeSpace.FromHead); }); Assert.Throws(typeof(IndexOutOfRangeException), () => { path.GetValueAt(0, SnakeSpace.FromTail); }); Assert.Throws(typeof(IndexOutOfRangeException), () => { path.GetValueAt(0, SnakeSpace.FromStart); }); path.PushToEnd(new int[] { 1, 2, 3 }); path.PopFromStart(); // SnakeSpace.FromHead Assert.Throws(typeof(IndexOutOfRangeException), () => { path.GetValueAt(-1, SnakeSpace.FromHead); }); Assert.AreEqual(3, path.GetValueAt(0, SnakeSpace.FromHead)); Assert.AreEqual(2, path.GetValueAt(1, SnakeSpace.FromHead)); Assert.Throws(typeof(IndexOutOfRangeException), () => { path.GetValueAt(2, SnakeSpace.FromHead); }); // SnakeSpace.FromTail Assert.Throws(typeof(IndexOutOfRangeException), () => { path.GetValueAt(-1, SnakeSpace.FromTail); }); Assert.AreEqual(2, path.GetValueAt(0, SnakeSpace.FromTail)); Assert.AreEqual(3, path.GetValueAt(1, SnakeSpace.FromTail)); Assert.Throws(typeof(IndexOutOfRangeException), () => { path.GetValueAt(2, SnakeSpace.FromTail); }); // SnakeSpace.FromStart Assert.Throws(typeof(IndexOutOfRangeException), () => { path.GetValueAt(0, SnakeSpace.FromStart); }); Assert.AreEqual(2, path.GetValueAt(1, SnakeSpace.FromStart)); Assert.AreEqual(3, path.GetValueAt(2, SnakeSpace.FromStart)); Assert.Throws(typeof(IndexOutOfRangeException), () => { path.GetValueAt(3, SnakeSpace.FromStart); }); }