示例#1
0
        public void ReadTest()
        {
            //No properties does need to be created before the property itself
            //Create the property itself
            User johnDoe = new User() { Name = "John Doe", Address = "Sofiendalsvej 60", ZipCode = "9000", Email = "*****@*****.**", Misc = "Her skal stå noget", Mobile = "51203985", Phone = "51203985" };

            //Save it to the database
            uCtr.InsertUser(johnDoe);

            //Get property from database and assert not null
            Assert.IsNotNull(uCtr.GetUserByPhone("51203985"));
            uCtr.DeleteUser(johnDoe);
        }
示例#2
0
        public void CreateTest()
        {
            //Create the user itself
            User johnDoe = new User() { Name = "John Doe", Address = "Sofiendalsvej 60", Email = "*****@*****.**", Misc = "Her skal stå noget", Mobile = "51203985", Phone = "51203985" };

            //Save it to the database and get amount of properties in db before and after save
            int CountDB = uCtr.GetAllUsers().ToList().Count;
            uCtr.InsertUser(johnDoe);
            int CountDBAfter = uCtr.GetAllUsers().ToList().Count;

            //Compare Properties. Maybe use conditions other than Adress?
            Assert.AreEqual<int>(CountDBAfter, CountDB + 1);
            uCtr.DeleteUser(johnDoe);
        }
示例#3
0
        public void DeleteTest()
        {
            //Create properties that are part of user.
            //Create the user itself
            User johnDoe = new User() { Name = "John Doe", Address = "Sofiendalsvej 60", ZipCode = "9000", Email = "*****@*****.**", Misc = "Her skal stå noget", Mobile = "51203985", Phone = "51203985" };

            //Save it to the database
            uCtr.InsertUser(johnDoe);

            //Delete it again
            uCtr.DeleteUser(johnDoe);

            //Try to retrieve the deleted user again, and assert it is null.
            User u = uCtr.GetUserByPhone(johnDoe.Phone);
            Assert.IsNull(u);
        }
示例#4
0
        public void UpdateTest()
        {
            //Create the user itself
            User johnDoe = new User() { Name = "John Doe", Address = "Sofiendalsvej 60", ZipCode = "9000", Email = "*****@*****.**", Misc = "Her skal stå noget", Mobile = "51203985", Phone = "51203985" };
            //Save it to the database
            uCtr.InsertUser(johnDoe);
            //Change the user:
            List<Appointment> appointmentList = new List<Appointment>();

            uCtr.UpdateUser(johnDoe, appointmentList, "John Doe", "Sofiendalsvej 60", "9000", "112", "51203985", "*****@*****.**", "Her skal stå noget");

            //Test the assertion
            Assert.IsNotNull(uCtr.GetUserByPhone("112"));
            uCtr.DeleteUser(johnDoe);
        }
示例#5
0
 public void DeleteUser(User user)
 {
     uCtr.DeleteUser(user);
 }
示例#6
0
 public void UpdateUser(User user, List<Appointment> appointments, string name, string address, string zipCode, string phone, string mobil, string email, string misc)
 {
     uCtr.UpdateUser(user, appointments, name, address, zipCode, phone, mobil, email, misc);
 }
示例#7
0
 public void InsertUser(User user)
 {
     uCtr.InsertUser(user);
 }