public void Should_allow_adding_elements() { // given var list = new RdfListAdapter <IRdfListOwner, IRdfListNode <int>, int>(_context, _entity.Object, _override); // when list.Add(4); list.Add(8); // then list.Count.Should().Be(2); _contextMock.Verify(c => c.Create <IRdfListNode <int> >(It.IsAny <BlankId>()), Times.Exactly(2)); }
public void Should_allow_removing_last_elements_and_add_new_afterwards() { // given var list = new RdfListAdapter <IRdfListOwner, IRdfListNode <int>, int>(_context, _entity.Object, _override) { 666 }; // when list.Remove(666); list.Add(1337); list.Add(999); // then list.Should().ContainInOrder(1337, 999); }
public void Should_update_count_when_adding_elements() { // given var list = new RdfListAdapter <IRdfListOwner, IRdfListNode <int>, int>(_context, _entity.Object, _override) { 4, 5, 6, 7, 8 }; // then list.Add(10); // then list.Count.Should().Be(6); }
public void Removing_last_element_and_adding_new_to_end_should_keep_list_linked() { // given var list = new RdfListAdapter <IRdfListOwner, IRdfListNode <int>, int>(_context, _entity.Object, _override) { 4, 8, 8, 41, 666 }; // when list.Remove(666); list.Add(1337); // then list.Should().ContainInOrder(4, 8, 8, 41, 1337); }