public void CreateOutputTemplateFactory_WhenThereAreMultipleFileInDirectory_ShouldReturnMultipleTestRunOutputTemplateFactory()
        {
            // Arrange
            var path = XmlPathUtility.GetTestXmlFolderPath();

            _fileSystemManager = new DefaultFileSystemManager();
            OutputTemplateManager outputTemplateManager = CreateOutputTemplateManager(path);

            // Act
            IOutputTemplateFactory factory = outputTemplateManager.CreateOutputTemplateFactory();

            // Assert
            Assert.AreEqual(typeof(MultipleTestRunOutputTemplateFactory), factory.GetType());
        }
        public void CreateOutputTemplateFactory_WhenThereIsOneFileInPath_ShouldReturnMultipleTestRunOutputTemplateFactory()
        {
            // Arrange
            string xmlPath = "/test/test.xml";

            _fileSystemManager.EnumerateFiles(xmlPath).Returns(new List <string> {
                xmlPath
            });
            _testRunResultParser.ParseXml(xmlPath).Returns(new TestRun());
            OutputTemplateManager outputTemplateManager = CreateOutputTemplateManager(xmlPath);

            // Act
            var outputTemplateFactory = outputTemplateManager.CreateOutputTemplateFactory();

            // Assert
            Assert.AreEqual(outputTemplateFactory.GetType(), typeof(TestRunOutputTemplateFactory));
        }
        // ReSharper disable once UnusedMember.Local
        private int OnExecute()
        {
            ITestResultsOutputWriterFactory outputWriterFactory = new DefaultTestResultsOutputWriterFactory();

            using (ITestResultsOutputWriter outputWriter = outputWriterFactory.Create(Output))
            {
                OutputTemplateManager  outputTemplateManager = new OutputTemplateManager(Path, new TestRunResultParser(Format), new DefaultFileSystemManager());
                IOutputTemplateFactory outputTemplateFactory = outputTemplateManager.CreateOutputTemplateFactory();
                IOutputTemplate        outputTemplate        = OutputTemplateManager.CreateOutputTemplate(outputTemplateFactory, Template);
                outputTemplate.Write(outputWriter);

                if (FailWhenResultIsFailed && !outputTemplateFactory.IsSuccess)
                {
                    return(-1);
                }
            }

            return(0);
        }