コード例 #1
0
        public void EveryWrongCharTest()
        {
            var           addWinForm = new AddEmployeeWindow();
            List <string> cleanList  = new List <string>()
            {
                "12",
                "first",
                "last"
            };

            string dirtyId    = "12 ? /. < pass!";
            string dirtyFirst = "first ? ' , __ 56";
            string dirtyLast  = "last ? 3 #$%%^&*@!";

            List <string> sanitizedList = addWinForm.SanitizeEmployeeInputs(dirtyId, dirtyFirst, dirtyLast);

            Assert.AreEqual(cleanList, sanitizedList);
        }
コード例 #2
0
        public void WhiteSpaceTest()
        {
            var           addWinForm = new AddEmployeeWindow();
            List <string> cleanList  = new List <string>()
            {
                "12",
                "first",
                "last"
            };

            string dirtyId    = "1 2";
            string dirtyFirst = "fi r s t ";
            string dirtyLast  = "l as      t";

            List <string> sanitizedList = addWinForm.SanitizeEmployeeInputs(dirtyId, dirtyFirst, dirtyLast);

            Assert.AreEqual(cleanList, sanitizedList);
        }
コード例 #3
0
        public void EmptyStringsTest()
        {
            var           addWinForm = new AddEmployeeWindow();
            List <string> cleanList  = new List <string>()
            {
                "",
                "",
                ""
            };

            string dirtyId    = "";
            string dirtyFirst = "";
            string dirtyLast  = "";

            List <string> sanitizedList = addWinForm.SanitizeEmployeeInputs(dirtyId, dirtyFirst, dirtyLast);

            Assert.AreEqual(cleanList, sanitizedList);
        }
コード例 #4
0
        public void PunctuationTest()
        {
            var           addWinForm = new AddEmployeeWindow();
            List <string> cleanList  = new List <string>()
            {
                "12",
                "first",
                "last"
            };

            string dirtyId    = "12?";
            string dirtyFirst = "first//";
            string dirtyLast  = "..last...";

            List <string> sanitizedList = addWinForm.SanitizeEmployeeInputs(dirtyId, dirtyFirst, dirtyLast);

            Assert.AreEqual(cleanList, sanitizedList);
        }