public void OneRandom_NoWildcardInPattern_ThrowsException()
        {
            var          ex  = Assert.Throws(typeof(NinException), () => BirthNumber.OneRandom("01234567890"));
            NinException nex = ex as NinException;

            Assert.IsNotNull(nex);
            Assert.AreEqual(Statuscode.BadPattern, nex.Code);
        }
        public void OneRandom_BadFromDate_ThrowsException()
        {
            var          ex  = Assert.Throws(typeof(NinException), () => BirthNumber.OneRandom(DateBasedIdNumber.FirstPossible.AddDays(-1), DateBasedIdNumber.LastPossible));
            NinException nex = ex as NinException;

            Assert.IsNotNull(nex);
            Assert.AreEqual(Statuscode.BadDate, nex.Code);
        }
        public void OneRandom_EmptyPattern_ThrowsException()
        {
            var          ex  = Assert.Throws(typeof(NinException), () => BirthNumber.OneRandom(string.Empty));
            NinException nex = ex as NinException;

            Assert.IsNotNull(nex);
            Assert.AreEqual(Statuscode.PatternIsNullOrEmpty, nex.Code);
        }
        public void OneRandom_InvalidCharacterInPattern_ThrowsException(string pattern)
        {
            var          ex  = Assert.Throws(typeof(NinException), () => BirthNumber.OneRandom(pattern));
            NinException nex = ex as NinException;

            Assert.IsNotNull(nex);
            Assert.AreEqual(Statuscode.BadPattern, nex.Code);
        }
        public void Construct_BadYearAndIndividualNumberCombination_ThrowsException(string number)
        {
            var          ex  = Assert.Throws(typeof(NinException), () => new BirthNumber(number));
            NinException nex = ex as NinException;

            Assert.IsNotNull(nex);
            Assert.AreEqual(Statuscode.BadYearAndIndividualNumberCombination, nex.Code);
        }
        public void Construct_BadSecondCheckDigit_ThrowsException(string number)
        {
            var          ex  = Assert.Throws(typeof(NinException), () => new BirthNumber(number));
            NinException nex = ex as NinException;

            Assert.IsNotNull(nex);
            Assert.AreEqual(Statuscode.BadCheckDigit, nex.Code);
        }
Exemple #7
0
        public void Construct_Empty_ThrowsException()
        {
            var          ex  = Assert.Throws(typeof(NinException), () => new DNumber(NumberEmpty));
            NinException nex = ex as NinException;

            Assert.IsNotNull(nex);
            Assert.AreEqual(Statuscode.IsNullOrEmpty, nex.Code);
        }
Exemple #8
0
        public void Construct_TooLong_ThrowsException()
        {
            var          ex  = Assert.Throws(typeof(NinException), () => new DNumber(NumberLong));
            NinException nex = ex as NinException;

            Assert.IsNotNull(nex);
            Assert.AreEqual(Statuscode.BadLength, nex.Code);
        }
Exemple #9
0
        public void OneRandom_BadLengthPattern_ThrowsException(string pattern)
        {
            var          ex  = Assert.Throws(typeof(NinException), () => DNumber.OneRandom(pattern));
            NinException nex = ex as NinException;

            Assert.IsNotNull(nex);
            Assert.AreEqual(Statuscode.BadPatternLength, nex.Code);
        }
Exemple #10
0
        public void Construct_BadDate_ThrowsException(string number)
        {
            var          ex  = Assert.Throws(typeof(NinException), () => new DNumber(number));
            NinException nex = ex as NinException;

            Assert.IsNotNull(nex);
            Assert.AreEqual(Statuscode.BadDate, nex.Code);
        }
Exemple #11
0
        public void Construct_NonDigits_ThrowsException(string number)
        {
            var          ex  = Assert.Throws(typeof(NinException), () => new OrganizationNumber(number));
            NinException nex = ex as NinException;

            Assert.IsNotNull(nex);
            Assert.AreEqual(Statuscode.BadCharacters, nex.Code);
        }
Exemple #12
0
        public void OneRandom_NoWildcardInPattern_ThrowsException()
        {
            var          ex  = Assert.Throws(typeof(NinException), () => OrganizationNumber.OneRandom("987654321"));
            NinException nex = ex as NinException;

            Assert.IsNotNull(nex);
            Assert.AreEqual(Statuscode.BadPattern, nex.Code);
        }
Exemple #13
0
        public void OneRandom_NullPattern_ThrowsException()
        {
            var          ex  = Assert.Throws(typeof(NinException), () => OrganizationNumber.OneRandom(null));
            NinException nex = ex as NinException;

            Assert.IsNotNull(nex);
            Assert.AreEqual(Statuscode.PatternIsNullOrEmpty, nex.Code);
        }