public void EqualsTest() { PathSpec left = new DepotPath("//depot/main/test.txt"); PathSpec rightpos = new DepotPath("//depot/main/test.txt"); PathSpec rightneg1 = new DepotPath("//depot/main/empty.bmp"); PathSpec rightneg2 = new ClientPath("//depot/main/test/txt"); PathSpec rightnull = null; Assert.IsTrue(left.Equals(rightpos)); Assert.IsFalse(left.Equals(rightneg1)); Assert.IsFalse(left.Equals(rightneg2)); Assert.IsFalse(left.Equals(rightnull)); left = new ClientPath("//user_workspace/main/test.txt"); rightpos = new ClientPath("//user_workspace/main/test.txt"); rightneg1 = new ClientPath("//user_workspace/main/empty.bmp"); rightneg2 = new DepotPath("//user_workspace/main/test.txt"); rightnull = null; Assert.IsTrue(left.Equals(rightpos)); Assert.IsFalse(left.Equals(rightneg1)); Assert.IsFalse(left.Equals(rightneg2)); Assert.IsFalse(left.Equals(rightnull)); left = new LocalPath(@"C:\workspace_root\test.txt"); rightpos = new LocalPath(@"C:\workspace_root\test.txt"); rightneg1 = new LocalPath(@"C:\workspace_root\empty.bmp"); rightneg2 = new DepotPath(@"C:\workspace_root\test.txt"); rightnull = null; Assert.IsTrue(left.Equals(rightpos)); Assert.IsFalse(left.Equals(rightneg1)); Assert.IsFalse(left.Equals(rightneg2)); Assert.IsFalse(left.Equals(rightnull)); }
/// <summary> /// This function assumes that the files list is initialized. It also performs no cleanup /// of duplicates in case of incorrect of consequtive use. /// </summary> private void AddRealFiles() { if (LocalPath == null || LocalPath.Equals(EmptyLocalPath)) { return; } string[] filePaths = Directory.GetFiles(LocalPath); if (filePaths == null || filePaths.Length == 0) { return; } if (Files == null) { files = new List <FileContents>(); } foreach (string path in filePaths) { FileContents fc = new FileContents(path); Files.Add(fc); } }
public bool Equals(IPackageMetadata other) { return(Id.Equals(other.Id) && Version.Equals(other.Version) && LocalPath.Equals(other.LocalPath) && AreTargetFrameworksEqual(TargetFrameworks, other.TargetFrameworks) && AreAssembliesEqual(Assemblies, other.Assemblies)); }
public DirContents(DirModel d, bool addRealFiles = false, bool addRemoteFiles = true) : this(d.Name, d.Description, d.Path, null, addRealFiles) { if ((addRealFiles && LocalPath != null && !LocalPath.Equals(EmptyLocalPath)) || (addRemoteFiles && d.Files != null && d.Files.Count > 0)) { this.files = new List <FileContents>(); } if (addRemoteFiles) { AddRemoteFiles(d.Files); } if (addRealFiles) { AddRealFiles(); } if (addRemoteFiles && addRealFiles) { RemoveDuplicateFiles(); } }