public void Do_not_include_parents_as_separate_items()
        {
            //Arrange
            var id            = 42;
            var parentId      = 2718;
            var itemsToReturn = new[]
            {
                new FlattenedHierarchyItem {
                    Id       = id,
                    ParentId = parentId
                },
                new FlattenedHierarchyItem
                {
                    Id = parentId
                }
            };
            var filereader  = new FileREaderMock(itemsToReturn);
            var integration = new FileIntegration(filereader.Object);

            //Act
            var result = integration.FetchAsync().Result;

            //Assert
            Assert.AreEqual(id, result.Single().Id);
        }
        public void Reads_stories_from_the_file()
        {
            //Arrange
            var filereader  = new FileREaderMock();
            var integration = new FileIntegration(filereader.Object);

            //Act
            _ = integration.FetchAsync().Result;

            //Assert
            filereader.Verify(mock => mock.ParseAsync(), Times.Once);
        }
        public void Maps_Title()
        {
            //Arrange
            var title         = "Foobar deluxe";
            var itemsToReturn = new[]
            {
                new FlattenedHierarchyItem {
                    Title = title
                }
            };
            var filereader  = new FileREaderMock(itemsToReturn);
            var integration = new FileIntegration(filereader.Object);

            //Act
            var result = integration.FetchAsync().Result;

            //Assert
            Assert.AreEqual(title, result.Single().Title);
        }
        public void Maps_Id()
        {
            //Arrange
            var id            = 42;
            var itemsToReturn = new[]
            {
                new FlattenedHierarchyItem {
                    Id = id
                }
            };
            var filereader  = new FileREaderMock(itemsToReturn);
            var integration = new FileIntegration(filereader.Object);

            //Act
            var result = integration.FetchAsync().Result;

            //Assert
            Assert.AreEqual(id, result.Single().Id);
        }
        public void Returns_the_stories_read_from_file()
        {
            //Arrange
            var itemsToReturn = new[]
            {
                new FlattenedHierarchyItem(),
                new FlattenedHierarchyItem(),
                new FlattenedHierarchyItem(),
                new FlattenedHierarchyItem()
            };
            var filereader  = new FileREaderMock(itemsToReturn);
            var integration = new FileIntegration(filereader.Object);

            //Act
            var result = integration.FetchAsync().Result;

            //Assert
            Assert.AreEqual(itemsToReturn.Count(), result.Count());
            foreach (var item in result)
            {
                Assert.IsNotNull(item);
            }
        }