public void Constructor() { PackageManifestFile test = new PackageManifestFile(); test.Checksum = "checksum"; test.Source = "source"; Assert.Equal(test.Checksum, "checksum"); Assert.Equal(test.Source, "source"); }
public void RemoveFileNoFiles() { PackageManifestFile file = new PackageManifestFile() { Source = "source", Checksum = "checksum", }; Builder.RemoveFile(file); Assert.Null(Builder.Manifest.Files); }
public void AddFile() { PackageManifestFile file = new PackageManifestFile() { Source = "source", Checksum = "checksum", }; Builder.AddFile(file); Assert.Equal(1, Builder.Manifest.Files.Count); Assert.Equal("source", Builder.Manifest.Files[0].Source); }
/// <summary> /// Adds the specified file from the specified directory to the specified builder, using the includeResources and /// hashFiles parameters to determine whether the file should be added and hashed. /// </summary> /// <param name="builder">The manifest builder with which to add the file.</param> /// <param name="file">The file to add.</param> /// <param name="directory">The directory containing the file.</param> /// <param name="hashFiles">A value indicating whether files added to the manifest are to include a SHA512 hash.</param> private void AddFile(PackageManifestBuilder builder, string file, string directory, bool hashFiles) { Verbose($"Adding file '{file}'..."); PackageManifestFile newFile = new PackageManifestFile(); newFile.Source = Common.Utility.GetRelativePath(directory, file); if (hashFiles) { newFile.Checksum = string.Empty; } builder.AddFile(newFile); }
public void AddFileExistingType() { PackageManifestFile file = new PackageManifestFile() { Source = "source", Checksum = "checksum", }; PackageManifestFile file2 = new PackageManifestFile() { Source = "source2", Checksum = "checksum", }; Builder.AddFile(file); Builder.AddFile(file2); Assert.Equal(2, Builder.Manifest.Files.Count); Assert.Equal("source", Builder.Manifest.Files[0].Source); Assert.Equal("source2", Builder.Manifest.Files[1].Source); }
public void RemoveFileNotAdded() { PackageManifestFile file = new PackageManifestFile() { Source = "source", Checksum = "checksum", }; PackageManifestFile file2 = new PackageManifestFile() { Source = "source2", Checksum = "checksum2", }; Builder.AddFile(file); Assert.Equal(1, Builder.Manifest.Files.Count); Assert.Equal("source", Builder.Manifest.Files[0].Source); Builder.RemoveFile(file2); Assert.Equal(1, Builder.Manifest.Files.Count); }