示例#1
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);
        }
示例#2
0
        public void CanLoadACaseFromCaseRepository()
        {
            Case case1 = new Case();

            case1.CaseNumber = 1;
            Case case2 = new Case();

            case2.CaseNumber = 2;

            CaseRepository cr = CaseRepository.Instance;

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


            ICase case1Loaded = cr.Load(1);
            ICase case2Loaded = cr.Load(2);


            Assert.IsTrue(case1.Equals(case1Loaded));
            Assert.IsTrue(case2.Equals(case2Loaded));
            Assert.IsFalse(case2.Equals(case1Loaded));
        }