Exemple #1
0
        public void ShouldNotEditIfPhoneNumberIsIncorrect()
        {
            string old_fName   = "Jon";
            string old_lName   = "Doe";
            string old_email   = "*****@*****.**";
            string old_city    = "Odense";
            string old_address = "City Center, 10";
            string old_zipcode = "5200";
            string old_phoneNr = "31525485";


            ValidateCustomer vc = new ValidateCustomer();

            ICustomer customer = vc.CreateCustomer(old_fName, old_lName, old_email, old_city, old_address, old_zipcode, old_phoneNr, old_phoneNr);


            string new_fName   = "Ben";
            string new_lName   = "Ten";
            string new_email   = "*****@*****.**";
            string new_city    = "Aarhus";
            string new_address = "City Center, 12";
            string new_zipcode = "8765";
            string new_phoneNr = "1213I415";

            vc.Edit(new_fName, new_lName, new_email, new_city, new_address, new_zipcode, new_phoneNr, new_phoneNr, customer.Email);
        }
Exemple #2
0
        public void ShouldStandardizeEveryInput()
        {
            string old_fName   = "Jon";
            string old_lName   = "Doe";
            string old_email   = "*****@*****.**";
            string old_city    = "Odense";
            string old_address = "City Center, 10";
            string old_zipcode = "5200";
            string old_phoneNr = "12 13 14 15";


            ValidateCustomer vc = new ValidateCustomer();

            ICustomer customer = vc.CreateCustomer(old_fName, old_lName, old_email, old_city, old_address, old_zipcode, old_phoneNr, old_phoneNr);


            string new_fName   = "bEn";
            string new_lName   = "teN";
            string new_email   = "*****@*****.**";
            string new_city    = "aarHUs";
            string new_address = "city center, 12";
            string new_zipcode = "8765asd";
            string new_phoneNr = "16 17 18 19";

            vc.Edit(new_fName, new_lName, new_email, new_city, new_address, new_zipcode, old_phoneNr, new_phoneNr, customer.Email);

            Assert.AreEqual(customer.FirstName, "Ben");
            Assert.AreEqual(customer.LastName, "Ten");
            Assert.AreEqual(customer.Email, "*****@*****.**");
            Assert.AreEqual(customer.City, "Aarhus");
            Assert.AreEqual(customer.Address, "City Center, 12");
            Assert.AreEqual(customer.Zipcode, "8765ASD");
            Assert.AreEqual(customer.PhoneNb1, "12131415");
            Assert.AreEqual(customer.PhoneNb2, "16171819");
        }
Exemple #3
0
        public void ShouldEditAllTheInformationCorrectly()
        {
            string old_fName   = "Jon";
            string old_lName   = "Doe";
            string old_email   = "*****@*****.**";
            string old_city    = "Odense";
            string old_address = "City Center, 10";
            string old_zipcode = "5200";
            string old_phoneNb = "31525485";


            ValidateCustomer vc = new ValidateCustomer();

            ICustomer customer = vc.CreateCustomer(old_fName, old_lName, old_email, old_city, old_address, old_zipcode, old_phoneNb, old_phoneNb);


            string new_fName   = "Ben";
            string new_lName   = "Ten";
            string new_email   = "*****@*****.**";
            string new_city    = "Aarhus";
            string new_address = "City Center, 12";
            string new_zipcode = "8765";
            string new_phoneNr = "12131415";

            vc.Edit(new_fName, new_lName, new_email, new_city, new_address, new_zipcode, new_phoneNr, new_phoneNr, customer.Email);

            Assert.AreEqual(customer.FirstName, new_fName);
            Assert.AreEqual(customer.LastName, new_lName);
            Assert.AreEqual(customer.Email, new_email);
            Assert.AreEqual(customer.City, new_city);
            Assert.AreEqual(customer.Address, new_address);
            Assert.AreEqual(customer.Zipcode, new_zipcode);
            Assert.AreEqual(customer.PhoneNb1, new_phoneNr);
            Assert.AreEqual(customer.PhoneNb2, new_phoneNr);
        }
Exemple #4
0
        public void CheckIfExceptionIsThrownOnEmailWithInvalidCharacters()
        {
            string fName   = "Jon";
            string lName   = "Doe";
            string email   = "ab [email protected]";
            string city    = "Odense";
            string address = "City Center, 10";
            string zipcode = "5200";
            string phoneNb = "31525485";

            ValidateCustomer vc = new ValidateCustomer();

            ICustomer customer = vc.CreateCustomer(fName, lName, email, city, address, zipcode, phoneNb, phoneNb);
        }
