public CountryDbTests() { var options = new DbContextOptionsBuilder <SentryDbContext>().UseInMemoryDatabase("TestDb").Options; db = new SentryDbContext(options); repository = new CountryObjectsRepository(db); }
public static void Initialize(SentryDbContext c) { c.Database.EnsureCreated(); if (c.CountryCurrencies.Any()) { return; } var regions = SystemRegionInfo.GetRegionsList(); foreach (var r in regions) { if (!SystemRegionInfo.IsCountry(r)) { continue; } var x = new CountryCurrencyDbRecord(); x.CountryID = r.ThreeLetterISORegionName; x.CurrencyID = r.ISOCurrencySymbol; c.CountryCurrencies.Add(x); } c.SaveChanges(); }
public static void Initialize(SentryDbContext c) { c.Database.EnsureCreated(); if (c.PersonMedicines.Any()) { return; } c.SaveChanges(); /*foreach (var a in c.Persons) * { * foreach (var p in c.Medicines) * { * var x = new PersonMedicineDbRecord() * { * MedicineID = p.ID, * PersonID = a.ID * }; * c.PersonMedicines.Add(x); * } * } * * c.SaveChanges();*/ }
private static void initializeCustomers(SentryDbContext c) { add(c, new CustomersData() { Name = "Gunnar Piho" }); }
public static void Initialize(SentryDbContext c) { c.Database.EnsureCreated(); if (c.Currencies.Any()) { return; } var list = new List <string>(); var regions = SystemRegionInfo.GetRegionsList(); foreach (var r in regions) { if (!SystemRegionInfo.IsCountry(r)) { continue; } if (list.Contains(r.ISOCurrencySymbol)) { continue; } var e = CurrencyObjectFactory.Create(r); c.Currencies.Add(e.DbRecord); list.Add(r.ISOCurrencySymbol); } c.SaveChanges(); }
private static List <string> initTelecomAddresses(SentryDbContext c) { var l = new List <string> { add(c, new TelecomAddressDbRecord { Address = "22222222", CityOrAreaCode = "51", RegionOrStateOrCountryCode = "372", Device = TelecomDevice.Mobile }), add(c, new TelecomAddressDbRecord { Address = "11111111", CityOrAreaCode = "52", RegionOrStateOrCountryCode = "372", Device = TelecomDevice.Mobile }), add(c, new TelecomAddressDbRecord { Address = "33333333", CityOrAreaCode = "60", RegionOrStateOrCountryCode = "372", Device = TelecomDevice.Phone }), add(c, new TelecomAddressDbRecord { Address = "44444444", CityOrAreaCode = "61", RegionOrStateOrCountryCode = "372", Device = TelecomDevice.Fax }) }; return(l); }
private static List <string> initGeographicAddresses(SentryDbContext c) { var l = new List <string> { add(c, new GeographicAddressDbRecord { Address = "Akadeemia tee 15A", CityOrAreaCode = "Tallinn", RegionOrStateOrCountryCode = "Harjumaa", CountryID = "EST", ZipOrPostCodeOrExtension = "12618" }), add(c, new GeographicAddressDbRecord { Address = "Raja 4C", CityOrAreaCode = "Tallinn", RegionOrStateOrCountryCode = "Harjumaa", CountryID = "EST", ZipOrPostCodeOrExtension = "12616" }), add(c, new GeographicAddressDbRecord { Address = "Ehitajate tee 5", CityOrAreaCode = "Tallinn", RegionOrStateOrCountryCode = "Harjumaa", CountryID = "EST", ZipOrPostCodeOrExtension = "12618" }) }; add(c, new GeographicAddressDbRecord { Address = "4 Privet Drive", CityOrAreaCode = "Little Whinging", RegionOrStateOrCountryCode = "Surrey", CountryID = "GBR", ZipOrPostCodeOrExtension = "BS13 9RN" }); return(l); }
private void initTestDatabase() { var scope = server.Host.Services.CreateScope(); var services = scope.ServiceProvider; db = services.GetService <SentryDbContext>(); DbInitializer.Initialize(db); }
public void CreateTelecomAddressRegistrationTableTest() { var set = new ConventionSet(); var mb = new ModelBuilder(set); SentryDbContext.createTelecomAddressRegistrationTable(mb); testHasTelecomRegistrationEntities(mb); }
public void CreateAddressTableTest() { var set = new ConventionSet(); var mb = new ModelBuilder(set); SentryDbContext.createAddressTable(mb); testHasAddressEntities(mb); }
public void CreateCountryCurrencyTableTest() { var set = new ConventionSet(); var mb = new ModelBuilder(set); SentryDbContext.createCountryCurrencyTable(mb); testHasCountryCurrencyEntities(mb); }
public void CreateProductCatalogueTableTest() { var set = new ConventionSet(); var mb = new ModelBuilder(set); SentryDbContext.CreateProductCatalogueTable(mb); testHasProductCatalogueEntities(mb); }
public void CreateMedicineRepresentorsTableTest() { var set = new ConventionSet(); var mb = new ModelBuilder(set); SentryDbContext.CreateMedicineRepresentorsTable(mb); testHasMedicineRepresentorsEntities(mb); }
public void CreatePersonMedicinesTableTest() { var set = new ConventionSet(); var mb = new ModelBuilder(set); SentryDbContext.CreatePersonMedicinesTable(mb); testHasPersonMedicinesEntities(mb); }
public static void Initialize(SentryDbContext c) { c.Database.EnsureCreated(); if (c.Dosages.Any()) { return; } c.SaveChanges(); }
public static void Initialize(SentryDbContext c) { c.Database.EnsureCreated(); if (c.Effects.Any()) { return; } //initEffects(c); c.SaveChanges(); }
public static void Initialize(SentryDbContext c) { c.Database.EnsureCreated(); if (c.Persons.Any()) { return; } initPersons(c); c.SaveChanges(); }
public TelecomDeviceRegistrationDbTests() { if (db != null) { return; } var options = new DbContextOptionsBuilder <SentryDbContext>().UseInMemoryDatabase("TelecomDbTests").Options; db = new SentryDbContext(options); repository = new TelecomDeviceRegistrationObjectsRepository(db); }
public CountryDbTests() { if (db != null) { return; } var options = new DbContextOptionsBuilder <SentryDbContext>().UseInMemoryDatabase("CountryDbTests").Options; db = new SentryDbContext(options); repository = new CountryObjectsRepository(db); }
private static List <string> initEffects(SentryDbContext c) { var l = new List <string> { add(c, new EffectDbRecord { Name = "morfiin" }) }; return(l); }
private static void initCashPayments(SentryDbContext c) { add(c, new CashDbRecord { Amount = "50", Currency = "EUR", Memo = "Eilse eest", Payer = "Mina", PayerAccountNumber = "EE8023749234973254", Payee = "Sina", PayeeAccountNumber = "EE8023745423954328" }); }
private static void initCheckPayments(SentryDbContext c) { add(c, new CheckDbRecord { Amount = "10", Currency = "USD", Memo = "Toit", Payer = "Peeter", PayerAccountNumber = "EE8023749234973254", Payee = "TTÜ raamatukogu", PayeeAccountNumber = "EE0409238075209842" }); }
public static void Initialize(SentryDbContext c) { c.Database.EnsureCreated(); if (c.Payments.Any()) { return; } initCashPayments(c); initCheckPayments(c); initCreditPayments(c); initDebitPayments(c); c.SaveChanges(); }
public static void Initialize(SentryDbContext c) { c.Database.EnsureCreated(); if (c.Addresses.Any()) { return; } initWebPageAddresses(c); initEmailAddresses(c); var geographicIDs = initGeographicAddresses(c); var telecomIDs = initTelecomAddresses(c); initTelecomRegistrations(c, geographicIDs, telecomIDs); c.SaveChanges(); }
private static void initWebPageAddresses(SentryDbContext c) { add(c, new WebPageAddressDbRecord { Address = "www.visualstudio.com" }); add(c, new WebPageAddressDbRecord { Address = "www.jetbrains.com" }); add(c, new WebPageAddressDbRecord { Address = "www.wikipedia.org" }); add(c, new WebPageAddressDbRecord { Address = "www.amazon.com" }); }
private static void initEmailAddresses(SentryDbContext c) { add(c, new EmailAddressDbRecord { Address = "*****@*****.**" }); add(c, new EmailAddressDbRecord { Address = "*****@*****.**" }); add(c, new EmailAddressDbRecord { Address = "*****@*****.**" }); add(c, new EmailAddressDbRecord { Address = "*****@*****.**" }); }
private static void initTelecomRegistrations(SentryDbContext c, List <string> geographicIDs, List <string> telecomIDs) { foreach (var a in geographicIDs) { foreach (var d in telecomIDs) { if (GetRandom.Bool()) { continue; } c.TelecomDeviceRegistrations.Add(new TelecomDeviceRegistrationDbRecord { AddressID = a, DeviceID = d }); } } }
private static void initDebitPayments(SentryDbContext c) { add(c, new DebitCardDbRecord { Amount = "3.70", Currency = "EUR", Memo = "Smuuti Blendrerist", Payer = "Pets", PayerAccountNumber = "EE3840238402750273", Payee = "Blender OÜ", PayeeAccountNumber = "EE3840223422750273", CardAssociationName = "MasterCard", DailyWithDrawalLimit = "500", CardNumber = "5341963232324091" }); }
private static void initCreditPayments(SentryDbContext c) { add(c, new CreditCardDbRecord { Amount = "10", Currency = "USD", Memo = "Lilled Liisule", Payer = "Juku", PayerAccountNumber = "EE0409238075209842", Payee = "Mari Lilled OÜ", PayeeAccountNumber = "EE3840238402750273", CardAssociationName = "MasterCard", CardNumber = "5341963232324091", DailyWithDrawalLimit = "500", CreditLimit = "534196" }); }
private static void initMedicineEffects(SentryDbContext c, List <string> medicineIDs, List <string> effectIDs) { foreach (var a in medicineIDs) { foreach (var d in effectIDs) { if (GetRandom.Bool()) { continue; } c.MedicineEffects.Add( new MedicineEffectsDbRecord() { EffectID = a, MedicineID = d }); } } }