public void MakeForReading_from_archive_file()
        {
            var mockFileSystem = MockRepository.GenerateMock <IFileSystem>();

            mockFileSystem.Expect(x => x.FileExists(@"C:\directory\name.zip")).Return(true);
            var factory   = new ReportContainerFactory(mockFileSystem, @"C:\directory", "name");
            var container = factory.MakeForReading();

            Assert.IsInstanceOfType <ArchiveReportContainer>(container);
            mockFileSystem.VerifyAllExpectations();
        }
Exemple #2
0
        /// <summary>
        /// Loads the specified report.
        /// </summary>
        /// <param name="inputPath"></param>
        /// <param name="inputName"></param>
        /// <param name="report"></param>
        /// <returns></returns>
        protected bool LoadReport(string inputPath, string inputName, out Report report)
        {
            report = CaptureFileException(() => "The specified report is not a valid file path.", () =>
            {
                var factory = new ReportContainerFactory(new FileSystem(), inputPath, inputName);

                using (IReportContainer inputContainer = factory.MakeForReading())
                {
                    IReportReader reportReader = reportManager.CreateReportReader(inputContainer);
                    return(Context.ProgressMonitorProvider.Run(pm => reportReader.LoadReport(true, pm)));
                }
            });

            return(report != null);
        }