using System; using TP; using MyRM; class RMUnitTester{ public RMUnitTester(){} public static void Main(string[] args) { MyRM.MyRM rm; System.Runtime.Remoting.Channels.Http.HttpChannel channel = new System.Runtime.Remoting.Channels.Http.HttpChannel(); System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel( channel ); rm = (MyRM.MyRM) System.Activator.GetObject( typeof(MyRM.MyRM), "http://localhost:8081/"+args[0]); /*if you are only using one instance of the RM be careful to use different names for Cars and Rooms: the items are keyed by name in the RM. Alternatively, change this client to connect to the wc, not directly to the RM: notice that the WC uses 3 separate instances of the RM*/ int iCount=4; int iPrice=40; string sName="Cars"; TP.Item item=new TP.Item(sName); TP.Item item1=new TP.Item("Rooms"); TP.Transaction context; System.Guid Id; try { // Id = rm.Start(); context =new TP.Transaction(); } catch (System.Exception err) { Console.WriteLine("{0}", err.Message); if (err.InnerException != null) Console.WriteLine("{0}", err.InnerException.Message); return; } item=new TP.Item("Car:Seattle"); rm.Add(context,item , 100, 10); rm.Add(context,item, 10, 15) ; rm.Add(context,item1, 1, 15) ; Console.WriteLine("CARS {0} ",rm.Query(context,item)); Console.WriteLine("@ PRICE {0}",rm.QueryPrice(context,new Item("Car:Seattle"))); //if (rc) { // rm.Commit(context); // } // else { // rm.Abort(context); // } Customer cust= new Customer(); Console.WriteLine("CUST ID {0}",cust.Id); rm.Reserve(context,cust,item); rm.Reserve(context,cust,item1); Console.WriteLine("TX ID {0}",context.Id); // Console.WriteLine("CUSTOMER {0}",rm.QueryCustomer(context, cust)); }//Main }//class