/// <summary> /// Pulls all dependencies from the specified module list, gathers the state of them, and /// compares it to the state expressed in the provided file from a previous run /// </summary> /// <param name="ModuleList"></param> /// <param name="DependencyFile"></param> /// <returns></returns> private static bool AreDependenciesUpToDate(IEnumerable <string> ModuleList, string DependencyFile) { bool UpToDate = false; if (File.Exists(DependencyFile)) { Log.TraceVerbose("Read dependency file at {0}", DependencyFile); HashCollection OldHashes = HashCollection.CreateFromFile(DependencyFile); if (OldHashes != null) { HashCollection CurrentHashes = HashModules(ModuleList, false); if (OldHashes.Equals(CurrentHashes)) { UpToDate = true; } else { if (Log.OutputLevel >= LogEventType.VeryVerbose) { CurrentHashes.LogDifferences(OldHashes); } } } else { Log.TraceInformation("Failed to read dependency info!"); } } else { Log.TraceVerbose("No dependency file exists at {0}. Will do full build.", DependencyFile); } return(UpToDate); }
public void TestEquality() { HashCollection <int> a = new HashCollection <int> { 1, 2 }; HashCollection <int> b = new HashCollection <int> { 2, 3 }; HashCollection <int> c = new HashCollection <int> { 1, 2 }; Assert.IsFalse(a == b); Assert.IsTrue(a == c); Assert.IsFalse(null == a); Assert.IsFalse(a == null); Assert.IsTrue(a != b); Assert.IsFalse(a != c); Assert.IsTrue(null != a); Assert.IsTrue(a != null); Assert.AreNotEqual(a, b); Assert.AreEqual(a, c); Assert.AreEqual(a.GetHashCode(), c.GetHashCode()); Assert.IsFalse(a.Equals(b)); Assert.IsTrue(a.Equals(c)); Assert.IsFalse(a.Equals(null)); Assert.IsFalse(a.Equals((ISet)b)); Assert.IsTrue(a.Equals((ISet)c)); Assert.IsFalse(a.Equals((ISet) new HashCollection <int> { 1 })); Assert.IsFalse(a.Equals((ISet)null)); Assert.IsFalse(a.Equals((IEnumerable)b)); Assert.IsTrue(a.Equals((IEnumerable)c)); Assert.IsFalse(a.Equals((IEnumerable)null)); Assert.IsFalse(a.Equals(new[] { 2, 3 })); Assert.IsTrue(a.Equals(new[] { 1, 2 })); Assert.IsFalse(a.Equals((IEnumerable <int>)null)); }