Пример #1
0
        public void SexTest()
        {
            PESELWalidator pw = new PESELWalidator("91042215012");

            Assert.AreEqual("Man", pw.Sex());
            pw.LoadPesel("91042215023");
            Assert.AreEqual("Woman", pw.Sex());
        }
Пример #2
0
        public void DateOfBirthTest()
        {
            PESELWalidator pw = new PESELWalidator("91042215012");

            Assert.AreEqual("22.04.1991", pw.DateOfBirth());
            pw.LoadPesel("19821115422");
            Assert.AreEqual("11.02.1819", pw.DateOfBirth());
        }
Пример #3
0
        public void CheckPesel()
        {
            PESELWalidator pw = new PESELWalidator("91042215012");

            Assert.IsTrue(pw.CheckPesel());
            pw.LoadPesel("91043215012");
            Assert.IsFalse(pw.CheckPesel());
            pw.LoadPesel("910432");
            Assert.IsFalse(pw.CheckPesel());
        }
Пример #4
0
        public void ControlSumTest()
        {
            PESELWalidator pw = new PESELWalidator("91042215012");

            Assert.AreEqual(3, pw.ControlSum());
            Assert.IsTrue(pw.ControlSum() >= 0 && pw.ControlSum() < 10);

            pw.LoadPesel("9104221534");
            Assert.AreNotEqual(4, pw.ControlSum());
            Assert.IsTrue(pw.ControlSum() >= 0 && pw.ControlSum() < 10);
        }
Пример #5
0
        public void LoadPeselTest()
        {
            PESELWalidator pw = new PESELWalidator("91042215012");

            Assert.IsNotNull(pw);
            try
            {
                pw.LoadPesel("910422a5012");
                Assert.Fail();
            }
            catch (Exception e)
            {
                throw e;
            }
        }