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()); }
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); }