public void Map_HasResultsAndParents_MapsParents()
        {
            //Arrange
            var manyToManyItem = new ManyToManyItem { Id = 5 };
            var manyToManyItem2 = new ManyToManyItem { Id = 8 };
            var manyToManyItem3 = new ManyToManyItem { Id = 13 };
            var manyToManyItemList = new List<ManyToManyItem> { manyToManyItem, manyToManyItem2, manyToManyItem3 };
            MockGridReader.Setup(gridReader => gridReader.Read<ManyToManyItem>()).Returns(manyToManyItemList);
            var parent = new ParentItem { Id = 1 };
            var parent2 = new ParentItem { Id = 2 };
            var linker = new ManyToManyLinker { ChildId = 5, ParentId = 1 };
            var linker2 = new ManyToManyLinker { ChildId = 13, ParentId = 1 };
            var linker3 = new ManyToManyLinker { ChildId = 8, ParentId = 2 };
            var linker4 = new ManyToManyLinker { ChildId = 13, ParentId = 2 };
            var linkerList = new List<ManyToManyLinker> { linker, linker2, linker3, linker4 };
            MockGridReader.Setup(gridReader => gridReader.Read<ManyToManyLinker>()).Returns(linkerList);
            var parentDictionary = new Dictionary<int, ParentItem> { [1] = parent, [2] = parent2 };

            //Act
            ManyToManyMapping.Map(MockGridReader.Object, parentDictionary, true);

            //Assert
            Assert.AreEqual(2, parentDictionary[1].ManyToManyChildren.Count);
            Assert.IsTrue(parentDictionary[1].ManyToManyChildren.Contains(manyToManyItem));
            Assert.IsTrue(parentDictionary[1].ManyToManyChildren.Contains(manyToManyItem3));

            Assert.AreEqual(2, parentDictionary[2].ManyToManyChildren.Count);
            Assert.IsTrue(parentDictionary[2].ManyToManyChildren.Contains(manyToManyItem2));
            Assert.IsTrue(parentDictionary[2].ManyToManyChildren.Contains(manyToManyItem3));
        }
        public void Map_HasResultsAndShouldContinueThroughEmptyTablesIsFalse_MapsChildren()
        {
            //Arrange
            var manyToManyItem = new ManyToManyItem();
            var manyToManyItemList = new List<ManyToManyItem> { manyToManyItem };
            MockGridReader.Setup(gridReader => gridReader.Read<ManyToManyItem>()).Returns(manyToManyItemList);
            var manyToManyLinker = new ManyToManyLinker();
            var manyToManyLinkerList = new List<ManyToManyLinker> { manyToManyLinker };
            MockGridReader.Setup(gridReader => gridReader.Read<ManyToManyLinker>()).Returns(manyToManyLinkerList);
            ManyToManyMapping.AddMapping(MockChildMapping.Object);
            IDictionary<int, ParentItem> parents = null;

            //Act
            ManyToManyMapping.Map(MockGridReader.Object, parents, false);

            //Assert
            MockChildMapping.Verify(childMapping => childMapping.Map(It.IsAny<IGridReader>(), It.IsAny<IDictionary<int, ManyToManyItem>>(), It.IsAny<bool>()), Times.Once);
        }