Пример #1
0
        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);
        }
Пример #2
0
        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());
        }
Пример #3
0
        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());
        }
Пример #4
0
        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);
        }