public async Task CreateNewMeetingGroup_Test() { // Arrange var proposalId = await MeetingsModule.ExecuteCommandAsync(new ProposeMeetingGroupCommand( MeetingGroupProposalSampleData.Name, MeetingGroupProposalSampleData.Description, MeetingGroupProposalSampleData.LocationCity, MeetingGroupProposalSampleData.LocationCountryCode)); await MeetingsModule.ExecuteCommandAsync(new AcceptMeetingGroupProposalCommand(Guid.NewGuid(), proposalId)); // Act await MeetingsModule.ExecuteCommandAsync( new CreateNewMeetingGroupCommand( Guid.NewGuid(), new MeetingGroupProposalId(proposalId))); // Assert var meetingGroups = await MeetingsModule.ExecuteQueryAsync(new GetAuthenticationMemberMeetingGroupsQuery()); Assert.That(meetingGroups, Is.Not.Empty); var meetingGroupDetails = await MeetingsModule.ExecuteQueryAsync(new GetMeetingGroupDetailsQuery(proposalId)); Assert.That(meetingGroupDetails.MembersCount, Is.EqualTo(1)); }
public async Task UnlikeMeetingComment_WhenDataIsValid_IsSuccessful() { // Arrange await MeetingsModule.ExecuteCommandAsync( new CreateMemberCommand( Guid.NewGuid(), ExecutionContext.UserId, "ivan_petrov", "*****@*****.**", "Ivan", "Petrov", "Ivan Petrov")); var meetingId = await MeetingHelper.CreateMeetingAsync(MeetingsModule, ExecutionContext); var meetingCommentId = await MeetingsModule.ExecuteCommandAsync(new AddMeetingCommentCommand(meetingId, "The meeting was awesome.")); await MeetingsModule.ExecuteCommandAsync(new AddMeetingCommentLikeCommand(meetingCommentId)); await AssertEventually( new GetMeetingCommentsProbe(MeetingsModule, meetingId, meetingCommentId, expectedCommentLikesCount : 1), 10000); // Act await MeetingsModule.ExecuteCommandAsync(new RemoveMeetingCommentLikeCommand(meetingCommentId)); // Assert var meetingCommentLikers = await MeetingsModule.ExecuteQueryAsync(new GetMeetingCommentLikersQuery(meetingCommentId)); Assert.That(meetingCommentLikers.Count, Is.EqualTo(0)); await AssertEventually( new GetMeetingCommentsProbe(MeetingsModule, meetingId, meetingCommentId, expectedCommentLikesCount : 0), 10000); }
public async Task EditMeetingComment_WhenDataIsValid_IsSuccessful() { // Arrange var meetingId = await CreateMeetingAsync(MeetingsModule, ExecutionContext); var meetingCommentId = await MeetingsModule.ExecuteCommandAsync(new AddMeetingCommentCommand( meetingId, "The meeting was great.")); var editedComment = "It was very interesting!"; var meetingCommentsBefore = await MeetingsModule.ExecuteQueryAsync(new GetMeetingCommentsQuery(meetingId)); var originalMeetingComment = meetingCommentsBefore.Single(); var date = new DateTime(2020, 1, 1, 01, 00, 00); SystemClock.Set(date); // Act await MeetingsModule.ExecuteCommandAsync(new EditMeetingCommentCommand(meetingCommentId, editedComment)); // Assert var meetingCommentsAfter = await MeetingsModule.ExecuteQueryAsync(new GetMeetingCommentsQuery(meetingId)); Assert.That(meetingCommentsAfter.Count, Is.EqualTo(1)); var editedMeetingComment = meetingCommentsAfter.Single(); Assert.That(editedMeetingComment.Comment, Is.EqualTo(editedComment)); Assert.That(editedMeetingComment.EditDate, Is.EqualTo(date)); Assert.That(editedMeetingComment.AuthorId, Is.EqualTo(originalMeetingComment.AuthorId)); Assert.That(editedMeetingComment.CreateDate, Is.EqualTo(originalMeetingComment.CreateDate)); }
public async Task AddMeetingComment_WhenDataIsValid_IsSuccessful() { // Arrange var meetingId = await CreateMeetingAsync(MeetingsModule, ExecutionContext); var date = new DateTime(2020, 1, 1, 01, 00, 00); SystemClock.Set(date); var comment = "The meeting was great."; // Act var meetingCommentId = await MeetingsModule.ExecuteCommandAsync(new AddMeetingCommentCommand(meetingId, comment)); // Assert var meetingComments = await MeetingsModule.ExecuteQueryAsync(new GetMeetingCommentsQuery(meetingId)); Assert.That(meetingComments.Count, Is.EqualTo(1)); var meetingComment = meetingComments.Single(); Assert.That(meetingComment.Id, Is.EqualTo(meetingCommentId)); Assert.That(meetingComment.Comment, Is.EqualTo(comment)); Assert.That(meetingComment.AuthorId, Is.EqualTo(ExecutionContext.UserId)); Assert.That(meetingComment.CreateDate, Is.EqualTo(date)); Assert.That(meetingComment.EditDate, Is.Null); }
public async Task CreateMeeting_Test() { // Arrange await MeetingsModule.ExecuteCommandAsync(new CreateMemberCommand( Guid.NewGuid(), ExecutionContext.UserId, "johndoe", "*****@*****.**", "John", "Doe", "John Doe")); // Act var meetingId = await MeetingHelper.CreateMeetingAsync( MeetingsModule, ExecutionContext); // Assert var meetingDetails = await MeetingsModule.ExecuteQueryAsync(new GetMeetingDetailsQuery(meetingId)); Assert.That(meetingDetails, Is.Not.Null); var meetingAttendees = await MeetingsModule.ExecuteQueryAsync(new GetMeetingAttendeesQuery(meetingId)); Assert.That(meetingAttendees.Count, Is.EqualTo(1)); }
public async Task AddReply_WhenDataIsValid_IsSuccessful() { // Arrange var meetingId = await MeetingHelper.CreateMeetingAsync(MeetingsModule, ExecutionContext); var meetingCommentId = await MeetingsModule.ExecuteCommandAsync(new AddMeetingCommentCommand(meetingId, "The meeting was great.")); var date = new DateTime(2020, 1, 1, 01, 00, 00); SystemClock.Set(date); var reply = "Absolutely!"; // Act var replyId = await MeetingsModule.ExecuteCommandAsync(new AddReplyToMeetingCommentCommand(meetingCommentId, reply)); // Assert var meetingComments = await MeetingsModule.ExecuteQueryAsync(new GetMeetingCommentsQuery(meetingId)); Assert.That(meetingComments.Count, Is.EqualTo(2)); var commentReply = meetingComments.Single(c => c.Id == replyId); Assert.That(commentReply.InReplyToCommentId, Is.EqualTo(meetingCommentId)); Assert.That(commentReply.Comment, Is.EqualTo(reply)); Assert.That(commentReply.AuthorId, Is.EqualTo(ExecutionContext.UserId)); Assert.That(commentReply.CreateDate, Is.EqualTo(date)); Assert.That(commentReply.EditDate, Is.Null); }
public void EnableMeetingCommenting_WhenConfigurationNotExist_ThrowsInvalidCommandException() { // Assert Assert.CatchAsync <InvalidCommandException>(async() => { // Act await MeetingsModule.ExecuteCommandAsync(new EnableMeetingCommentingConfigurationCommand(Guid.NewGuid())); }); }
public void UnlikeMeetingComment_WhenCommentNotExists_ThrowsInvalidCommandException() { // Assert Assert.CatchAsync <InvalidCommandException>(async() => { // Act await MeetingsModule.ExecuteCommandAsync(new RemoveMeetingCommentLikeCommand(meetingCommentId: Guid.NewGuid())); }); }
public void EditMeetingComment_WhenItIsNonexistent_ThrowsInvalidCommandException() { // Assert Assert.CatchAsync <InvalidCommandException>(async() => { // Act await MeetingsModule.ExecuteCommandAsync(new EditMeetingCommentCommand( meetingCommentId: Guid.NewGuid(), "Edit a nonexistent comment.")); }); }
public void AddReply_WhenParentCommentNotExists_ThrowsInvalidCommandException() { // Assert Assert.CatchAsync <InvalidCommandException>(async() => { // Act await MeetingsModule.ExecuteCommandAsync(new AddReplyToMeetingCommentCommand( inReplyToCommentId: Guid.NewGuid(), "Reply for a nonexistent comment.")); }); }
public void RemoveMeetingComment_WhenItIsNonexistent_ThrowsInvalidCommandException() { // Assert Assert.CatchAsync <InvalidCommandException>(async() => { // Act await MeetingsModule.ExecuteCommandAsync(new RemoveMeetingCommentCommand( meetingCommentId: Guid.NewGuid(), reason: String.Empty)); }); }
public void AddMeetingComment_WhenMeetingIsNonexistent_ThrowsInvalidCommandException() { // Assert Assert.CatchAsync <InvalidCommandException>(async() => { // Act await MeetingsModule.ExecuteCommandAsync(new AddMeetingCommentCommand( meetingId: Guid.NewGuid(), "Comment for a nonexistent meeting.")); }); }
public void ProposeMeetingGroup_WhenNoLocationProvided_ThrowsInvalidCommandException() { Assert.CatchAsync <InvalidCommandException>(async() => { await MeetingsModule.ExecuteCommandAsync(new ProposeMeetingGroupCommand( MeetingGroupProposalSampleData.Name, MeetingGroupProposalSampleData.Description, null, null)); }); }
public async Task DisableMeetingCommenting_WhenDataIsValid_IsSuccess() { // Arrange var meetingId = await MeetingHelper.CreateMeetingAsync(MeetingsModule, ExecutionContext); // Act await MeetingsModule.ExecuteCommandAsync(new DisableMeetingCommentingConfigurationCommand(meetingId)); // Assert var meetingConfiguration = await MeetingsModule.ExecuteQueryAsync(new GetMeetingCommentingConfigurationQuery(meetingId)); Assert.NotNull(meetingConfiguration); Assert.False(meetingConfiguration.IsCommentingEnabled); }
public async Task RemoveMeetingComment_ByAuthor_WhenDataIsValid_IsSuccessful() { //Arrange var meetingId = await CreateMeetingAsync(MeetingsModule, ExecutionContext); var meetingCommentId = await MeetingsModule.ExecuteCommandAsync(new AddMeetingCommentCommand(meetingId, "The meeting was great.")); // Act await MeetingsModule.ExecuteCommandAsync(new RemoveMeetingCommentCommand(meetingCommentId, reason : string.Empty)); //Assert var meetingComments = await MeetingsModule.ExecuteQueryAsync(new GetMeetingCommentsQuery(meetingId)); Assert.IsEmpty(meetingComments); }
public async Task GetMeetingGroupProposals_Test() { await MeetingsModule.ExecuteCommandAsync(new ProposeMeetingGroupCommand( "Name 1", "Desc 1", "Warsaw", "PL" )); await MeetingsModule.ExecuteCommandAsync(new ProposeMeetingGroupCommand( "Name 2", "Desc 2", "London", "GB" )); await MeetingsModule.ExecuteCommandAsync(new ProposeMeetingGroupCommand( "Name 3", "Desc 3", "Rome", "IT" )); await MeetingsModule.ExecuteCommandAsync(new ProposeMeetingGroupCommand( "Name 4", "Desc 4", "Madrid", "ES" )); await MeetingsModule.ExecuteCommandAsync(new ProposeMeetingGroupCommand( "Name 5", "Desc 5", "Berlin", "DE" )); var allProposals = await MeetingsModule.ExecuteQueryAsync(new GetMeetingGroupProposalsQuery(null, null)); Assert.That(allProposals.Count, Is.EqualTo(5)); var proposalsPaged = await MeetingsModule.ExecuteQueryAsync(new GetMeetingGroupProposalsQuery(2, 2)); Assert.That(proposalsPaged.Count, Is.EqualTo(2)); Assert.That(proposalsPaged[0].Name, Is.EqualTo("Name 3")); Assert.That(proposalsPaged[1].Name, Is.EqualTo("Name 4")); }
public async Task CreateMeetingGroupScenario_WhenProposalIsAccepted() { var meetingGroupId = await MeetingsModule.ExecuteCommandAsync( new ProposeMeetingGroupCommand("Name", "Description", "Location", "PL")); AssertEventually( new GetMeetingGroupProposalFromAdministrationProbe(meetingGroupId, AdministrationModule), 10000); await AdministrationModule.ExecuteCommandAsync(new AcceptMeetingGroupProposalCommand(meetingGroupId)); AssertEventually( new GetCreatedMeetingGroupFromMeetingsProbe(meetingGroupId, MeetingsModule), 15000); }
public async Task GetMeetingComments_Test() { // Arrange var meetingId = await MeetingHelper.CreateMeetingAsync(MeetingsModule, ExecutionContext); await MeetingsModule.ExecuteCommandAsync( new AddMeetingCommentCommand(meetingId, "The meeting was great.")); await MeetingsModule.ExecuteCommandAsync( new AddMeetingCommentCommand(meetingId, "The meeting was wonderful.")); await MeetingsModule.ExecuteCommandAsync( new AddMeetingCommentCommand(meetingId, "The meeting was amazing.")); // Act var meetingComments = await MeetingsModule.ExecuteQueryAsync(new GetMeetingCommentsQuery(meetingId)); // Assert Assert.That(meetingComments.Count, Is.EqualTo(3)); }
public async Task ProposeAndAcceptMeetingGroup_WhenDataIsValid_IsSuccessful() { var proposalId = await MeetingsModule.ExecuteCommandAsync(new ProposeMeetingGroupCommand( MeetingGroupProposalSampleData.Name, MeetingGroupProposalSampleData.Description, MeetingGroupProposalSampleData.LocationCity, MeetingGroupProposalSampleData.LocationCountryCode )); await MeetingsModule.ExecuteCommandAsync(new AcceptMeetingGroupProposalCommand(Guid.NewGuid(), proposalId)); var meetingGroupProposal = await MeetingsModule.ExecuteQueryAsync(new GetMeetingGroupProposalQuery(proposalId)); Assert.That(meetingGroupProposal.Id, Is.EqualTo(proposalId)); Assert.That(meetingGroupProposal.Name, Is.EqualTo(MeetingGroupProposalSampleData.Name)); Assert.That(meetingGroupProposal.Description, Is.EqualTo(MeetingGroupProposalSampleData.Description)); Assert.That(meetingGroupProposal.LocationCity, Is.EqualTo(MeetingGroupProposalSampleData.LocationCity)); Assert.That(meetingGroupProposal.LocationCountryCode, Is.EqualTo(MeetingGroupProposalSampleData.LocationCountryCode)); Assert.That(meetingGroupProposal.StatusCode, Is.EqualTo("Accepted")); }