public void SameString_CallInnderCorrelaterWithEmptyCollection() { var s = "abcdefg"; A.CallTo(() => innerCorrelater.Correlate(A <IEnumerable <char> > ._, A <IEnumerable <char> > ._, A <CancellationToken> ._)). Invokes((IEnumerable <char> collection1, IEnumerable <char> collection2, CancellationToken ct) => { Assert.IsTrue(!collection1.Any(), $"{nameof(collection1)} was not empty"); Assert.IsTrue(!collection2.Any(), $"{nameof(collection2)} was not empty"); }); correlater.Correlate(s, s); }
[DataRow("1234", "5678", 0)] // Diff eveywhere public void IContinuousCorrelaterTest_InnerCorrelaterIsContinuous(string string1, string string2, int extraTimesToCallOrResultUpdate) { var levenshteinCorrelater = new LevenshteinCorrelater <char>(missmatchCost, removalInsertionCost, removalInsertionCost); var splitToChunksCorrelater = new SplitToChunksCorrelaterWrapper <char>(levenshteinCorrelater, 2); var correlater = new IgnoreIdenticalBeginningAndEndCorrelaterWrapper <char>(splitToChunksCorrelater); var match1 = new List <char>(); var match2 = new List <char>(); var totalDistance = 0L; var totalUpdates = 0; var innerUpdates = 0; correlater.OnResultUpdate += result => { match1.AddRange(result.BestMatch1); match2.AddRange(result.BestMatch2); totalDistance += result.Distance; totalUpdates++; }; splitToChunksCorrelater.OnResultUpdate += _ => innerUpdates++; var actualResult = correlater.Correlate(string1, string2); var resultFromEvent = new CorrelaterResult <char>(totalDistance, match1.ToArray(), match2.ToArray()); Assertions.AssertResultIsAsExpected(actualResult, resultFromEvent); Assert.AreEqual(extraTimesToCallOrResultUpdate + innerUpdates, totalUpdates, $"Got wrong number of {nameof(totalUpdates)}"); }