public void ReturnEmptyListWhenDesiredResultAmountArgumentNegative() { var generator = new GuidGeneratorTest(new List <Guid>()); var taskSolver = new GuidsWithZeroDigitsFinder(generator, 1, -1); var result = (FindZeroDigitsResult)taskSolver.Calculate(new CancellationToken()); Assert.AreEqual(0, result.Result.Count); }
public void ReturnEmptyResultWhenGuidCountArgumentNegative() { var generator = new GuidGeneratorTest(new List <Guid>()); var taskSolver = new MaxCommonCharactersSequenceFinder(generator, -1); var result = (FindMaxCommonSequenceResult)taskSolver.Calculate(new CancellationToken()); Assert.AreEqual(0, result.CommonSequences.Count); }
public void ReturnEmptyResultWhenLessThanThreeGuid() { var generator = new GuidGeneratorTest(new List <Guid> { new Guid("01010101-0100-1234-0000-010101010101"), new Guid("02020202-0200-0000-1234-020202020202") }); var taskSolver = new MaxCommonCharactersSequenceFinder(generator, 2); var result = (FindMaxCommonSequenceResult)taskSolver.Calculate(new CancellationToken()); Assert.AreEqual(0, result.CommonSequences.Count); }
public void ReturnGuidWithDashBetweenZeros() { var guid1 = new Guid("11111111-1111-1111-1110-011111111111"); var generator = new GuidGeneratorTest(new List <Guid> { guid1 }); var taskSolver = new GuidsWithZeroDigitsFinder(generator, 2, 1); var result = (FindZeroDigitsResult)taskSolver.Calculate(new CancellationToken()); Assert.AreEqual(1, result.Result.Count); Assert.AreEqual(guid1, result.Result.First()); }
public void ReturnEmptyResultWhenNoCommonSubstring() { var generator = new GuidGeneratorTest(new List <Guid> { new Guid("00000000-0000-0000-0000-000000000000"), new Guid("11111111-1111-1111-1111-111111111111"), new Guid("22222222-2222-2222-2222-222222222222") }); var taskSolver = new MaxCommonCharactersSequenceFinder(generator, 2); var result = (FindMaxCommonSequenceResult)taskSolver.Calculate(new CancellationToken()); Assert.AreEqual(0, result.CommonSequences.Count); }
public void ReturnCommonSequencesExclusiveDashs() { var generator = new GuidGeneratorTest(new List <Guid> { new Guid("11111111-3333-3311-4444-111111111111"), new Guid("22222222-4444-2222-3333-332222222222"), new Guid("22222222-4444-2222-3333-332222222222") }); var taskSolver = new MaxCommonCharactersSequenceFinder(generator, 2); var result = (FindMaxCommonSequenceResult)taskSolver.Calculate(new CancellationToken()); Assert.AreEqual(1, result.CommonSequences.Count); Assert.AreEqual("333333", result.CommonSequences.First()); }
public void ReturnFirstCorrectGuid() { var guid1 = new Guid("11111111-1111-1111-1111-111111111111"); var guid2 = new Guid("11111111-1111-1111-1111-111111111101"); var guid3 = new Guid("11111111-1111-1111-1111-111111111110"); var generator = new GuidGeneratorTest(new List <Guid> { guid1, guid2, guid3 }); var taskSolver = new GuidsWithZeroDigitsFinder(generator, 1, 1); var result = (FindZeroDigitsResult)taskSolver.Calculate(new CancellationToken()); Assert.AreEqual(1, result.Result.Count); Assert.AreEqual(guid2, result.Result.First()); }
public void ReturnSeveralCommonSequences() { var generator = new GuidGeneratorTest(new List <Guid> { new Guid("11111111-3333-1111-4444-111111111111"), new Guid("22222222-4444-2222-3333-222222222222"), new Guid("22222222-4444-2222-0000-333322222222") }); var taskSolver = new MaxCommonCharactersSequenceFinder(generator, 2); var result = (FindMaxCommonSequenceResult)taskSolver.Calculate(new CancellationToken()); Assert.AreEqual(2, result.CommonSequences.Count); CollectionAssert.AreEquivalent(new List <string> { "3333", "4444" }, result.CommonSequences); }
public void ReturnSeveralCorrectGuids() { var guid1 = new Guid("11111111-1111-1111-1111-111111111111"); var guid2 = new Guid("11111111-1111-1111-1111-111111111100"); var guid3 = new Guid("11111111-1111-1111-1111-111111111110"); var guid4 = new Guid("11111111-1111-1001-1111-111111111111"); var generator = new GuidGeneratorTest(new List <Guid> { guid1, guid2, guid3, guid4 }); var taskSolver = new GuidsWithZeroDigitsFinder(generator, 2, 2); var result = (FindZeroDigitsResult)taskSolver.Calculate(new CancellationToken()); Assert.AreEqual(2, result.Result.Count); CollectionAssert.AreEquivalent(new List <Guid> { guid2, guid4 }, result.Result); }
public void ReturnMaxCommonSequence() { var generator = new GuidGeneratorTest(new List <Guid> { new Guid("11111111-3333-3311-4444-111111111111"), new Guid("22222222-4444-2222-3333-332222222222"), new Guid("22222222-4444-2222-3333-332222222222"), new Guid("66666666-6666-6666-6666-666666666666"), new Guid("01010101-0010-0010-0010-000077777777"), new Guid("77777777-0200-0020-0002-020202020202"), new Guid("00000000-0000-0000-0000-777777770000") }); var taskSolver = new MaxCommonCharactersSequenceFinder(generator, 2); var result = (FindMaxCommonSequenceResult)taskSolver.Calculate(new CancellationToken()); Assert.AreEqual(1, result.CommonSequences.Count); Assert.AreEqual("77777777", result.CommonSequences.First()); }