static void Main1(string[] args) { MyComp obj = new MyComp(); IAsyncResult result = obj.BeginDivide(10, 2, iar => { try { int value = obj.EndDivide(iar); Console.WriteLine("Value is {0}", value); } catch (Exception ex) { Console.WriteLine("Failed {0}", ex.Message); } finally { if (iar is IDisposable) { ((IDisposable)iar).Dispose(); } } }, null); Console.ReadLine(); }
static void Main(string[] args) { MyComp theComp = new MyComp(); theComp.SetInfo("hello"); Console.WriteLine(theComp.GetInfo()); }
public void FactoryTest3() { IWindsorContainer container = new WindsorContainer("../configfactorywithparameters2.xml"); MyComp instance = (MyComp)container[typeof(MyComp)]; Assert.IsNotNull(instance); Assert.IsNotNull(instance.Service); }
public void FactoryTest2() { IWindsorContainer container = new WindsorContainer("../configfactorywithparameters.xml"); MyComp instance = (MyComp)container[typeof(MyComp)]; Assert.IsNotNull(instance); Assert.IsNotNull(instance.StoreName); Assert.IsNotNull(instance.Props); Assert.AreEqual("MyStore", instance.StoreName); Assert.AreEqual("item1", instance.Props["key1"]); Assert.AreEqual("item2", instance.Props["key2"]); }