本文整理汇总了C#中ITaskRepository.GetTasks方法的典型用法代码示例。如果您正苦于以下问题:C# ITaskRepository.GetTasks方法的具体用法?C# ITaskRepository.GetTasks怎么用?C# ITaskRepository.GetTasks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITaskRepository
的用法示例。
在下文中一共展示了ITaskRepository.GetTasks方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: reading_tasks
/// <summary>
/// Checks correct behaviour when reading tasks
/// </summary>
private async Task reading_tasks()
{
it["retrieved file from persistence"] = () =>
{
_taskRepository = new TaskRepository(_ifileStore, _appSettings);
//compiler wants to assign to something
var tmp = _appSettings.Received().TaskDatabaseName;
_ifileStore.ReceivedWithAnyArgs().TryReadTextFile(_fileName, out _content);
};
context["given no tasks in persistence"] = () =>
{
before = async () =>
{
_ifileStore.TryReadTextFile(_fileName, out _content).Returns(x => x[1] = "");
_taskRepository = new TaskRepository(_ifileStore, _appSettings);
_taskItem = await _taskRepository.GetTasks();
_content = "";
};
it["task count is 0"] = () => _taskItem.Count.should_be(0);
it["last task id is 0"] = () => _taskRepository.GetLastTaskId().should_be(0);
};
context["given existing tasks in persistence"] = () =>
{
IList<TaskItem> retrievedItems = null;
before = async () =>
{
_taskItem = new List<TaskItem> { new TaskItem(5, "task 5"), new TaskItem(9, "task 9", true) };
_ifileStore.TryReadTextFile(_fileName, out _content).Returns(x => x[1] = JsonConvert.SerializeObject(_taskItem));
_taskRepository = new TaskRepository(_ifileStore, _appSettings);
_content = "";
retrievedItems = await _taskRepository.GetTasks();
};
it["task list has correct items"] = () =>
{
retrievedItems.Count.should_be(2);
TaskItem ti = retrievedItems[1];
ti.Completed.should_be_true();
ti.Id.should_be(9);
ti.Description.should_be("task 9");
};
it["last id is last id of item"] = () => _taskRepository.GetLastTaskId().should_be(9);
};
}