public void Merge(INoteChecker noteValidatorService, Guid userId) { if (_status != MergeRequestStatus.Open) { throw new MergeRequestStatusChangeException(_status, MergeRequestStatus.Merged); } if (!noteValidatorService.IsPublishedNote(_sourceNoteId) || !noteValidatorService.IsPublishedNote(_destinationNoteId)) { throw new NoteHaveNotBeenPublishedException(); } ApplyChange(new MergeRequestMergedEvent(Id, GetNextVersion(), userId, _sourceNoteId, _destinationNoteId)); }
public MergeRequest CreateMergeRequest(INoteChecker noteChecker, IMergeRequestChecker mergeRequestChecker, Guid userId, string title, string description) { CheckDelete(); if (!_cloneFormId.HasValue) { throw new OnlyCloneNoteCanBeMergedException(); } if (!noteChecker.IsPublishedNote(_cloneFormId.Value)) { throw new NoteHaveNotBeenPublishedException(); } return(MergeRequest.Initialize(mergeRequestChecker, userId, Id, _cloneFormId.Value, title, description)); }