public OutboundSynchronisationService(ILogger logger,
                                              IOutboundSynchronisationDataService outboundSynchronisationService,
                                              IJwtService jwtService,
                                              IRequestPayloadCreator createRequestPayloadCreator,
                                              IRequestPayloadCreator updateRequestPayloadCreator,
                                              IOutboundSyncConfigurationService configurationService,
                                              IEntityModelDeserializer entityModelDeserializer)
        {
            this.outboundSynchronisationDataService = outboundSynchronisationService;
            this.logger                      = logger;
            this.jwtService                  = jwtService;
            this.configurationService        = configurationService;
            this.createRequestPayloadCreator = createRequestPayloadCreator;
            this.updateRequestPayloadCreator = updateRequestPayloadCreator;
            this.entityModelDeserializer     = entityModelDeserializer;

            RetrySchedule = outboundSynchronisationDataService.GetRetries();
            MaxRetries    = RetrySchedule.Length;
        }
Пример #2
0
        public void TestInitialize()
        {
            logger     = A.Fake <ILogger>();
            jwtService = A.Fake <IJwtService>();
            outboundSynchDataService         = A.Fake <IOutboundSynchronisationDataService>();
            createRequestPayloadCreator      = A.Fake <IRequestPayloadCreator>();
            updateRequestPayloadCreator      = A.Fake <IRequestPayloadCreator>();
            outboundSyncConfigurationService = A.Fake <IOutboundSyncConfigurationService>();
            entityModelDeserializer          = A.Fake <IEntityModelDeserializer>();

            A.CallTo(() => outboundSyncConfigurationService.BatchSize).Returns(batchSize);
            A.CallTo(() => outboundSyncConfigurationService.EntityName).Returns(entityName);
            A.CallTo(() => outboundSynchDataService.GetSecretKey()).Returns(secretKey);
            A.CallTo(() => outboundSynchDataService.GetRetries()).Returns(retries);
            A.CallTo(() => outboundSyncConfigurationService.CreateServiceUrl).Returns(createServiceUrl);
            A.CallTo(() => outboundSyncConfigurationService.UpdateServiceUrl).Returns(updateServiceUrl);
            A.CallTo(() => entityModelDeserializer.Deserialize(A <string> ._)).Returns(
                new Crm.Common.IntegrationLayer.Model.EntityModel
            {
                Fields = new List <Crm.Common.IntegrationLayer.Model.Field>
                {
                    new Crm.Common.IntegrationLayer.Model.Field
                    {
                        Name  = Tc.Crm.Common.Constants.Attributes.Customer.FirstName,
                        Type  = Crm.Common.IntegrationLayer.Model.FieldType.String,
                        Value = "Name"
                    }
                }
            });

            outboundSynchService = new OutboundSynchronisationService(
                logger,
                outboundSynchDataService,
                jwtService,
                createRequestPayloadCreator,
                updateRequestPayloadCreator,
                outboundSyncConfigurationService,
                entityModelDeserializer);
        }