Free cookie consent management tool by TermsFeed Policy Generator

source: branches/1888_OaaS/HeuristicLab.Services.Optimization.Billing.Test/Program.cs @ 17956

Last change on this file since 17956 was 10013, checked in by spimming, 11 years ago

#1888:

  • enabled transactions
  • enabled tracing output
  • set correct invoice data
  • saving invoices
File size: 1.6 KB
Line 
1using System;
2using System.Data.Entity.Infrastructure;
3using System.Diagnostics;
4using System.IO;
5using System.Threading;
6using HeuristicLab.Services.Optimization.Billing.DataAccess;
7using HeuristicLab.Services.Optimization.Billing.Model;
8
9namespace HeuristicLab.Services.Optimization.Billing.Test {
10  class Program {
11    private static HeuristicLab.Services.Optimization.Billing.BillingEngine.BillingEngine billingEngine;
12    private static Thread billingEngineThread;
13
14    static void Main(string[] args) {
15      string ddlScript;
16      using (var context = new BillingContext()) {
17        ddlScript = (((IObjectContextAdapter)context).ObjectContext.CreateDatabaseScript());
18      }
19
20      using (StreamWriter writer = new StreamWriter(@"..\..\DDLScript.sql")) {
21        writer.Write(ddlScript);
22      }
23
24      //BillingService srv = new BillingService();
25      BillingDao dao = new BillingDao();
26      var products = dao.FindAllProducts();
27      foreach (Product p in products) {
28        Console.WriteLine(string.Format("{0}: {1}", p.ProductId, p.Name));
29      }
30
31      // Start BillingEngine Service:
32      Trace.WriteLine("Starting BillingEngine ...");
33      try {
34        billingEngine = new BillingEngine.BillingEngine();
35        billingEngineThread = new Thread(billingEngine.Run);
36        billingEngineThread.IsBackground = true; //dont keep app alive
37        billingEngineThread.Start();
38      }
39      catch (Exception e) {
40        Trace.WriteLine("Error during BillingEngine startup: " + e.Message);
41      }
42
43      Console.WriteLine("Press any key to exit...");
44      Console.ReadKey();
45    }
46  }
47}
Note: See TracBrowser for help on using the repository browser.