Ejemplo n.º 1
0
    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();
    }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            MyComp theComp = new MyComp();

            theComp.SetInfo("hello");

            Console.WriteLine(theComp.GetInfo());
        }
Ejemplo n.º 3
0
        public void FactoryTest3()
        {
            IWindsorContainer container = new WindsorContainer("../configfactorywithparameters2.xml");

            MyComp instance = (MyComp)container[typeof(MyComp)];

            Assert.IsNotNull(instance);
            Assert.IsNotNull(instance.Service);
        }
Ejemplo n.º 4
0
        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"]);
        }