Esempio n. 1
0
        public void testWithoutRepository()
        {
            // make a connection to the database - the connection string needed to be added to app.config
            taskDomainDBEntities db = new taskDomainDBEntities();

            user          = new User();
            user.username = "******";
            user.password = "******";

            Assert.IsNotNull(db.Users.Add(user));

            Assert.AreNotEqual(0, db.Users.Local.Count);

            Assert.AreEqual(user.username, db.Users.Find(user.username).username);
            user.password = "******";

            Assert.AreEqual("newPassword", db.Users.Find(user.username).password);

            Assert.IsNotNull(db.Users.Remove(user));
        }
Esempio n. 2
0
        public void testWithoutRepository()
        {
            // make a connection to the database - the connection string needed to be added to app.config
            taskDomainDBEntities db = new taskDomainDBEntities();

            task             = new Task();
            task.name        = "testName";
            task.notes       = "notes";
            task.description = "description";

            Assert.IsNotNull(db.Tasks.Add(task));

            Assert.AreNotEqual(0, db.Tasks.Local.Count);

            Assert.AreEqual("description", db.Tasks.Find(task.id).description);
            task.description = "new description";

            Assert.AreEqual("new description", db.Tasks.Find(task.id).description);

            Assert.IsNotNull(db.Tasks.Remove(task));
        }
        public void testWithoutRepository()
        {
            // make a connection to the database - the connection string needed to be added to app.config
            taskDomainDBEntities db = new taskDomainDBEntities();

            task          = new Task();
            task.name     = "testTaskName";
            estimate      = new Estimate();
            estimate.Task = task;
            estimate.time = 4;
            estimate.type = "hours";
            Assert.IsNotNull(db.Estimates.Add(estimate));

            Assert.AreNotEqual(0, db.Estimates.Local.Count);

            Assert.AreEqual(4, db.Estimates.Find(estimate.id).time);
            estimate.time = 6;

            Assert.AreEqual(6, db.Estimates.Find(estimate.id).time);

            Assert.IsNotNull(db.Estimates.Remove(estimate));
        }