protected internal virtual IEnumerable <string> InvokeAndGetResult(IEnumerable <string> include)
        {
            var getFileSystemEntryPathMatchCommand = new GetFileSystemEntryPathMatchCommand
            {
                Include = include.ToArray()
            };

            this.InvokeCommand(getFileSystemEntryPathMatchCommand);

            // ReSharper disable PossibleNullReferenceException
            var output = (IEnumerable <object>)getFileSystemEntryPathMatchCommand.CommandRuntime.GetType().GetField("output", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(getFileSystemEntryPathMatchCommand.CommandRuntime);

            // ReSharper restore PossibleNullReferenceException

            return((IEnumerable <string>)output.First());
        }
        public void ProcessRecord_ShouldWriteTheResultFromTheFileSystemEntryMatcherToThePipeline()
        {
            IEnumerable <string> actualResult   = null;
            IEnumerable <string> expectedResult = new[] { "A", "B", "C" };
            var include = new[] { "First", "Second", "Third" };

            var commandRuntimeMock = new Mock <ICommandRuntime>();

            commandRuntimeMock.Setup(commandRuntime => commandRuntime.WriteObject(It.IsAny <object>())).Callback((object sendToPipeline) => { actualResult = (IEnumerable <string>)sendToPipeline; });

            var fileSystemEntryMatcherMock = new Mock <IFileSystemEntryMatcher>();

            fileSystemEntryMatcherMock.Setup(fileSystemEntryMatcher => fileSystemEntryMatcher.GetPathMatches(It.IsAny <string>(), It.IsAny <IEnumerable <string> >(), It.IsAny <string>())).Returns(() => expectedResult);

            var getFileSystemEntryPathMatchCommand = new GetFileSystemEntryPathMatchCommand(fileSystemEntryMatcherMock.Object)
            {
                CommandRuntime = commandRuntimeMock.Object,
                Include        = include
            };

            this.InvokeCommand(getFileSystemEntryPathMatchCommand);

            Assert.IsTrue(expectedResult.SequenceEqual(actualResult, StringComparer.Ordinal));
        }