コード例 #1
0
        public async Task SaveAsync_ValidTasksGroupToAdd_SavePerformed()
        {
            ITasksGroup tasksGroup = mTasksGroupFactory.CreateGroup("ValidGroupName");

            IDbRepository <ITasksGroup> dbRepository      = A.Fake <IDbRepository <ITasksGroup> >();
            TasksGroupService           tasksGroupService =
                new TasksGroupService(dbRepository, mTasksGroupFactory, NullLogger <TasksGroupService> .Instance);

            await tasksGroupService.SaveAsync(tasksGroup.Name).ConfigureAwait(false);

            A.CallTo(() => dbRepository.AddAsync(A <ITasksGroup> .Ignored)).MustHaveHappenedOnceExactly();
        }
コード例 #2
0
        public async Task SaveAsync_ValidTasksGroupToAdd_SuccessResponseReturned()
        {
            const string groupName = "ValidGroupName";

            IDbRepository <ITasksGroup> dbRepository = A.Fake <IDbRepository <ITasksGroup> >();

            A.CallTo(() => dbRepository.AddAsync(A <ITasksGroup> .Ignored)).Returns(true);

            TasksGroupService tasksGroupService =
                new TasksGroupService(dbRepository, mTasksGroupFactory, NullLogger <TasksGroupService> .Instance);

            IResponse <ITasksGroup> response = await tasksGroupService.SaveAsync(groupName).ConfigureAwait(false);

            Assert.True(response.IsSuccess);
            Assert.Equal(groupName, response.ResponseObject.Name);
        }