public void CreateLargePackage() { using (var package = new SimplePackage()) { DirectoryInfo repository = new DirectoryInfo(LocalRepository.CalculateRepositoryPath(Log.SessionSummary.Product)); FileInfo[] allExistingFileFragments = repository.GetFiles("*." + Log.LogExtension, SearchOption.TopDirectoryOnly); foreach (var fileFragment in allExistingFileFragments) { var sourceFile = FileHelper.OpenFileStream(fileFragment.FullName, FileMode.Open, FileAccess.ReadWrite, FileShare.Read); if (sourceFile != null) { package.AddSession(sourceFile); } } using (ProgressMonitorStack stack = new ProgressMonitorStack("saving Package")) { package.Save(stack, m_OutputFileNamePath); } } Assert.IsTrue(File.Exists(m_OutputFileNamePath), "Packge was not created"); Assert.Greater(new FileInfo(m_OutputFileNamePath).Length, 100, "The package was likely empty but should have contained multiple sessions."); File.Delete(m_OutputFileNamePath); }
public FileTransportPackage(string product, string application, SimplePackage package, string fileNamePath) : base(product, application, package) { if (string.IsNullOrEmpty(fileNamePath)) { throw new ArgumentNullException(nameof(fileNamePath)); } FileNamePath = fileNamePath; }
public void CreateEmptyPackage() { using (var package = new SimplePackage()) { using (ProgressMonitorStack stack = new ProgressMonitorStack("saving Package")) { package.Save(stack, m_OutputFileNamePath); } } Assert.IsTrue(File.Exists(m_OutputFileNamePath), "Package was not created"); File.Delete(m_OutputFileNamePath); }
protected TransportPackageBase(string product, string application, SimplePackage package) { if (package == null) { throw new ArgumentNullException(nameof(package)); } if (string.IsNullOrEmpty(product)) { throw new ArgumentNullException(nameof(product)); } //application IS allowed to be null. Package = package; Product = product; Application = application; }