Exemplo n.º 1
0
        public void TestRemoveCustomerInterests()
        {
            using (basicEntities be = new basicEntities())
            {
                customer = TestCustomer.AddCustomer("Customer123", "adam", "admin123123", 054, 3134195, "*****@*****.**");

                be.Users.Add(customer);

                be.SaveChanges();

                ci = new CustomerIntrests();

                ci.InterestID       = InterestType.Dancing;
                ci.CustomerUserName = customer.UserName;

                be.CustomerIntrests.Add(ci);
                be.SaveChanges();



                CustomerIntrests c = be.CustomerIntrests.Find(ci.CustomerUserName, ci.InterestID);

                if (c != null)
                {
                    be.CustomerIntrests.Remove(c);
                    be.Users.Remove(be.Users.Find(customer.UserName));
                    be.SaveChanges();
                }
            }
        }
Exemplo n.º 2
0
        public void CleanUp()
        {
            using (basicEntities be = new basicEntities())
            {
                CustomerIntrests c = be.CustomerIntrests.Find(ci.CustomerUserName, ci.InterestID);

                if (c != null)
                {
                    be.CustomerIntrests.Remove(c);
                    be.Users.Remove(be.Users.Find(customer.UserName));
                    be.SaveChanges();
                }
            }
        }
Exemplo n.º 3
0
        public void TestAddCustomerInterests()
        {
            using (basicEntities be = new basicEntities())
            {
                customer = TestCustomer.AddCustomer("Customer123", "adam", "admin123123", 054, 3134195, "*****@*****.**");

                be.Users.Add(customer);

                be.SaveChanges();

                ci = new CustomerIntrests();

                ci.InterestID       = InterestType.Dancing;
                ci.CustomerUserName = customer.UserName;

                be.CustomerIntrests.Add(ci);
                be.SaveChanges();


                Assert.AreEqual(be.CustomerIntrests.Find(ci.CustomerUserName, ci.InterestID).CustomerUserName, ci.CustomerUserName);
            }
        }