Пример #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());
        }
Пример #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());
        }
Пример #3
0
        public void GetEnumerator_ReturnsEnumerator()
        {
            var contentList = new DocumentListContent <DocumentContent>();
            var itemToAdd   = Mock.Of <DocumentContent>();

            contentList.Add(itemToAdd);
            var enumerator = ((IEnumerable)contentList).GetEnumerator();

            Assert.NotNull(enumerator);
            while (enumerator.MoveNext())
            {
                var current = enumerator.Current;
                Assert.Equal(itemToAdd, current);
            }
        }