Exemple #5
0
        public void CheckIfSomeFieldsAreEmpty()
        {
            string fName   = "";
            string lName   = "Doe";
            string email   = "*****@*****.**";
            string city    = "Odense";
            string address = "";
            string zipcode = "5200";
            string phoneNb = "31525485";


            ValidateCustomer vc = new ValidateCustomer();

            ICustomer customer = vc.CreateCustomer(fName, lName, email, city, address, zipcode, phoneNb, phoneNb);
        }
Exemple #6
0
        public void CheckIfExceptionIsThrownOnNameWithNumbers()
        {
            string fName   = "J1ohn";
            string lName   = "D0e";
            string email   = "*****@*****.**";
            string city    = "Odense";
            string address = "";
            string zipcode = "5200";
            string phoneNb = "31525485";


            ValidateCustomer vc = new ValidateCustomer();

            ICustomer customer = vc.CreateCustomer(fName, lName, email, city, address, zipcode, phoneNb, phoneNb);
        }
Exemple #7
0
        public void CheckIfEmailGetStandardized()
        {
            string fName   = "jANe";
            string lName   = "DOe";
            string email   = "*****@*****.**";
            string city    = "oDeNSE";
            string address = "no street, 12309";
            string zipcode = "52o0da";
            string phoneNb = "30 52 54 85";

            ValidateCustomer vc = new ValidateCustomer();

            ICustomer customer = vc.CreateCustomer(fName, lName, email, city, address, zipcode, phoneNb, phoneNb);

            Assert.AreEqual("*****@*****.**", customer.Email);
        }
Exemple #8
0
        public void CheckIfNamesGetStandardized()
        {
            string fName   = "jANe";
            string lName   = "DOe";
            string email   = "*****@*****.**";
            string city    = "oDeNSE";
            string address = "no street";
            string zipcode = "5200";
            string phoneNb = "31525485";


            ValidateCustomer vc = new ValidateCustomer();

            ICustomer customer = vc.CreateCustomer(fName, lName, email, city, address, zipcode, phoneNb, phoneNb);

            Assert.AreEqual("Jane", customer.FirstName);
            Assert.AreEqual("Doe", customer.LastName);
            Assert.AreEqual("Odense", customer.City);
        }
Exemple #9
0
        public void ShouldUpdateCustomerInEveryCase()
        {
            string old_fName   = "Jon";
            string old_lName   = "Doe";
            string old_email   = "*****@*****.**";
            string old_city    = "Odense";
            string old_address = "City Center, 10";
            string old_zipcode = "5200";
            string old_phoneNr = "31525485";


            ValidateCustomer vc = new ValidateCustomer();

            ICustomer customer = vc.CreateCustomer(old_fName, old_lName, old_email, old_city, old_address, old_zipcode, old_phoneNr, old_phoneNr);

            CaseRepository cr = CaseRepository.Instance;

            Case case1 = new Case();

            case1.Customer   = customer;
            case1.CaseNumber = 1;

            Case case2 = new Case();

            case2.Customer   = customer;
            case2.CaseNumber = 2;

            cr.Add(case1);
            cr.Add(case2);

            string new_fName   = "Ben";
            string new_lName   = "Ten";
            string new_email   = "*****@*****.**";
            string new_city    = "Aarhus";
            string new_address = "City Center, 12";
            string new_zipcode = "8765";
            string new_phoneNr = "12131415";

            vc.Edit(new_fName, new_lName, new_email, new_city, new_address, new_zipcode, new_phoneNr, new_phoneNr, customer.Email);

            Assert.AreEqual(cr.Load(1).Customer.FirstName, cr.Load(2).Customer.FirstName);
        }
Exemple #10
0
        public void CheckIfAllFieldsHaveValues()
        {
            string fName   = "Jon";
            string lName   = "Doe";
            string email   = "*****@*****.**";
            string city    = "Odense";
            string address = "City Center, 10";
            string zipcode = "5200";
            string phoneNb = "31525485";


            ValidateCustomer vc = new ValidateCustomer();

            ICustomer customer = vc.CreateCustomer(fName, lName, email, city, address, zipcode, phoneNb, phoneNb);

            Assert.AreEqual(fName, customer.FirstName);
            Assert.AreEqual(lName, customer.LastName);
            Assert.AreEqual(city, customer.City);
            Assert.AreEqual(address, customer.Address);
            Assert.AreEqual(zipcode, customer.Zipcode);
            Assert.AreEqual(phoneNb, customer.PhoneNb1);
            Assert.AreEqual(phoneNb, customer.PhoneNb2);
        }