コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }