public async Task PublishApprenticeshipPaused_WithPauseDateSet_ShouldNotThrowException() { var fixtures = new V2EventsPublisherTestFixtures <ApprenticeshipStoppedEvent>() .WithPauseDate(); await fixtures.Publish(publisher => publisher.PublishApprenticeshipPaused(fixtures.Commitment, fixtures.Apprenticeship)); }
public async Task PublishApprenticeshipStopDateChangedEvent_WithAStopDate_ShouldNotThrowException() { var fixtures = new V2EventsPublisherTestFixtures <ApprenticeshipStopDateChangedEvent>() .WithStopDate(); await fixtures.PublishApprenticeshipStopDateChanged(); }
public void PublishApprenticeshipCreated_WithoutEndDateSet_ShouldThrowException() { var fixtures = new V2EventsPublisherTestFixtures <ApprenticeshipCreatedEvent>() .WithStartDate(); Assert.ThrowsAsync <InvalidOperationException>(() => fixtures.Publish(publisher => publisher.PublishApprenticeshipCreated(fixtures.ApprenticeshipEvent))); }
public async Task PublishApprenticeshipCreated_WithStartAndEndDateSet_ShouldNotThrowException() { var fixtures = new V2EventsPublisherTestFixtures <ApprenticeshipCreatedEvent>() .WithStartDate() .WithEndDate(); await fixtures.Publish(publisher => publisher.PublishApprenticeshipCreated(fixtures.ApprenticeshipEvent)); }
public async Task RejectTransferRequestCommandSent_ShouldMapPropertiesCorrectly() { var f = new V2EventsPublisherTestFixtures <SFA.DAS.CommitmentsV2.Messages.Commands.RejectTransferRequestCommand>(); await f.CreateV2EventsPublisher().SendRejectTransferRequestCommand(f.TransferRequestId, f.Now, f.UserInfo); f.VerfiyRejectTransferRequestCommandWasSent(); }
public void RejectTransferRequestCommandSent_ShouldThrowExceptionAndLogTheError() { var f = new V2EventsPublisherTestFixtures <SFA.DAS.CommitmentsV2.Messages.Commands.RejectTransferRequestCommand>().ThrowsExceptionWhenCallingSend(); Assert.CatchAsync <Exception>(() => f.CreateV2EventsPublisher().SendRejectTransferRequestCommand(1, f.Now, f.UserInfo)); f.VerfiyErrorwasLogged(); }
public async Task PublishProviderRejectedChangeOfPartyCohort_ShouldNotThrowException() { var fixtures = new V2EventsPublisherTestFixtures <BulkUploadIntoCohortCompletedEvent>(); await fixtures.Publish(publisher => publisher.PublishBulkUploadIntoCohortCompleted(fixtures.Commitment.ProviderId.Value, fixtures.Commitment.Id, 2)); Assert.Pass(); }
public async Task PublishApprenticeshipUlnUpdatedEvent_WithouitImmediateUpdate_ShouldNotPublishEvent() { var fixtures = new V2EventsPublisherTestFixtures <ApprenticeshipUlnUpdatedEvent>() .WithoutApprenticeshipImmediateUpdate(); await fixtures.Publish(publisher => publisher.PublishApprenticeshipUlnUpdatedEvent(fixtures.Apprenticeship)); fixtures.EndpointInstanceMock.Verify(x => x.Publish(It.IsAny <ApprenticeshipUlnUpdatedEvent>(), It.IsAny <PublishOptions>()), Times.Never); }
public async Task PublishApprenticeshipUlnUpdatedEvent_ImmediateUpdate_ShouldPublishEvent() { var fixtures = new V2EventsPublisherTestFixtures <ApprenticeshipUlnUpdatedEvent>() .WithApprenticeshipImmediateUpdate(); await fixtures.Publish(publisher => publisher.PublishApprenticeshipUlnUpdatedEvent(fixtures.Apprenticeship)); fixtures.EndpointInstanceMock.Verify(x => x.Publish(It.Is <ApprenticeshipUlnUpdatedEvent>(c => c.ApprenticeshipId == fixtures.Apprenticeship.Id && c.Uln == fixtures.Apprenticeship.ULN), It.IsAny <PublishOptions>())); }
public async Task PublishApprenticeshipCreated_WithoutATransferSender_ShouldSetAgreedOnSameAsCreatedOn() { var fixtures = new V2EventsPublisherTestFixtures <ApprenticeshipCreatedEvent>() .WithStartDate() .WithEndDate(); await fixtures.Publish(publisher => publisher.PublishApprenticeshipCreated(fixtures.ApprenticeshipEvent)); fixtures.EndpointInstanceMock.Verify(x => x.Publish(It.Is <ApprenticeshipCreatedEvent>(p => p.AgreedOn == p.CreatedOn), It.IsAny <PublishOptions>())); }
public async Task PublishCohortWithChangeOfPartyUpdatedEvent_ShouldPublishEvent() { var fixtures = new V2EventsPublisherTestFixtures <CohortWithChangeOfPartyUpdatedEvent>() .WithChangeOfPartyRequest(); await fixtures.Publish(publisher => publisher.PublishCohortWithChangeOfPartyUpdatedEvent(fixtures.Commitment.Id, fixtures.UserInfo)); fixtures.EndpointInstanceMock.Verify(x => x.Publish(It.Is <CohortWithChangeOfPartyUpdatedEvent>(c => c.CohortId == fixtures.Commitment.Id && c.UserInfo == fixtures.UserInfo), It.IsAny <PublishOptions>())); }
public async Task PublishBulkUploadIntoCohortCreatedEvent_ShouldPublishEventWithMappedValues() { var fixtures = new V2EventsPublisherTestFixtures <BulkUploadIntoCohortCompletedEvent>(); var providerId = fixtures.Commitment.ProviderId.Value; var cohortId = fixtures.Commitment.Id; uint count = 2; await fixtures.Publish(publisher => publisher.PublishBulkUploadIntoCohortCompleted(providerId, cohortId, count)); fixtures.EndpointInstanceMock.Verify(x => x.Publish(It.Is <BulkUploadIntoCohortCompletedEvent>(p => p.CohortId == cohortId && p.ProviderId == providerId && p.NumberOfApprentices == count && p.UploadedOn == fixtures.Now), It.IsAny <PublishOptions>())); }
public async Task PublishApprenticeshipCreated_ShouldSetApprenticeshipEmployerTypeOnApproval(ApprenticeshipEmployerType?apprenticeshipEmployerType) { var fixtures = new V2EventsPublisherTestFixtures <ApprenticeshipCreatedEvent>() .WithStartDate() .WithEndDate() .WithApprenticeshipEmployerTypeOnApproval(apprenticeshipEmployerType); await fixtures.Publish(publisher => publisher.PublishApprenticeshipCreated(fixtures.ApprenticeshipEvent)); fixtures.EndpointInstanceMock.Verify(x => x.Publish(It.Is <ApprenticeshipCreatedEvent>(p => p.ApprenticeshipEmployerTypeOnApproval == apprenticeshipEmployerType), It.IsAny <PublishOptions>())); }
public async Task PublishProviderRejectedChangeOfPartyCohort_ShouldPublishEventWithMappedValues() { var fixtures = new V2EventsPublisherTestFixtures <ProviderRejectedChangeOfPartyRequestEvent>() .WithChangeOfPartyRequest(); var apprenticeship = fixtures.Commitment.Apprenticeships.FirstOrDefault(); var employerAccountId = fixtures.Commitment.EmployerAccountId; var employerName = fixtures.Commitment.LegalEntityName; var trainingProvider = fixtures.Commitment.ProviderName; var changeOfPartyRequestId = fixtures.Commitment.ChangeOfPartyRequestId; var apprenticeName = $"{apprenticeship.FirstName} {apprenticeship.LastName}"; var recipientEmail = fixtures.Commitment.LastUpdatedByEmployerEmail; await fixtures.Publish(publisher => publisher.PublishProviderRejectedChangeOfPartyCohort(fixtures.Commitment)); fixtures.EndpointInstanceMock.Verify(x => x.Publish(It.Is <ProviderRejectedChangeOfPartyRequestEvent>(p => p.EmployerAccountId == employerAccountId && p.EmployerName == employerName && p.TrainingProviderName == trainingProvider && p.ChangeOfPartyRequestId == changeOfPartyRequestId && p.ApprenticeName == apprenticeName && p.RecipientEmailAddress == recipientEmail), It.IsAny <PublishOptions>())); }
public void PublishApprenticeshipCreated_WithoutPauseDateSet_ShouldThrowException() { var fixtures = new V2EventsPublisherTestFixtures <ApprenticeshipStoppedEvent>(); Assert.ThrowsAsync <InvalidOperationException>(() => fixtures.Publish(publisher => publisher.PublishApprenticeshipPaused(fixtures.Commitment, fixtures.Apprenticeship))); }
public void Constructor_Valid_ShouldNotThrowException() { var fixtures = new V2EventsPublisherTestFixtures <object>(); var publisher = fixtures.CreateV2EventsPublisher(); }
public async Task PublishPaymentOrderChanged_ShouldNotThrowException() { var fixtures = new V2EventsPublisherTestFixtures <ApprenticeshipResumedEvent>(); await fixtures.Publish(publisher => publisher.PublishPaymentOrderChanged(100, fixtures.PaymentOrder)); }
public void PublishPaymentOrderChanged_WithZeroEmployerAccountId_ShouldThrowException() { var fixtures = new V2EventsPublisherTestFixtures <ApprenticeshipStoppedEvent>(); Assert.ThrowsAsync <InvalidOperationException>(() => fixtures.Publish(publisher => publisher.PublishPaymentOrderChanged(0, fixtures.PaymentOrder))); }
public void PublishPaymentOrderChanged_WithNullList_ShouldThrowException() { var fixtures = new V2EventsPublisherTestFixtures <ApprenticeshipStoppedEvent>(); Assert.ThrowsAsync <InvalidOperationException>(() => fixtures.Publish(publisher => publisher.PublishPaymentOrderChanged(100, null))); }
public async Task PublishApprenticeshipDeleted_NoDatesSet_ShouldNotThrowException() { var fixtures = new V2EventsPublisherTestFixtures <DraftApprenticeshipDeletedEvent>(); await fixtures.Publish(publisher => publisher.PublishApprenticeshipDeleted(fixtures.Commitment, fixtures.Apprenticeship)); }
public void PublishApprenticeshipStopDateChangedEvent_WithoutStopDateSet_ShouldThrowException() { var fixtures = new V2EventsPublisherTestFixtures <ApprenticeshipStopDateChangedEvent>(); Assert.ThrowsAsync <InvalidOperationException>(() => fixtures.PublishApprenticeshipStopDateChanged()); }
public async Task PublishApprenticeshipResumed_ShouldNotThrowException() { var fixtures = new V2EventsPublisherTestFixtures <ApprenticeshipResumedEvent>(); await fixtures.Publish(publisher => publisher.PublishApprenticeshipResumed(fixtures.Commitment, fixtures.Apprenticeship)); }