Exemplo n.º 1
0
        public void TestTaskCreation()
        {
            SQLiteStorage storage = new SQLiteStorage(inMemory: true);

            storage.AddModel <User>();
            storage.AddModel <Project>();
            storage.AddModel <Task>();

            User user = new User(storage)
            {
                name = "Test User"
            };

            Project project = new Project(storage)
            {
                name = "Test Project"
            };

            Task task = new Task(project, user, storage);

            task.Save();

            Task loaded = Task.GetById(storage, task.Id);

            Assert.IsTrue(task.IsSaved());
            Assert.IsTrue(loaded.IsSaved());
            Assert.IsTrue(user.IsSaved());
            Assert.IsTrue(project.IsSaved());
            Assert.AreEqual(loaded.Project.name, "Test Project");
            Assert.AreEqual(loaded.Performer.name, "Test User");

            task.Description = "Updated description";
            task.Save();
        }
Exemplo n.º 2
0
        public void TestSavingAndLoading()
        {
            DictionaryStorage storage = new DictionaryStorage();

            storage.AddModel <User>();
            storage.AddModel <Project>();
            storage.AddModel <Task>();

            User user = new User(storage)
            {
                name = "Test User"
            };

            Project project = new Project(storage)
            {
                name = "Test Project"
            };

            Task task = new Task(project, user, storage);

            task.Save();

            Task loaded = Task.GetById(storage, task.Id);

            Assert.IsTrue(task.IsSaved());
            Assert.IsTrue(loaded.IsSaved());
            Assert.IsTrue(user.IsSaved());
            Assert.IsTrue(project.IsSaved());
            Assert.AreEqual(loaded.Project.name, "Test Project");
            Assert.AreEqual(loaded.Performer.name, "Test User");
        }