本文整理匯總了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}