/// <summary> /// Checks if elements under the given paths have matching debug signatures. /// </summary> /// <param name="paths">Paths to check.</param> /// <param name="reader">Debug signature reader to use.</param> /// <returns>True if are matching, false otherwise.</returns> public static bool AreMatching(IEnumerable <string> items, IDebugSignaturesReader reader) { var comparer = new DebugSignaturesComparer(reader); comparer.AddItems(items); return(comparer.ReadingsBySignature.Keys.Count == 1); }
public void Setup() { Dictionary <string, List <DebugSignatureReading> > mockedReadings = null; mockedReadings = new Dictionary <string, List <DebugSignatureReading> > { [aDllPath] = new List <DebugSignatureReading> { new DebugSignatureReading(aDllPath, "AAAA") }, [aPdbPath] = new List <DebugSignatureReading> { new DebugSignatureReading(aPdbPath, "AAAA") }, [aDirectoryPath] = new List <DebugSignatureReading> { new DebugSignatureReading(aDllPath, "AAAA"), new DebugSignatureReading(aPdbPath, "AAAA") }, [bDllPath] = new List <DebugSignatureReading> { new DebugSignatureReading(bDllPath, "BBBB") }, [cPdbPath] = new List <DebugSignatureReading> { new DebugSignatureReading(cPdbPath, "CCCC") }, [randomDirectoryPath] = new List <DebugSignatureReading> { new DebugSignatureReading(bDllPath, "BBBB"), new DebugSignatureReading(cPdbPath, "CCCC") }, [invalidPath] = new List <DebugSignatureReading> { { new DebugSignatureReading(invalidPath, null, "The path is invalid.") } } }; var readerMock = new Mock <IDebugSignaturesReader>(); readerMock.Setup(r => r.Read(It.IsAny <string>())).Returns <string>(path => mockedReadings[path]); this.mockedReader = readerMock.Object; }
/// <summary> /// Initializes a new instance of <see cref="DebugSignaturesComparer"/>. /// </summary> /// <param name="reader">Debug signatures reader.</param> public DebugSignaturesComparer(IDebugSignaturesReader reader) { this.Readings = new List <DebugSignatureReading>(); this.reader = reader; }