Beispiel #1
0
        public void ShouldRequireMinimumFields()
        {
            var command = new CreateProjectParticipantCommand();

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

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

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

            item.Should().NotBeNull();
            item.IsDeleted.Should().BeFalse();
            item.UserId.Should().Be(userId);
            item.AddedBy.Should().Be(userId);
            item.CreatedBy.Should().Be(userId);
            item.CreatedDate.Should().BeCloseTo(DateTime.Now, 10000);
            item.LastModifiedBy.Should().BeNull();
            item.LastModified.Should().BeNull();
        }
Beispiel #3
0
 public async Task <ActionResult <Guid> > AddAsync([FromBody] CreateProjectParticipantCommand request)
 {
     return(await this.Mediator.Send(request));
 }