public void Setup()
 {
     this.logger = new TestLogger();
     this.configurationService           = new TestOutboundSyncConfigurationService();
     this.crmService                     = new TestCrmService();
     this.jwtService                     = new TestJwtService();
     this.requestPayloadCreator          = new TestRequestPayloadCreator();
     this.outboundSynchronisationService = new OutboundSynchronisationDataService(this.logger, this.crmService);
 }
 public OutboundSynchronisationService(ILogger logger,
                                       IOutboundSynchronisationDataService outboundSynchronisationService,
                                       IJwtService jwtService,
                                       IRequestPayloadCreator requestPayloadCreator,
                                       IOutboundSyncConfigurationService configurationService)
 {
     this.outboundSynchronisationDataService = outboundSynchronisationService;
     this.logger                = logger;
     this.jwtService            = jwtService;
     this.configurationService  = configurationService;
     this.requestPayloadCreator = requestPayloadCreator;
 }
        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;
        }
Esempio n. 4
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);
        }