public override void Process(ISolutionResourceContext data, ITestOutputContext output) { var files = new List <string>(); var identical = CollectionHelper.AreIdenticalByPairs( data.Values.ToArray(), (instanceA, instanceB) => // compare IncludeFiles of all instances to ensure they are identical CollectionHelper.AreIdentical( instanceA.SitecoreInfo.IncludeFiles, instanceB.SitecoreInfo.IncludeFiles, (nameA, nameB) => string.Equals(nameA, nameB, StringComparison.OrdinalIgnoreCase), (fileA, fileB) => { if (fileA == null) { Assert.IsNotNull(fileB); files.Add(fileB.FilePath.Substring(fileB.FilePath.IndexOf("App_Config"))); return(false); } if (fileB == null) { Assert.IsNotNull(fileA); files.Add(fileA.FilePath.Substring(fileA.FilePath.IndexOf("App_Config"))); return(false); } if (!string.Equals(fileA.RawText, fileB.RawText, StringComparison.Ordinal)) { files.Add(fileA.FilePath.Substring(fileA.FilePath.IndexOf("App_Config"))); return(false); } return(true); })); if (!identical) { output.Warning(ShortMessage, detailed: new DetailedMessage(new BulletedList(files))); } }
public void AreIdenticalByPairsTest(bool expected, string[] collection) { Assert.Equal(expected, CollectionHelper.AreIdenticalByPairs(collection, (a, b) => string.Equals(a, b, StringComparison.Ordinal))); Assert.Equal(expected, CollectionHelper.AreIdenticalByPairs(collection, (a, b) => string.Equals(a, b, StringComparison.Ordinal))); }