コード例 #1
0
ファイル: ToDoTests.cs プロジェクト: seymej72/ToDoList
        public void TestUpdateTask()
        {
            ToDoDB db     = new ToDoDB();
            int    taskId = db.GetNextTaskId() + 1;
            Dictionary <int, SubTask> dictionary   = new Dictionary <int, SubTask>();
            DisposableTask            expectedTask = new DisposableTask();

            expectedTask.setTaskId(taskId);                 //Id
            expectedTask.setTitle("TestTitle");             //Title
            expectedTask.setDescription("TestDescription"); //Notes
            expectedTask.setAllowNotifications(false);      //allowNotifications
            expectedTask.setIsComplete(false);              //isComplete
            expectedTask.setTaskFKey(0);                    //taskFKey
            db.InsertDisposableTask(expectedTask);
            expectedTask.setTitle("UPDATEDTITLE");          //Title
            db.UpdateTask(expectedTask);
            DisposableTask actualTask = db.FetchDisposableTask(taskId + 1);

            //expectedTask.setTaskId(taskId);
            Assert.AreEqual(expectedTask, actualTask);
        }
コード例 #2
0
ファイル: ToDoTests.cs プロジェクト: seymej72/ToDoList
        public void TestDisposableTaskEquals()
        {
            Dictionary <int, SubTask> dictionary = new Dictionary <int, SubTask>();
            DisposableTask            task1      = new DisposableTask("Title", "This is a description", dictionary);
            DisposableTask            task2      = new DisposableTask("Title", "This is a description", dictionary);

            Assert.AreEqual(task1, task2);
            task2.setTitle("DIFFERENTTITLE");
            Assert.AreNotEqual(task1, task2);

            task1 = new DisposableTask("Title", "This is a description", dictionary);
            task2 = new DisposableTask("Title", "This is a description", dictionary);
            task1.setAllowNotifications(true);
            Assert.AreNotEqual(task1, task2);
        }