public void ShouldRequireMinimumFields()
        {
            var command = new UpdateProjectParticipantCommand();

            FluentActions.Invoking(() =>
                                   SendAsync(command)).Should().Throw <ValidationException>();
        }
        public async Task ShouldDeleteProjectParticipantSuccessfully()
        {
            var userId    = RunAsDefaultUser();
            var projectId = await SendAsync(new CreateProjectCommand
            {
                Key     = "TKWZ",
                Name    = "Test Project",
                OwnerId = userId
            });

            var itemId = await SendAsync(new CreateProjectParticipantCommand
            {
                AddedBy   = userId,
                ProjectId = projectId,
                UserId    = userId
            });

            var command = new UpdateProjectParticipantCommand
            {
                Id        = itemId,
                IsDeleted = true,
                UserId    = userId
            };

            await SendAsync(command);

            var item = await FindAsync <ProjectParticipant>(itemId);

            item.Should().NotBeNull();
            item.IsDeleted.Should().BeTrue();
            item.UserId.Should().Be(command.UserId);
            item.LastModified.Should().BeCloseTo(DateTime.Now, 10000);
        }
示例#3
0
 public async Task <ActionResult> DeleteAsync(Guid id, [FromBody] UpdateProjectParticipantCommand request)
 {
     request.Id = id;
     return(this.Ok(await this.Mediator.Send(request)));
 }