public void Test_Find_FindsCategoryInDatabase()
        {
            //Arrange
              Category testCategory = new Category("Household chores");
              testCategory.Save();

              //Act
              Category foundCategory = Category.Find(testCategory.GetId());

              //Assert
              Assert.Equal(testCategory, foundCategory);
        }
        public void Test_Save_SavesCategoryToDatabase()
        {
            //Arrange
              Category testCategory = new Category("Household chores");
              testCategory.Save();

              //Act
              List<Category> result = Category.GetAll();
              List<Category> testList = new List<Category>{testCategory};

              //Assert
              Assert.Equal(testList, result);
        }
        public void Test_Save_AssignsIdToCategoryObject()
        {
            //Arrange
              Category testCategory = new Category("Household chores");
              testCategory.Save();

              //Act
              Category savedCategory = Category.GetAll()[0];

              int result = savedCategory.GetId();
              int testId = testCategory.GetId();

              //Assert
              Assert.Equal(testId, result);
        }
        public void Test_AddCategory_AddsCategoryToTask()
        {
            //Arrange
              Task testTask = new Task("Mow the lawn", new DateTime(2015, 1, 18));
              testTask.Save();

              Category testCategory = new Category("Home stuff");
              testCategory.Save();

              //Act
              testTask.AddCategory(testCategory);

              List<Category> result = testTask.GetCategories();
              List<Category> testList = new List<Category>{testCategory};

              //Assert
              Assert.Equal(testList, result);
        }
        public void Test_AddTask_AddsTaskToCategory()
        {
            Category testCategory = new Category("Household chores");
              testCategory.Save();

              Task testTask = new Task("Mow the Lawn", new DateTime(2014, 4, 21));
              testTask.Save();

              Task testTask2 = new Task("Water the garden", new DateTime(2014, 4, 21));
              testTask2.Save();

              testCategory.AddTask(testTask);
              testCategory.AddTask(testTask2);

              List<Task> result = testCategory.GetTasks();
              List<Task> testList = new List<Task>{testTask, testTask2};

              Assert.Equal(testList, result);
        }
        public void Test_GetCategories_ReturnsAllTaskCategories()
        {
            //Arrange
              Task testTask = new Task("Mow the lawn", new DateTime(2015, 1, 18));
              testTask.Save();

              Category testCategory1 = new Category("Home stuff");
              testCategory1.Save();

              Category testCategory2 = new Category("Work stuff");
              testCategory2.Save();

              //Act
              testTask.AddCategory(testCategory1);
              List<Category> result = testTask.GetCategories();
              List<Category> testList = new List<Category> {testCategory1};

              //Assert
              Assert.Equal(testList, result);
        }
        public void Test_GetTasks_RetrievesAllCategoryTasks()
        {
            Category testCategory = new Category("Household chores");
              testCategory.Save();

              Task testTask1 = new Task("Mow the lawn", new DateTime(2014, 4, 21));
              testTask1.Save();

              Task testTask2 = new Task("Buy plane ticket", new DateTime(2014, 4, 21));
              testTask2.Save();

              testCategory.AddTask(testTask1);
              List<Task> savedTasks = testCategory.GetTasks();
              List<Task> testList = new List<Task> {testTask1};

              Assert.Equal(testList, savedTasks);
        }