public void Init() { using (var uow = new DatabaseContext(Config)) { uow.DropSchema(); uow.CreateSchema(); } }
public static void TestInit(TestContext tstContext) { Configuration = Fluently.Configure().Database(MsSqliteConfiguration.Standard.ConnectionString("Data Source=:memory:;cache=shared;mode=memory")).Mappings( o => o.FluentMappings .AddFromAssemblyOf <Banking.Models.Context.Mappings.NHib.SqlServer.BankAccountMap>()).BuildConfiguration(); // Keep connection to in-memory db alive for duration of test // otherwise the db gets discarded when all connections are closed OpenContext = new DatabaseContext(Configuration); OpenContext.CreateSchema(); }
/// <summary> /// The search tests. /// </summary> /// <param name="Configuration"> /// The db id. /// </param> private void SearchTests() { using (var uow = new DatabaseContext(Configuration)) { this.Country_SearchTests(uow); this.Customer_SearchTests(uow); this.Product_SearchTests(uow); this.Book_SearchTests(uow); this.Software_SearchTests(uow); this.Order_SearchTests(uow); this.BankAccount_SearchTests(uow); } }
/// <summary> /// The load tests. /// </summary> /// <param name="Configuration"> /// The db id. /// </param> private void LoadTests() { using (var uow = new DatabaseContext(Configuration)) { this.Country_LoadTests(uow); this.Customer_LoadTests(uow); this.Product_LoadTests(uow); this.Book_LoadTests(uow); this.Software_LoadTests(uow); this.Order_LoadTests(uow); this.OrderDetails_LoadTests(uow); this.BankAccount_LoadTests(uow); this.BankTransfers_LoadTests(uow); } }
/// <summary> /// The update tests. /// </summary> /// <param name="Configuration"> /// The db id. /// </param> private void UpdateTests() { // Updates using (var uow = new DatabaseContext(Configuration)) { this.Country_Update(uow); } using (var uow = new DatabaseContext(Configuration)) { this.Customer_Update(uow); } using (var uow = new DatabaseContext(Configuration)) { this.Product_Update(uow); } using (var uow = new DatabaseContext(Configuration)) { this.Book_Update(uow); } using (var uow = new DatabaseContext(Configuration)) { this.Software_Update(uow); } using (var uow = new DatabaseContext(Configuration)) { this.Order_Update(uow); } using (var uow = new DatabaseContext(Configuration)) { this.OrderDetails_Update(uow); } using (var uow = new DatabaseContext(Configuration)) { this.BankAccount_Update(uow); } using (var uow = new DatabaseContext(Configuration)) { this.BankTransfers_Update(uow); } }
/// <summary> /// The add tests. /// </summary> /// <param name="Configuration"> /// The db id. /// </param> private void AddTests() { using (var uow = new DatabaseContext(Configuration)) { this.Country_Add(uow); } using (var uow = new DatabaseContext(Configuration)) { this.Customer_Add(uow, 2, 1, 2); } using (var uow = new DatabaseContext(Configuration)) { this.Product_Add(uow, 5, 1, 5); } using (var uow = new DatabaseContext(Configuration)) { this.Book_Add(uow); } using (var uow = new DatabaseContext(Configuration)) { this.Software_Add(uow); } using (var uow = new DatabaseContext(Configuration)) { this.Order_Add(uow, 2, 1, 2); } using (var uow = new DatabaseContext(Configuration)) { this.OrderDetails_Add(uow, 2, 1, 2); } using (var uow = new DatabaseContext(Configuration)) { this.BankAccount_Add(uow, 2, 1, 2); } using (var uow = new DatabaseContext(Configuration)) { this.BankTransfers_Add(uow); } }
/// <summary> /// The delete tests. /// </summary> /// <param name="Config"> /// The db id. /// </param> private void DeleteTests() { using (var uow = new DatabaseContext(Config)) { this.BankTransfers_Delete(uow); } using (var uow = new DatabaseContext(Config)) { this.BankAccount_Delete(uow); } using (var uow = new DatabaseContext(Config)) { this.OrderDetails_Delete(uow); } using (var uow = new DatabaseContext(Config)) { this.Order_Delete(uow); } using (var uow = new DatabaseContext(Config)) { this.Software_Delete(uow); } using (var uow = new DatabaseContext(Config)) { this.Book_Delete(uow); } using (var uow = new DatabaseContext(Config)) { this.Product_Delete(uow); } using (var uow = new DatabaseContext(Config)) { this.Customer_Delete(uow); } using (var uow = new DatabaseContext(Config)) { this.Country_Delete(uow); } }
public static void Cleanup() { Configuration = null; OpenContext?.Dispose(); OpenContext = null; }