public void Init() { var config = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .Build(); var connectionString = config["ConnectionStrings:DwapiConnectionDev"]; _serviceProvider = new ServiceCollection() .AddDbContext <CbsContext>(o => o.UseSqlServer(connectionString)) .AddScoped <IFacilityRepository, FacilityRepository>() .AddScoped <IMasterFacilityRepository, MasterFacilityRepository>() .AddScoped <IMasterPatientIndexRepository, MasterPatientIndexRepository>() .AddScoped <IManifestRepository, ManifestRepository>() .AddScoped <IMpiService, MpiService>() .AddScoped <IManifestService, ManifestService>() .AddMediatR(typeof(ValidateFacilityHandler)) .BuildServiceProvider(); _context = _serviceProvider.GetService <CbsContext>(); _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); }
public void Init() { var config = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .Build(); var connectionString = config["ConnectionStrings:DwapiConnectionDev"]; _serviceProvider = new ServiceCollection() .AddDbContext <CbsContext>(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 <CbsContext>(); _context.Database.EnsureDeleted(); _context.Database.EnsureCreated(); _context.MasterFacilities.AddRange(TestDataFactory.TestMasterFacilities()); _context.Facilities.AddRange(_facilities); _context.Manifests.AddRange(_manifests); _context.SaveChanges(); }
public void Init() { _serviceProvider = new ServiceCollection() .AddDbContext <CbsContext>(o => o.UseInMemoryDatabase(Guid.NewGuid().ToString())) .AddScoped <IMasterFacilityRepository, MasterFacilityRepository>() .AddScoped <IFacilityRepository, FacilityRepository>() .AddMediatR(typeof(ValidateFacilityHandler)) .BuildServiceProvider(); _context = _serviceProvider.GetService <CbsContext>(); _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(); }
public MasterFacilityRepository(CbsContext context) : base(context) { }
public DocketRepository(CbsContext context) : base(context) { }
public MasterPatientIndexRepository(CbsContext context) : base(context) { }
public ManifestRepository(CbsContext context) : base(context) { }