コード例 #1
0
        public async Task Should_Throw_When_Get_NonExisting_TaskList()
        {
            ITaskListRepository taskListRepo = new TaskListRepository(
                _fxt.Database.GetCollection <TaskList>("task-lists")
                );

            await Assert.ThrowsAsync <EntityNotFoundException>(() =>
                                                               taskListRepo.GetByNameAsync("task name ಠ_ಠ", "owner id (ツ)")
                                                               );
        }
コード例 #2
0
        public async Task Should_Get_TaskList_By_Name()
        {
            ITaskListRepository taskListRepo = new TaskListRepository(
                _fxt.Database.GetCollection <TaskList>("task-lists")
                );

            // get task list by unique name and owner
            TaskList taskList = await taskListRepo.GetByNameAsync("grocerIES", "bobby");

            Assert.Equal("My Groceries List", taskList.Title);
            Assert.Equal("groceries", taskList.DisplayId);
            Assert.Equal("bobby", taskList.OwnerId);
            Assert.NotNull(taskList.Id);
            Assert.True(ObjectId.TryParse(taskList.Id, out _), "Entity ID should be a Mongo ObjectID.");
            Assert.InRange(taskList.CreatedAt, DateTime.UtcNow.AddSeconds(-30), DateTime.UtcNow);

            Assert.Null(taskList.Description);
            Assert.Null(taskList.Tags);
            Assert.Null(taskList.Collaborators);
            Assert.Null(taskList.ModifiedAt);
        }