Exemplo n.º 1
0
        public void Create_ShouldCreateNextNewRegistrationNumber_When_Next_Is_Available_And_Are_Gapps_In_Numbers()
        {
            const int nextAvailableNumber        = 99999;
            string    expectedRegistrationNumber = $"1-0{nextAvailableNumber}";
            var       unavailableNumbers         = RegistrationNumbersGenerator.Generate(limit: nextAvailableNumber);

            var sut = RegistrationNumber.Create(unavailableNumbers);

            Assert.AreEqual(expectedRegistrationNumber, sut.FirstPart + sut.SecondPart);
        }
Exemplo n.º 2
0
        public void Create_ShouldCreateFirstMissingAvailableRegistrationNumber_When_Are_Gapps_In_Numbers_And_RegistrationNumbers_Reached_Max()
        {
            int firstAvailableNumber = 423;

            int[]  missingRegistrationNumbers = new int[] { firstAvailableNumber, 23441 };
            string expectedRegistrationNumber = $"1-000{firstAvailableNumber}";
            var    unavailableNumbers         = RegistrationNumbersGenerator.Generate(numbersToSkip: missingRegistrationNumbers);

            var sut = RegistrationNumber.Create(unavailableNumbers);

            Assert.AreEqual(expectedRegistrationNumber, sut.FirstPart + sut.SecondPart);
        }
Exemplo n.º 3
0
        public void Create_ShouldThrowRegistrationNumbersReachedMaxException_When_RegistrationNumber_Reached_Max()
        {
            var unavailableNumbers = RegistrationNumbersGenerator.Generate();

            Assert.Throws <RegistrationNumbersReachedMaxException>(() => RegistrationNumber.Create(unavailableNumbers));
        }