public void Init()
        {
            var config = new ConfigurationBuilder()
                         .AddJsonFile("appsettings.json")
                         .Build();
            var connectionString = config["ConnectionStrings:DwapiConnectionDev"];


            _serviceProvider = new ServiceCollection()
                               .AddDbContext <HtsContext>(o => o.UseSqlServer(connectionString))
                               .AddScoped <IFacilityRepository, FacilityRepository>()
                               .AddScoped <IMasterFacilityRepository, MasterFacilityRepository>()
                               .AddScoped <IHtsClientRepository, HtsClientRepository>()
                               .AddScoped <IManifestRepository, ManifestRepository>()
                               .AddScoped <IManifestService, ManifestService>()
                               .AddMediatR(typeof(ValidateFacilityHandler))
                               .BuildServiceProvider();


            _context = _serviceProvider.GetService <HtsContext>();
            _context.Database.EnsureDeleted();
            _context.Database.Migrate();
            _context.MasterFacilities.AddRange(TestDataFactory.TestMasterFacilities());
            var facilities = TestDataFactory.TestFacilities();

            _context.Facilities.AddRange(facilities);
            _context.SaveChanges();
            _context.Clients.AddRange(TestDataFactory.TestMasterPatientIndices(1, facilities.First(x => x.SiteCode == 1).Id));
            _context.Clients.AddRange(TestDataFactory.TestMasterPatientIndices(2, facilities.First(x => x.SiteCode == 2).Id));
            _context.SaveChanges();

            //1,
        }
        public void Init()
        {
            var config = new ConfigurationBuilder()
                         .AddJsonFile("appsettings.json")
                         .Build();
            var connectionString = config["ConnectionStrings:DwapiConnection"];

            _serviceProvider = new ServiceCollection()
                               .AddDbContext <HtsContext>(o => o.UseSqlServer(connectionString))
                               .AddTransient <IManifestRepository, ManifestRepository>()
                               .BuildServiceProvider();

            _facilities = TestDataFactory.TestFacilityWithPatients(2);
            _manifests  = TestDataFactory.TestManifests(2);

            _manifests[0].FacilityId = _facilities[0].Id;
            _manifests[1].FacilityId = _facilities[1].Id;

            _context = _serviceProvider.GetService <HtsContext>();
            _context.Database.EnsureDeleted();
            _context.Database.EnsureCreated();
            _context.MasterFacilities.AddRange(TestDataFactory.TestMasterFacilities());
            _context.Facilities.AddRange(_facilities);
            _context.Manifests.AddRange(_manifests);
            _context.SaveChanges();
        }
Beispiel #3
0
        public void Init()
        {
            _serviceProvider = new ServiceCollection()
                               .AddDbContext <HtsContext>(o => o.UseInMemoryDatabase(Guid.NewGuid().ToString()))
                               .AddScoped <IMasterFacilityRepository, MasterFacilityRepository>()
                               .AddScoped <IFacilityRepository, FacilityRepository>()
                               .AddMediatR(typeof(ValidateFacilityHandler))
                               .BuildServiceProvider();


            _context = _serviceProvider.GetService <HtsContext>();
            _context.MasterFacilities.Add(new MasterFacility(1, "XFacility", "XCounty"));
            _context.MasterFacilities.Add(new MasterFacility(2, "YFacility", "YCounty"));
            _context.Facilities.Add(new Facility(1, "XFacility District", 1));
            _context.SaveChanges();
        }
Beispiel #4
0
        public void Init()
        {
            var config = new ConfigurationBuilder()
                         .AddJsonFile("appsettings.json")
                         .Build();
            var connectionString = config["ConnectionStrings:DwapiConnectionDev"];
            var liveSync         = config["LiveSync"];


            DapperPlusManager.AddLicense("1755;700-ThePalladiumGroup", "2073303b-0cfc-fbb9-d45f-1723bb282a3c");
            if (!Z.Dapper.Plus.DapperPlusManager.ValidateLicense(out var licenseErrorMessage))
            {
                throw new Exception(licenseErrorMessage);
            }


            Uri        endPointA  = new Uri(liveSync); // this is the endpoint HttpClient will hit
            HttpClient httpClient = new HttpClient()
            {
                BaseAddress = endPointA,
            };


            _serviceProvider = new ServiceCollection()
                               .AddDbContext <HtsContext>(o => o.UseSqlServer(connectionString))

                               .AddScoped <IDocketRepository, DocketRepository>()
                               .AddScoped <IMasterFacilityRepository, MasterFacilityRepository>()

                               .AddScoped <IFacilityRepository, FacilityRepository>()
                               .AddScoped <IManifestRepository, ManifestRepository>()
                               .AddScoped <IHtsClientRepository, HtsClientRepository>()
                               .AddScoped <IHtsClientLinkageRepository, HtsClientLinkageRepository>()
                               .AddScoped <IHtsClientPartnerRepository, HtsClientPartnerRepository>()

                               .AddScoped <IFacilityRepository, FacilityRepository>()
                               .AddScoped <IMasterFacilityRepository, MasterFacilityRepository>()
                               .AddScoped <IHtsClientRepository, HtsClientRepository>()
                               .AddScoped <IManifestRepository, ManifestRepository>()

                               .AddScoped <IHtsClientTestsRepository, HtsClientTestsRepository>()
                               .AddScoped <IHtsClientTracingRepository, HtsClientTracingRepository>()
                               .AddScoped <IHtsPartnerTracingRepository, HtsPartnerTracingRepository>()
                               .AddScoped <IHtsPartnerNotificationServicesRepository, HtsPartnerNotificationServicesRepository>()
                               .AddScoped <IHtsClientLinkageRepository, HtsClientLinkageRepository>()
                               .AddScoped <IHtsHtsTestKitsRepository, HtsHtsTestKitsRepository>()

                               .AddScoped <IHtsService, HtsService>()
                               .AddScoped <ILiveSyncService, LiveSyncService>()
                               .AddScoped <IManifestService, ManifestService>()
                               .AddSingleton <HttpClient>(httpClient)
                               .AddMediatR(typeof(ValidateFacilityHandler))
                               .BuildServiceProvider();


            _context = _serviceProvider.GetService <HtsContext>();
            _context.Database.EnsureDeleted();
            _context.Database.Migrate();
            _context.MasterFacilities.AddRange(TestDataFactory.TestMasterFacilities());
            var facilities = TestDataFactory.TestFacilities();

            _context.Facilities.AddRange(facilities);
            _context.SaveChanges();
            _patientIndices      = TestDataFactory.TestMasterPatientIndices(1, facilities.First(x => x.SiteCode == 1).Id);
            _patientIndicesSiteB =
                TestDataFactory.TestMasterPatientIndices(2, facilities.First(x => x.SiteCode == 2).Id);
        }