Free cookie consent management tool by TermsFeed Policy Generator

source: branches/OaaS/HeuristicLab.Services.Optimization.Billing.Test/Program.cs @ 9844

Last change on this file since 9844 was 9619, checked in by spimming, 12 years ago

#1888:

  • Added new BillingService methods
  • Disabled proxy generation and lazy loading!
  • Extended see method with additional test data
  • Added properties to order and invoice model
  • initial commit of BillingEngine module
File size: 1.7 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 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        System.Data.Entity.Database.SetInitializer(new HeuristicLab.Services.Optimization.Billing.DataAccess.BillingContext.BillingContextInitiliazer());
18        ddlScript = (((IObjectContextAdapter)context).ObjectContext.CreateDatabaseScript());
19      }
20
21      using (StreamWriter writer = new StreamWriter(@"..\..\DDLScript.sql")) {
22        writer.Write(ddlScript);
23      }
24
25      //BillingService srv = new BillingService();
26      BillingDao dao = new BillingDao();
27      var products = dao.FindAllProducts();
28      foreach (Product p in products) {
29        Console.WriteLine(string.Format("{0}: {1}", p.ProductId, p.Name));
30      }
31
32      // Start BillingEngine Service:
33      Trace.WriteLine("Starting BillingEngine ...");
34      try {
35        billingEngine = new BillingEngine.BillingEngine();
36        billingEngineThread = new Thread(billingEngine.Run);
37        billingEngineThread.IsBackground = true; //dont keep app alive
38        billingEngineThread.Start();
39      }
40      catch (Exception e) {
41        Trace.WriteLine("Error during BillingEngine startup: " + e.Message);
42      }
43
44      Console.WriteLine("Press any key to exit...");
45      Console.ReadKey();
46    }
47  }
48}
Note: See TracBrowser for help on using the repository browser.