/// <summary>
        /// Given a group name, set up a mock group that will be retrieved by the GridTerminalSystem.
        /// Store the given mocked blocks for later retrieval.
        ///
        /// Also, set up the group's GetBlocksOfType method to use a Moq Callback so that
        /// those mocked blocks can be found later.
        /// </summary>
        /// <typeparam name="T">The type of the blocks being mocked for this group.</typeparam>
        /// <param name="groupName">The name of the group being mocked.</param>
        /// <param name="blockMocks">The blocks being mocked and that will be returned later.</param>
        public void MockBlocksInGroup <T>(String groupName, params Mock <T>[] blockMocks) where T : class, IMyTerminalBlock
        {
            for (int i = 0; i < blockMocks.Length; i++)
            {
                blockMocks[i].Setup(x => x.EntityId).Returns(entityIdCounter++);
                blockMocks[i].Setup(x => x.CustomName).Returns(groupName + " " + i);
            }

            var mockGroup = new MockBlockGroup(groupName);

            mockGroup.AddBlocks(blockMocks
                                .Select(block => (IMyTerminalBlock)block.Object)
                                .ToList());

            mockGrid.AddGroup(mockGroup);
        }
 public void AddGroup(MockBlockGroup blockGroup)
 {
     mockGroups.Add(blockGroup);
     mockBlocks.UnionWith(blockGroup.GetBlocks());
 }