当前位置: 首页>>代码示例>>C#>>正文


C# Task.GetCategories方法代码示例

本文整理汇总了C#中ToDoList.Task.GetCategories方法的典型用法代码示例。如果您正苦于以下问题:C# Task.GetCategories方法的具体用法?C# Task.GetCategories怎么用?C# Task.GetCategories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ToDoList.Task的用法示例。


在下文中一共展示了Task.GetCategories方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Test_AddCategory_AddsCategoryToTask

        public void Test_AddCategory_AddsCategoryToTask()
        {
            //Arrange
              Task testTask = new Task("Mow the lawn", new DateTime(2016, 2, 2), false);
              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);
        }
开发者ID:nlarion,项目名称:ToDoCsharp,代码行数:18,代码来源:TaskTest.cs

示例2: Test18_GetCategories_ReturnsAllTaskCategories

        public void Test18_GetCategories_ReturnsAllTaskCategories()
        {
            DateTime testTime = new DateTime(2016, 1, 1);

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

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

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

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

              Assert.Equal(testList,result);
        }
开发者ID:Rick1970,项目名称:todo-with-join-statement,代码行数:19,代码来源:TaskTest.cs

示例3: Test_Delete_DeletesCategoryAssociationsFromDatabase

        public void Test_Delete_DeletesCategoryAssociationsFromDatabase()
        {
            //Arrange
              Task testTask = new Task("Mow the lawn", false);
              testTask.Save();

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

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

              List<Category> resultTaskCategories = testTask.GetCategories();
              List<Category> testTaskCategories = new List<Category> {};

              //Assert
              Assert.Equal(testTaskCategories, resultTaskCategories);
        }
开发者ID:Rouz1130,项目名称:todo_manyTomany,代码行数:20,代码来源:CategoryTest.cs

示例4: Test_GetCategories_ReturnsAllTaskCategories

    public void Test_GetCategories_ReturnsAllTaskCategories()
    {
      //Arrange
      Task testTask = new Task("Mow the lawn");
      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);
    }
开发者ID:jtf86,项目名称:Final-Nancy-ToDo,代码行数:20,代码来源:TaskTest.cs

示例5: Test_Delete_DeletesCategoryAssociationsFromDatabase

        public void Test_Delete_DeletesCategoryAssociationsFromDatabase()
        {
            //Arrange
              DateTime testTime = new DateTime(2016, 1, 1);

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

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

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

              List<Category> resultTaskCategories = testTask.GetCategories();
              List<Category> testTaskCategories = new List<Category> {};
              List<Task> resultsTasks= Task.GetAll();
              List<Task> testTasks= new List<Task>{testTask};

              //Assert
              Assert.Equal(testTaskCategories, resultTaskCategories);
              Assert.Equal(testTasks, resultsTasks);
        }
开发者ID:Rick1970,项目名称:todo-with-join-statement,代码行数:25,代码来源:CategoryTest.cs


注:本文中的ToDoList.Task.GetCategories方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。