예제 #1
0
        public async void CreateIssue_ShouldHas_DefaultState()
        {
            var creationDate = DateTime.Now;

            SystemClock.Set(creationDate);

            var result = await _handler.Handle(_request, CancellationToken.None);

            var issue = await _issueRepository.findByIdAsync(result);

            issue.IssueState.ShouldBe(await _issueStateRepository.GetDefaultState());
        }
예제 #2
0
        public async Task <int> Handle(CreateIssueCommand request, CancellationToken cancellationToken)
        {
            var userId       = _currentUserService.GetUserId();
            var defaultState = await _issueStateRepository.GetDefaultState();

            var issue = new Issue(request.Summary, request.IssueTypeId, userId, defaultState);

            _issueRepository.Add(issue);

            await _issueRepository.Commit(cancellationToken);

            return(issue.Id);
        }