public int CompareTo(InstalledFileInfo info, bool ignoreDate, bool ignoreFlags) { int result = string.Compare(this.FileName, info.FileName, true); if (result != 0) { return(result); } result = string.Compare(this.Path, info.Path, true); if (result != 0) { return(result); } if (!ignoreDate) { result = this.FileDate.CompareTo(info.FileDate); if (result != 0) { return(result); } } if (!ignoreFlags) { result = this.Flags.CompareTo(info.Flags); if (result != 0) { return(result); } } return(0); }
public override void OnInstallFile(ref FileInstallInfo fileInfo, out bool skipped) { // check to see that the file is in the expected list InstalledFileInfo info = new InstalledFileInfo(fileInfo); bool found = false; foreach (InstalledFileInfo searchFor in m_testData.InstalledFiles) { // TODO: for now ignore date and flags, but these need to be validated in a future test if (info.CompareTo(searchFor, true, true) == 0) { found = true; // mark it as installed - we'll look at these later in the test to make sure everything was installed searchFor.Installed = true; break; } } if (!found) { Assert.Fail(string.Format("File '{0}' or one of its properties was unexpected", fileInfo.FileName)); } // lie about us skipping the file so the underlying installer doesn't know skipped = false; // don't call the base - we're just testing }