public OrderManagerShould() { // Set string variable prodPath to contain the path to the test database string prodPath = System.Environment.GetEnvironmentVariable("BANGAZON_TEST_DB"); // Create connection to test database and capture in DatabaseConnection variable db DatabaseConnection db = new DatabaseConnection(prodPath); // Set the private DatabaseConnection variable of _db to equal the DatabaseConnection of db _db = db; // Ensure there is a database with tables at the end of the test database connection DatabaseStartup databaseStartup = new DatabaseStartup(_db); /* Set the private OrderManager variable _orderManager to be a new instance of * OrderManager connected to the test database */ _orderManager = new OrderManager(_db); // Create a new Orderz called _orderz for test and set the properties _orderz = new Orderz(); _orderz.CustomerId = 1; _orderz.PaymentTypeId = 1; _orderz.DateCreated = DateTime.Now; // Create a new Orderz for CustomerId 1 with no PaymentTypeId _orderz2 = new Orderz(); _orderz2.CustomerId = 1; _orderz2.PaymentTypeId = null; _orderz2.DateCreated = DateTime.Now; // Create a new Orderz for CustomerId 2 with a PaymentTypeId _orderz3 = new Orderz(); _orderz3.CustomerId = 2; _orderz3.PaymentTypeId = 1; _orderz3.DateCreated = DateTime.Now; }
public ProductManagerShould() { // Set string variable prodPath to contain the path to the test database string prodPath = System.Environment.GetEnvironmentVariable("BANGAZON_TEST_DB"); // Create connection to test database and capture in DatabaseConnection variable db DatabaseConnection db = new DatabaseConnection(prodPath); // Set the private DatabaseConnection variable of _db to equal the DatabaseConnection of db _db = db; // Ensure there is a database with tables at the end of the test database connection DatabaseStartup databaseStartup = new DatabaseStartup(_db); _productManager = new ProductManager(_db); _product = new Product(); _product.ProductType = "transpotation"; _product.CustomerId = 1; _product.Title = "Bike"; _product.Description = "Blue Bike"; _product.Price = 2.00; _product.Quantity = 2; _product.DateCreated = DateTime.Now; _product2 = new Product(); _product2.ProductType = "transportation"; _product2.CustomerId = 1; _product2.Title = "Horse"; _product2.Description = "Blue Horse"; _product2.Price = 3.00; _product2.Quantity = 4; _product2.DateCreated = DateTime.Now; }
public void ConfigureServices(IServiceCollection services) { var configBuilder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true); var config = configBuilder.Build(); DatabaseStartup.ConfigureDatabaseServices(services, config); }
/// <summary> /// 生成Acccount数据库(不启动startup的方式) /// </summary> public void InitAcccountDB() { var serviceCollection = new ServiceCollection(); DatabaseStartup databaseStartup = new DatabaseStartup(); databaseStartup.ConfigureServices(serviceCollection, _configuration); var serviceProvider = serviceCollection.BuildServiceProvider(); DatabaseInitializer.Initialize(serviceProvider); }
public PaymentManagerShould() { string prodPath = System.Environment.GetEnvironmentVariable("BANGAZON_TEST_DB"); // Create connection to test database and capture in DatabaseConnection variable db DatabaseConnection db = new DatabaseConnection(prodPath); // Set the private DatabaseConnection variable of _db to equal the DatabaseConnection of db _db = db; // Ensure there is a database with tables at the end of the test database connection DatabaseStartup databaseStartup = new DatabaseStartup(_db); _ptm = new PaymentTypeManager(_db); }
public virtual void ConfigureServices(IServiceCollection services) { services.AddApiVersioning(config => { config.DefaultApiVersion = new ApiVersion(1, 0); config.AssumeDefaultVersionWhenUnspecified = true; config.ReportApiVersions = true; }); SegurancaStartup.ConfigurarJwtToken(services, Configuration); CorsStartup.Configurar(services, Configuration); SwaggerStartup.Configurar(services); DependencyInjectionStartup.Configurar(services); SettingsStartup.Configurar(services, Configuration); DatabaseStartup.Configurar(services, Configuration); }
public CustomerManagerShould() { //Find path to database string prodPath = System.Environment.GetEnvironmentVariable("BANGAZON_TEST_DB"); DatabaseConnection db = new DatabaseConnection(prodPath); _db = db; _cm = new CustomerManager(_db); // Ensure there is a database with tables at the end of the test database connection DatabaseStartup databaseStartup = new DatabaseStartup(_db); _person1 = new Customer(); _person1.Name = "Brian"; _person1.Address = "5050 Itunes Ln"; _person1.City = "Nashville"; _person1.State = "Georgia"; _person1.PostalCode = "44145"; _person1.Phone = "440-111-4444"; _person2 = new Customer(); _person2.Name = "Johnny"; _person2.Address = "7877 Happy Drive"; _person2.City = "San Fransisco"; _person2.State = "California"; _person2.PostalCode = "90210"; _person2.Phone = "736-111-4433"; _person3 = new Customer(); _person3.Id = 1; _person3.Name = "Johnny"; _person3.Address = "7877 Happy Drive"; _person3.City = "San Fransisco"; _person3.State = "California"; _person3.PostalCode = "90210"; _person3.Phone = "736-111-4433"; _person4 = new Customer(); _person4.Name = "Hank"; _person4.Address = "74 Unit way"; _person4.City = "Fresno"; _person4.State = "California"; _person4.PostalCode = "0987"; _person4.Phone = "736-111-4433"; }
private void Application_Startup(object sender, StartupEventArgs e) { StockDataImportStartup.RegisterServices(); DatabaseStartup.RegisterServices(); CommonStartup.RegisterServices(); }
public void RestaurarDatabase() { DatabaseStartup.RestoreDatabase(); }
private void Application_Startup(object sender, StartupEventArgs e) { StockAnalyzerStartup.RegisterServices(); DatabaseStartup.RegisterServices(); }
internal void RecreateDatabase() { RemoveDatabase(); DatabaseStartup.EnsureDatabaseExists(ConnectionString); }