Example #1
0
        public async void DeleteActivity_ForValidArg_ShouldPassValidArg()
        {
            // Arrange
            var activityId = 12L;

            _activityRepoMock.Setup(repo => repo.DeleteAsync(It.IsAny <long>())).Returns(Task.CompletedTask);

            // Act
            await _target.DeleteActivityAsync(activityId);

            // Assert
            _unitOfWorkMock.Verify(uow => uow.SaveAsync(), Times.Once);
            _activityRepoMock.Verify(repo => repo.DeleteAsync(activityId), Times.Once);
        }
Example #2
0
        public override async Task <ActivityResponse> DeleteActivity(DeleteActivityRequest req, ServerCallContext context)
        {
            try
            {
                await _activityManager.DeleteActivityAsync(req.ActivityId);

                return(new ActivityResponse
                {
                    Message = $"Successfully deleted given activity: {req.ActivityId}",
                    Status = ResponseStatus.Success
                });
            }
            catch (Exception ex)
            {
                return(new ActivityResponse
                {
                    Message = $"Failed to delete given activity: ActivityId = {req.ActivityId}, Error = {ex.Message}",
                    Status = ResponseStatus.Failed
                });
            }
        }