Example #1
0
        public void Remove_ItemFromTheCollection_RemovesItem()
        {
            var contentList        = new DocumentListContent <DocumentContent>();
            var itemToAddAndRemove = Mock.Of <DocumentContent>();

            contentList.Add(itemToAddAndRemove);
            contentList.Remove(itemToAddAndRemove);
            Assert.Equal(0, contentList.Count());
        }
Example #2
0
        public void Add_ContentItem_AddsItemToInternalCollection()
        {
            var contentList = new DocumentListContent <DocumentContent>();
            var itemToAdd   = Mock.Of <DocumentContent>();

            contentList.Add(itemToAdd);
            var firstItemFromCollection = contentList.FirstOrDefault();

            Assert.Equal(itemToAdd, firstItemFromCollection);
            Assert.Equal(1, contentList.Count());
        }
Example #3
0
        public void AddRange_RangeOfContentItems_AddsItemRangeToInternalCollection()
        {
            var contentList = new DocumentListContent <DocumentContent>();
            var itemToAdd1  = Mock.Of <DocumentContent>();
            var itemToAdd2  = Mock.Of <DocumentContent>();
            var itemToAdd3  = Mock.Of <DocumentContent>();
            var range       = new[] { itemToAdd1, itemToAdd2, itemToAdd3 };

            contentList.AddRange(range);
            Assert.Equal(3, contentList.Count());
            Assert.All(range, content =>
            {
                Assert.True(contentList.Contains(content));
            });
        }