Ejemplo n.º 1
0
        public void setUpTestViewModels()
        {
            defaultTaskItem    = new TaskItem("defaultTask", defaultCategory, "5", "8");
            testMondayDateTime = new DateTime(1995, 5, 15);

            taskDbLayer = new TaskDatabaseLayer(new TaskContext());
            taskDbLayer.addNewWeekRange(new Week(testMondayDateTime, new DateTime(1995, 5, 20)));
            taskDbLayer.addNewCategory(defaultCategory);
            taskDbLayer.addTaskItem(defaultTaskItem, "Mon", testMondayDateTime);
        }
Ejemplo n.º 2
0
        public void TestAddTask()
        {
            taskDbLayer.addTaskItem(defaultTaskItem, "Mon", testMondayDateTime);
            var existingTaskList      = taskDbLayer.getExistingTaskList();
            int originalNumberOfTasks = existingTaskList.Count;

            Assert.AreEqual(existingTaskList[originalNumberOfTasks - 1].TaskName, "defaultTask");

            taskDbLayer.deleteTaskItem(defaultTaskItem);
            Assert.IsTrue(taskContext.tasks.Count() == originalNumberOfTasks - 1);
        }
Ejemplo n.º 3
0
        public void setUpTaskDbLayer()
        {
            taskContext        = new TaskContext();
            defaultTaskItem    = new TaskItem("defaultTask", defaultCategory, "5", "8");
            testMondayDateTime = new DateTime(1995, 5, 15);
            testSundayDateTime = new DateTime(1995, 5, 22);

            taskDbLayer = new TaskDatabaseLayer(taskContext);

            taskDbLayer.addNewWeekRange(new Week(testMondayDateTime, new DateTime(1995, 5, 20)));
            taskDbLayer.addNewCategory(defaultCategory);
            taskDbLayer.addTaskItem(defaultTaskItem, "Mon", testMondayDateTime);

            var mockContext = new Mock <ITaskContext>();

            mockDbLayer = new TaskDatabaseLayer(mockContext.Object);

            var fakeCategorySet = new FakeDbSet <Category>();

            mockContext.Setup(context => context.categories).Returns(fakeCategorySet);

            fakeCategorySet.Add(new Category("Cat A")
            {
                Id = 5
            });
            fakeCategorySet.Add(new Category("Cat B")
            {
                Id = 7
            });

            var fakeTaskSet = new FakeDbSet <TaskItem>();

            taskA = new TaskItem("Task A", "Cat A", "5", "6");
            taskB = new TaskItem("Task B", "Cat B", "5", "6");

            fakeTaskSet.Add(taskA);
            fakeTaskSet.Add(taskB);

            mockContext.Setup(context => context.tasks).Returns(fakeTaskSet);

            var fakeWeekSet = new FakeDbSet <Week>();

            fakeWeekSet.Add(new Week(testMondayDateTime, testSundayDateTime)
            {
                Id = 59
            });

            mockContext.Setup(context => context.weeks).Returns(fakeWeekSet);
        }
Ejemplo n.º 4
0
        public void setUpTestViewModels()
        {
            defaultTaskItem    = new TaskItem("defaultTask", defaultCategory, "5", "8");
            testMondayDateTime = new DateTime(1995, 5, 15);

            taskDbLayer = new TaskDatabaseLayer(new TaskContext());
            taskDbLayer.addNewWeekRange(new Week(testMondayDateTime, new DateTime(1995, 5, 20)));
            taskDbLayer.addNewCategory(defaultCategory);
            taskDbLayer.addTaskItem(defaultTaskItem, "Mon", testMondayDateTime);

            testAgendaVMFullWeek = new WeeklyAgendaViewModel()
            {
                TaskItemName      = defaultTaskItem.TaskName,
                TaskItemCategory  = defaultCategory,
                TaskItemStartTime = defaultTaskItem.TaskStartDateTime.ToString(),
                TaskItemEndTime   = defaultTaskItem.TaskEndDateTime.ToString()
            };

            testAgendaVMFullWeek.CategoryList.Add("Test Cat");
            testAgendaVMFullWeek.updateDaysToDisplay();
        }