當前位置: 首頁>>代碼示例>>C#>>正文


C# Category.GetTasks方法代碼示例

本文整理匯總了C#中ToDoList.Category.GetTasks方法的典型用法代碼示例。如果您正苦於以下問題:C# Category.GetTasks方法的具體用法?C# Category.GetTasks怎麽用?C# Category.GetTasks使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ToDoList.Category的用法示例。


在下文中一共展示了Category.GetTasks方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Test_Delete_DeletesTaskAssociationsFromDatabase

        public void Test_Delete_DeletesTaskAssociationsFromDatabase()
        {
            //Arrange
              Category testCategory = new Category("Home stuff");
              testCategory.Save();

              string testDescription = "Mow the lawn";
              Task testTask = new Task(testDescription, new DateTime(2016, 2, 2));
              testTask.Save();

              //Act
              testTask.AddCategory(testCategory);
              testTask.Delete();

              List<Task> resultCategoryTasks = testCategory.GetTasks();
              List<Task> testCategoryTasks = new List<Task> {};

              //Assert
              Assert.Equal(testCategoryTasks, resultCategoryTasks);
        }
開發者ID:nlarion,項目名稱:ToDoCsharp,代碼行數:20,代碼來源:TaskTest.cs

示例2: Test_AddTask_AddsTaskToCategory

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

              Task testTask = new Task("Mow the lawn", false);
              testTask.Save();

              Task testTask2 = new Task("Water the garden", false);
              testTask2.Save();

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

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

              //Assert
              Assert.Equal(testList, result);
        }
開發者ID:Rouz1130,項目名稱:todo_manyTomany,代碼行數:22,代碼來源:CategoryTest.cs

示例3: Test_Delete_DeletesTaskFromDatabase

    public void Test_Delete_DeletesTaskFromDatabase()
    {
      //Arrange
      Category testCategory = new Category("Home stuff");
      testCategory.Save();

      string description1 = "Mow the lawn";
      Task testTask1 = new Task(description1);
      testTask1.Save();

      string description2 = "Do homework";
      Task testTask2 = new Task(description2);
      testTask2.Save();

      //Act
      testTask1.AddCategory(testCategory);
      testTask1.Delete();

      List<Task> resultTasks = Task.GetAll();
      List<Task> testTaskList = new List<Task> {testTask2};

      List<Task> resultCategoryTasks = testCategory.GetTasks();
      List<Task> testCategoryTasks = new List<Task> {};

      //Assert
      Assert.Equal(testTaskList, resultTasks);
      Assert.Equal(testCategoryTasks, resultCategoryTasks);
    }
開發者ID:jtf86,項目名稱:Final-Nancy-ToDo,代碼行數:28,代碼來源:TaskTest.cs

示例4: Test_GetTasks_ReturnAllCategoryTasks

        public void Test_GetTasks_ReturnAllCategoryTasks()
        {
            Category testCategory = new Category("Househould chores");
              testCategory.Save();
              DateTime testTime = new DateTime(2016, 1, 1);

              Task testTask1= new Task("Mow the lawn",testTime);
              testTask1.Save();

              Task testTask2 = new Task("Buy plane ticket",testTime);
              testTask2.Save();

              testCategory.AddTask(testTask1);
              List<Task> savedTasks = testCategory.GetTasks();
              List<Task> testList= new List<Task>{testTask1};
              Assert.Equal(testList,savedTasks);
        }
開發者ID:Rick1970,項目名稱:todo-with-join-statement,代碼行數:17,代碼來源:CategoryTest.cs

示例5: Test_GetTasks_ReturnsAllCategoryTasks

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

              Task testTask1 = new Task("Mow the lawn", false);
              testTask1.Save();

              Task testTask2 = new Task("Buy plane ticket", false);
              testTask2.Save();

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

              //Assert
              Assert.Equal(testList, savedTasks);
        }
開發者ID:Rouz1130,項目名稱:todo_manyTomany,代碼行數:20,代碼來源:CategoryTest.cs

示例6: Test_GetTasks_RetrievesAllTaskWithCategory

        public void Test_GetTasks_RetrievesAllTaskWithCategory()
        {
            Category testCategory = new Category("Household chores");
              testCategory.Save();

              DateTime fakeTime = new DateTime(2014, 1, 1);
              Task firstTask = new Task ("Mow the lawn", testCategory.GetId(), fakeTime);
              firstTask.Save();
              Task secondTask = new Task("Do the dishes", testCategory.GetId(), fakeTime);
              secondTask.Save();

              List<Task> testTaskList = new List<Task> {firstTask, secondTask};
              List<Task> resultTaskList = testCategory.GetTasks();

              Assert.Equal(testTaskList, resultTaskList);
        }
開發者ID:Rouz1130,項目名稱:Delete-Update-Category,代碼行數:16,代碼來源:CategoryTest.cs


注:本文中的ToDoList.Category.GetTasks方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。