public void TestMethodSaveFile() { var manifest = ManifestHelper.Load("Ressources\\Manifest.xml"); ManifestHelper.Save(manifest, "Manifest.xml"); Assert.IsTrue(File.Exists("Manifest.xml")); }
public void TestMethodSaveStream() { var manifest = ManifestHelper.Load("Ressources\\Manifest.xml"); using (var stream = new FileStream("Manifest.xml", FileMode.Create, FileAccess.Write)) { ManifestHelper.Save(manifest, stream); } Assert.IsTrue(File.Exists("Manifest.xml")); }
public IEnumerable <IPackage> GetPackages(bool onlyLatestVersion = true) { lock (thisLock) { var packageList = new List <IPackage>(); foreach (var packageDir in rootDirectory.GetDirectories()) { foreach (var versionDir in packageDir.GetDirectories()) { if (File.Exists(Path.Combine(versionDir.FullName, Constants.ManifestFileName))) { packageList.Add(ManifestHelper.Load(Path.Combine(versionDir.FullName, Constants.ManifestFileName))); } } } if (onlyLatestVersion) { return(packageList.Where(p => packageList.Where(p1 => p1.Name == p.Name).Select(p2 => new SemanticVersion(p2.Version)).Max().ToNormalizedString() == p.SemanticVersion().ToNormalizedString()).ToList()); } return(packageList); } }
public void TestMethodLoadFromPath() { var manifest = ManifestHelper.Load("Ressources\\Manifest.xml"); Assert.IsNotNull(manifest); }