Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }