Ejemplo n.º 1
0
        private void AssertWeGetTheRightLcs <T>(T[] collection1, T[] collection2, T[] expectedLcs)
        {
            var result = new CorrelaterResult <T>(0, collection1, collection2);
            var lcs    = result.GetLcsFromResult();

            CollectionAssert.AreEqual(expectedLcs, lcs.ToList());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// While there's no guarantee that the LCS are the same, they should at least be the same length
        /// </summary>
        private void AssertThatLcsIsTheSameLength(string correlater1Name, string correlater2Name, CorrelaterResult <char> result1, CorrelaterResult <char> result2, string collection1, string collection2)
        {
            var result1Lcs = result1.GetLcsFromResult();
            var result2Lcs = result2.GetLcsFromResult();

            var stringForBadResult = new StringBuilder();

            stringForBadResult.AppendLine($"Got diffrent LCS lengths:");
            stringForBadResult.AppendLine($"{correlater1Name} LCS: {string.Join(",", result1Lcs)}");
            stringForBadResult.AppendLine($"{correlater2Name} LCS: {string.Join(",", result2Lcs)}");
            stringForBadResult.AppendLine();
            stringForBadResult.AppendLine($"Collection1: {collection1}");
            stringForBadResult.AppendLine($"Collection2: {collection2}");

            Assert.AreEqual(result1Lcs.Count(), result2Lcs.Count(), stringForBadResult.ToString());
        }