Example #1
0
        static void Main(string[] args)
        {
            MyLibrary.Class1.MonWriteLine("Knok Knok Neo, you're in the matrix");
            Console.ReadLine();

            var o = new object();

            // Type anonyme
            var x = new { Nom = "Connor", Prenom = "John" };

            MyLibrary.Class1 c = new MyLibrary.Class1();

            // Setter privé donc marche pas
            // c.Test = "ok";

            Console.WriteLine("assert " + c.Test + " == KO");
            c.Execute();
            Console.WriteLine("assert " + c.Test + " == coucou");

            // Indirection de méthodes
            ProchaineExecution.Invoke();
            ProchaineExecution = ExecuteAuRevoir;
            Console.WriteLine("assert " + Test + " == bonjour");

            ProchaineExecution.Invoke();
            Console.WriteLine("assert " + Test + " == aurevoir");

            // Méthodes anonymes
            ProchaineExecution = delegate() { Test = "deletage methode"; };
            Console.WriteLine("assert " + Test + " == deletage methode");

            // LAMBDA
            ProchaineExecution = () => Test = "Lambda OK";
            Console.WriteLine("assert " + Test + " == Lambda OK");
        }
Example #2
0
        static void Main(string[] args)
        {
            MyLibrary.Class1.MonWriteLine("Knok Knok Neo, you're in the matrix");
            Console.ReadLine();

            var o = new object();

            // Type anonyme
            var x = new { Nom = "Connor", Prenom = "John" };

            MyLibrary.Class1 c = new MyLibrary.Class1();

            // Setter privé donc marche pas
            // c.Test = "ok";

            Console.WriteLine("assert " + c.Test + " == KO");
            c.Execute();
            Console.WriteLine("assert " + c.Test + " == coucou");

            // Indirection de méthodes
            ProchaineExecution.Invoke();
            ProchaineExecution = ExecuteAuRevoir;
            Console.WriteLine("assert " + Test + " == bonjour");

            ProchaineExecution.Invoke();
            Console.WriteLine("assert " + Test + " == aurevoir");

            // Méthodes anonymes
            ProchaineExecution = delegate() { Test = "deletage methode"; };
            Console.WriteLine("assert " + Test + " == deletage methode");

            // LAMBDA
            ProchaineExecution = () => Test = "Lambda OK";
            Console.WriteLine("assert " + Test + " == Lambda OK");
        }
Example #3
0
        public void TestMethod1()
        {
            var c = new MyLibrary.Class1();

            Assert.AreEqual(1, c.Return1());
        }