public async Task BeforeEachTest() { const string connectionStringEnvironmentVariable = "ASPNETCORE_MyMeetings_IntegrationTests_ConnectionString"; ConnectionString = EnvironmentVariablesProvider.GetVariable(connectionStringEnvironmentVariable); if (ConnectionString == null) { throw new ApplicationException( $"Define connection string to integration tests database using environment variable: {connectionStringEnvironmentVariable}"); } using (var sqlConnection = new SqlConnection(ConnectionString)) { await ClearDatabase(sqlConnection); } Logger = Substitute.For <ILogger>(); EmailSender = Substitute.For <IEmailSender>(); ExecutionContext = new ExecutionContextMock(Guid.NewGuid()); AdministrationStartup.Initialize( ConnectionString, ExecutionContext, Logger, null); AdministrationModule = new AdministrationModule(); }
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 AcceptMeetingGroupProposal_ProposalIsAlreadyAccepted_BreaksMeetingGroupProposalCanBeVerifiedOnceRule() { var proposalId = await AdministrationModule.ExecuteCommandAsync(new RequestMeetingGroupProposalVerificationCommand( MeetingGroupProposalSampleData.MeetingGroupProposalId, MeetingGroupProposalSampleData.MeetingGroupProposalId, MeetingGroupProposalSampleData.Name, MeetingGroupProposalSampleData.Description, MeetingGroupProposalSampleData.LocationCity, MeetingGroupProposalSampleData.LocationCountryCode, MeetingGroupProposalSampleData.ProposalUserId, MeetingGroupProposalSampleData.ProposalDate)); await AdministrationModule.ExecuteCommandAsync( new AcceptMeetingGroupProposalCommand(MeetingGroupProposalSampleData.MeetingGroupProposalId)); AssertBrokenRule <MeetingGroupProposalCanBeVerifiedOnceRule>(async() => await AdministrationModule.ExecuteCommandAsync( new AcceptMeetingGroupProposalCommand(MeetingGroupProposalSampleData.MeetingGroupProposalId))); }
public async Task CreateMember_Test() { var memberId = await AdministrationModule.ExecuteCommandAsync(new CreateMemberCommand( Guid.NewGuid(), MemberSampleData.MemberId, MemberSampleData.Login, MemberSampleData.Email, MemberSampleData.FirstName, MemberSampleData.LastName, MemberSampleData.Name)); var member = await AdministrationModule.ExecuteQueryAsync(new GetMemberQuery(memberId)); Assert.That(member.Id, Is.EqualTo(MemberSampleData.MemberId)); Assert.That(member.LastName, Is.EqualTo(MemberSampleData.LastName)); Assert.That(member.Login, Is.EqualTo(MemberSampleData.Login)); Assert.That(member.Email, Is.EqualTo(MemberSampleData.Email)); Assert.That(member.FirstName, Is.EqualTo(MemberSampleData.FirstName)); Assert.That(member.Name, Is.EqualTo(MemberSampleData.Name)); }
public async Task RequestMeetingGroupProposalVerification_Test() { var proposalId = await AdministrationModule.ExecuteCommandAsync(new RequestMeetingGroupProposalVerificationCommand( MeetingGroupProposalSampleData.MeetingGroupProposalId, MeetingGroupProposalSampleData.MeetingGroupProposalId, MeetingGroupProposalSampleData.Name, MeetingGroupProposalSampleData.Description, MeetingGroupProposalSampleData.LocationCity, MeetingGroupProposalSampleData.LocationCountryCode, MeetingGroupProposalSampleData.ProposalUserId, MeetingGroupProposalSampleData.ProposalDate)); var meetingGroupProposal = await AdministrationModule.ExecuteQueryAsync(new GetMeetingGroupProposalQuery(proposalId)); Assert.That(meetingGroupProposal.Id, Is.EqualTo(MeetingGroupProposalSampleData.MeetingGroupProposalId)); Assert.That(meetingGroupProposal.StatusCode, Is.EqualTo(MeetingGroupProposalStatus.ToVerify.Value)); 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.ProposalUserId, Is.EqualTo(MeetingGroupProposalSampleData.ProposalUserId)); Assert.That(meetingGroupProposal.ProposalDate, Is.EqualTo(MeetingGroupProposalSampleData.ProposalDate)); }
public async Task AcceptMeetingGroupProposal_Test() { var proposalId = await AdministrationModule.ExecuteCommandAsync(new RequestMeetingGroupProposalVerificationCommand( MeetingGroupProposalSampleData.MeetingGroupProposalId, MeetingGroupProposalSampleData.MeetingGroupProposalId, MeetingGroupProposalSampleData.Name, MeetingGroupProposalSampleData.Description, MeetingGroupProposalSampleData.LocationCity, MeetingGroupProposalSampleData.LocationCountryCode, MeetingGroupProposalSampleData.ProposalUserId, MeetingGroupProposalSampleData.ProposalDate)); await AdministrationModule.ExecuteCommandAsync( new AcceptMeetingGroupProposalCommand(MeetingGroupProposalSampleData.MeetingGroupProposalId)); var meetingGroupProposal = await AdministrationModule.ExecuteQueryAsync(new GetMeetingGroupProposalQuery(proposalId)); Assert.That(meetingGroupProposal.StatusCode, Is.EqualTo(MeetingGroupProposalStatus.Verified.Value)); Assert.That(meetingGroupProposal.DecisionUserId, Is.EqualTo(ExecutionContext.UserId)); var acceptedNotification = await GetLastOutboxMessage <MeetingGroupProposalAcceptedNotification>(); Assert.That(acceptedNotification.DomainEvent.MeetingGroupProposalId.Value, Is.EqualTo(proposalId)); }