Пример #1
0
    private async Task WhenCreateMergeRequestIsMerged()
    {
        var createMergeRequestCommand = new CreateMergeRequestCommand
        {
            NoteId      = _cloneNoteId,
            Title       = "merge request title",
            Description = "merge request description"
        };

        _mergeRequestId = await _mediator.Send(createMergeRequestCommand);

        await _mediator.Send(new MergeTheRequestCommand(_mergeRequestId));
    }
Пример #2
0
    private async Task <Guid> CreateOpenMergeRequestAsync()
    {
        var noteId = await _fixture.CreateDefaultNoteAsync(new NoteOptions());

        var cloneNoteId = await _fixture.Mediator.Send(new CloneNoteCommand(noteId, Guid.NewGuid()));

        var command = new CreateMergeRequestCommand
        {
            NoteId      = cloneNoteId,
            Title       = "New Feature",
            Description = "New feature description"
        };

        return(await _fixture.Mediator.Send(command));
    }
Пример #3
0
    public async Task CreateMergeRequest_IsSuccessful()
    {
        var noteId = await _fixture.CreateDefaultNoteAsync(new NoteOptions());

        var cloneNoteId = await _fixture.Mediator.Send(new CloneNoteCommand(noteId, Guid.NewGuid()));

        var command = new CreateMergeRequestCommand
        {
            NoteId      = cloneNoteId,
            Title       = "New Feature",
            Description = "New feature description"
        };

        var mergeRequestId = await _fixture.Mediator.Send(command);

        var mergeRequest = await _mergeRequestQuery.GetMergeRequestAsync(mergeRequestId);

        Assert.Equal(command.Title, mergeRequest.Title);
        Assert.Equal(command.Description, mergeRequest.Description);
        Assert.Equal(command.NoteId, mergeRequest.SourceNoteId);
        Assert.Equal(noteId, mergeRequest.DestinationNoteId);
        Assert.Equal(MergeRequestStatus.Open, mergeRequest.Status);
    }
Пример #4
0
 public async Task<IActionResult> CreateAsync([FromBody] CreateMergeRequestCommand command)
 {
     return Ok(await _mediator.Send(command));
 }