Exemple #1
0
        public void ShouldSendModifiedRoatpProviderEvent()
        {
            var roatpNextDocument = new RoatpProviderDocument()
            {
                Ukprn = "12345",
                ContractedForNonLeviedEmployers    = true,
                CurrentlyNotStartingNewApprentices = true,
                StartDate = DateTime.Now.AddYears(-2),
                EndDate   = null,
                Name      = "Test Provider",
                NewOrganisationWithoutFinancialTrackRecord = false,
                ParentCompanyGuarantee = true,
                ProviderType           = Sfa.Roatp.Indexer.Core.Models.ProviderType.MainProvider
            };
            var roatpLastDocument = new RoatpProviderDocument()
            {
                Ukprn = "12345",
                ContractedForNonLeviedEmployers    = false,
                CurrentlyNotStartingNewApprentices = false,
                StartDate = DateTime.Now.AddYears(-2),
                EndDate   = null,
                Name      = "Test Provider",
                NewOrganisationWithoutFinancialTrackRecord = false,
                ParentCompanyGuarantee = true,
                ProviderType           = Sfa.Roatp.Indexer.Core.Models.ProviderType.MainProvider
            };

            var message = new RoatpProviderUpdated()
            {
                MessageType  = MessageType.Modified,
                Ukprn        = roatpNextDocument.Ukprn,
                Name         = roatpNextDocument.Name,
                StartDate    = roatpNextDocument.StartDate,
                EndDate      = roatpNextDocument.EndDate,
                ProviderType = (ProviderType)(int)roatpNextDocument.ProviderType,
                ContractedForNonLeviedEmployers            = roatpNextDocument.ContractedForNonLeviedEmployers,
                CurrentlyNotStartingNewApprentices         = roatpNextDocument.CurrentlyNotStartingNewApprentices,
                NewOrganisationWithoutFinancialTrackRecord = roatpNextDocument.NewOrganisationWithoutFinancialTrackRecord,
                ParentCompanyGuarantee = roatpNextDocument.ParentCompanyGuarantee,
                RequiresAgreement      = roatpNextDocument.RequiresAgreement
            };

            _sut.ProcessChangedProviderEvents(roatpNextDocument, roatpLastDocument);

            _messageSession.PublishedMessages.Count().Should().Be(1);
            _messageSession.PublishedMessages.FirstOrDefault()?.Message.Should().BeEquivalentTo(message);
        }
Exemple #2
0
        private async void PublishRoatpProviderMessage(RoatpProviderDocument doc, MessageType messageType)
        {
            var roatpProviderMessage = new RoatpProviderUpdated()
            {
                MessageType = messageType,
                Ukprn       = doc.Ukprn,
                Name        = doc.Name,
                StartDate   = doc.StartDate,
                EndDate     = doc.EndDate,
                ApplicationDeterminedDate = doc.ApplicationDeterminedDate,
                ProviderType = (ProviderType)(int)doc.ProviderType,
                ContractedForNonLeviedEmployers            = doc.ContractedForNonLeviedEmployers,
                CurrentlyNotStartingNewApprentices         = doc.CurrentlyNotStartingNewApprentices,
                NewOrganisationWithoutFinancialTrackRecord = doc.NewOrganisationWithoutFinancialTrackRecord,
                ParentCompanyGuarantee = doc.ParentCompanyGuarantee,
                RequiresAgreement      = doc.RequiresAgreement
            };

            _log.Info("Sending Roatp Provider Message", new Dictionary <string, object> {
                { "Ukprn", roatpProviderMessage.Ukprn }, { "Message Type", roatpProviderMessage.MessageType }
            });
            await _eventPublisher.Publish(roatpProviderMessage).ConfigureAwait(false);
        }