public void When_UserTriesToSetCursorToTailOfNotEmptyList_Must_BeSet() { LinkedListModel <int> list = null; "Given not empty list model" .x(() => { list = new LinkedListModel <int>(); list.AddInTail(10); }); "When user tries to set cursor to tail of such list" .x(() => { list.CursorToTail(); }); "Then cursor must be in tail of list" .x(() => { var isInHead = list.IsCursorInTail(); isInHead.Should().BeTrue(); }); }
public void When_CursorIsNotInTailAndMoveNextFuncTakeCursorToTailCursor_Must_BeInTail() { LinkedListModel <int> list = null; "Given not empty list model with items 1 2 3 4 5" .x(() => { list = new LinkedListModel <int>(); list.AddInTail(1); list.AddInTail(2); list.AddInTail(3); list.AddInTail(4); list.AddInTail(5); }); "And cursor is set in item with value 4" .x(() => { // set cursor to tail list.CursorToHead(); list.SetToNextSameItem(4); }); "When user tries to move cursor next" .x(() => { list.MoveCursorNext(); }); "Then cursor must indicates to value 5 and be in tail" .x(() => { var item = list.GetItem(); var isInTail = list.IsCursorInTail(); item.Should().Be(5); isInTail.Should().BeTrue(); }); }
public void When_CursorIsInTailMoveNext_DoNotMoveCursor() { LinkedListModel <int> list = null; "Given not empty list model with items 1 2 3 4 5" .x(() => { list = new LinkedListModel <int>(); list.AddInTail(1); list.AddInTail(2); list.AddInTail(3); list.AddInTail(4); list.AddInTail(5); }); "And cursor is set in tail" .x(() => { // set cursor to tail list.CursorToTail(); }); "When user tries to move cursor next" .x(() => { list.MoveCursorNext(); }); "Then cursor must be still indicate to tail item because next node are not exists" .x(() => { var isInTail = list.IsCursorInTail(); var item = list.GetItem(); item.Should().Be(5); isInTail.Should().BeTrue(); }); }
public void When_ListNotEmptyAndCursorIsNotInTailMoveNext_SetCursoreToNextNode() { LinkedListModel <int> list = null; "Given not empty list model with items 1 2 3 4 5" .x(() => { list = new LinkedListModel <int>(); list.AddInTail(1); list.AddInTail(2); list.AddInTail(3); list.AddInTail(4); list.AddInTail(5); }); "And cursor is set in value 3" .x(() => { // set cursor and move to 3 item list.CursorToHead(); list.SetToNextSameItem(3); }); "When user tries to move cursor next" .x(() => { list.MoveCursorNext(); }); "Then cursor must be indicate to item with value 4" .x(() => { var item = list.GetItem(); item.Should().Be(4); }); }