示例#1
0
        public void SetUp()
        {
            var config = new ConfigurationBuilder()
                         .AddJsonFile("appsettings.json")
                         .Build();

            string connectionString = string.Empty;

            connectionString = config["connectionStrings:livehAPIConnection"];

            var options = new DbContextOptionsBuilder <LiveHAPIContext>()
                          .UseSqlServer(connectionString)
                          .Options;

            _context = new LiveHAPIContext(options);

            _clientPretestStageRepository = new ClientPretestStageRepository(_context);
            _clientEncounterRepository    = new ClientEncounterRepository(_context);
            _subscriberSystemRepository   = new SubscriberSystemRepository(_context);
            _practiceRepository           = new PracticeRepository(_context);
            _clientStageRepository        = new ClientStageRepository(_context);
            _contactsEncounterRepository  = new ContactsEncounterRepository(_context);


            _clientMessageLoader =
                new FamilyClientMessageLoader(

                    _practiceRepository, _clientStageRepository, new ClientStageRelationshipRepository(_context),
                    new ClientFamilyScreeningStageExtractor(_contactsEncounterRepository, _subscriberSystemRepository),
                    new ClientFamilyTracingStageExtractor(_contactsEncounterRepository, _subscriberSystemRepository));

            _clientMessageWriter =
                new FamilyWriter(new RestClient(_baseUrl), _clientMessageLoader, _clientStageRepository);
        }
示例#2
0
 public LegacySyncClientsService(IIndexClientMessageWriter clientMessageWriter, IPartnerClientMessageWriter partnerClientMessageWriter, IFamilyClientMessageWriter familyClientMessageWriter, IDemographicsWriter demographicsWriter, IPartnerWriter partnerWriter, IFamilyWriter familyWriter)
 {
     _clientMessageWriter        = clientMessageWriter;
     _partnerClientMessageWriter = partnerClientMessageWriter;
     _familyClientMessageWriter  = familyClientMessageWriter;
     _demographicsWriter         = demographicsWriter;
     _partnerWriter = partnerWriter;
     _familyWriter  = familyWriter;
 }
        public void SetUp()
        {
            var config = new ConfigurationBuilder()
                         .AddJsonFile("appsettings.json")
                         .Build();
            //var connectionString = config["connectionStrings:hAPIConnection"].Replace("#dir#", TestContext.CurrentContext.TestDirectory.HasToEndWith(@"\"));
            var connectionString = config["connectionStrings:livehAPIConnection"];

            var options = new DbContextOptionsBuilder <LiveHAPIContext>()
                          .UseSqlServer(connectionString)
                          .Options;

            _reader  = new ClientUserReader(new RestClient(_baseUrl));
            _context = new LiveHAPIContext(options);

            var clientPretestStageRepository = new ClientPretestStageRepository(_context);
            var clientEncounterRepository    = new ClientEncounterRepository(_context);
            var subscriberSystemRepository   = new SubscriberSystemRepository(_context);
            var practiceRepository           = new PracticeRepository(_context);
            var clientStageRepository        = new ClientStageRepository(_context);

            var clientStageExtractor        = new ClientStageExtractor(new PersonRepository(_context), clientStageRepository, subscriberSystemRepository, new ClientRepository(_context), new PracticeRepository(_context));
            var clientPretestStageExtractor = new ClientPretestStageExtractor(clientStageRepository, clientPretestStageRepository, subscriberSystemRepository, clientEncounterRepository, new ClientRepository(_context));
            var contactsEncounterRepository = new ContactsEncounterRepository(_context);

            var clientMessageLoader =
                new IndexClientMessageLoader(practiceRepository, clientStageRepository, clientPretestStageRepository,
                                             new ClientTestingStageExtractor(clientEncounterRepository, subscriberSystemRepository),
                                             new ClientFinalTestStageExtractor(clientEncounterRepository, subscriberSystemRepository),
                                             new ClientReferralStageExtractor(clientEncounterRepository, subscriberSystemRepository),
                                             new ClientTracingStageExtractor(clientEncounterRepository, subscriberSystemRepository),
                                             new ClientLinkageStageExtractor(clientEncounterRepository, subscriberSystemRepository)

                                             );


            var clientMessageWriter =
                new IndexClientMessageWriter(new RestClient(_baseUrl), clientMessageLoader, clientStageRepository);

            var demographicsWriter =
                new DemographicsWriter(new RestClient(_baseUrl), clientMessageLoader, clientStageRepository);

            var cclientMessageLoader =
                new FamilyClientMessageLoader(

                    practiceRepository, clientStageRepository, new ClientStageRelationshipRepository(_context),
                    new ClientFamilyScreeningStageExtractor(contactsEncounterRepository, subscriberSystemRepository),
                    new ClientFamilyTracingStageExtractor(contactsEncounterRepository, subscriberSystemRepository));

            var cclientMessageWriter =
                new FamilyClientMessageWriter(new RestClient(_baseUrl), cclientMessageLoader, clientStageRepository);

            var ccclientMessageLoader =
                new PartnerClientMessageLoader(
                    practiceRepository, clientStageRepository, new ClientStageRelationshipRepository(_context),
                    new ClientPartnerScreeningStageExtractor(contactsEncounterRepository, subscriberSystemRepository),
                    new ClientPartnerTracingStageExtractor(contactsEncounterRepository, subscriberSystemRepository));

            var ccclientMessageWriter =
                new PartnerClientMessageWriter(new RestClient(_baseUrl), ccclientMessageLoader, clientStageRepository);

            _partnerMessageWriter =
                new PartnerWriter(new RestClient(_baseUrl), ccclientMessageLoader, clientStageRepository);

            _familyMessageWriter =
                new FamilyWriter(new RestClient(_baseUrl), cclientMessageLoader, clientStageRepository);

            _service = new SyncClientsService(clientMessageWriter, ccclientMessageWriter, cclientMessageWriter, demographicsWriter, _partnerMessageWriter, _familyMessageWriter);
        }