Пример #1
0
        public void Test8()
        {
            BaseNode     source      = CreateSourceTree("root", 2);
            SourceOfData destination = new SourceOfData();

            DataBinder.AddCompiledBinding(source, "Left.Right.UserData", destination, "tagada");
        }
Пример #2
0
        public void Test22()
        {
            SourceDataThrowException source      = new SourceDataThrowException();
            SourceOfData             destination = new SourceOfData();

            DataBinder.AddCompiledBinding(source, "PropGetThrowException", destination, "Prop1");
        }
Пример #3
0
        public void Test7()
        {
            BaseNode     source      = CreateSourceTree("root", 2);
            SourceOfData destination = new SourceOfData();

            DataBinder.AddCompiledBinding(source, "A.B.Z", destination, "Prop1");
        }
Пример #4
0
        public void Test4()
        {
            BaseNode     source      = CreateSourceTree("root", 2);
            SourceOfData destination = new SourceOfData();

            DataBinder.AddCompiledBinding(source, "Left.Right.UserData", destination, "Prop1");

            MyNode <int> feuille = GetFeuille(source, 2);

            feuille.UserData = 25;
            Assert.AreEqual(feuille.UserData, destination.Prop1, "binding doesn't work !");
            feuille.UserData = 155;
            Assert.AreEqual(feuille.UserData, destination.Prop1, "binding doesn't work !");
            source.Left = CreateSourceTree("childroot", 1);

            MyNode <int> feuille1 = GetFeuille(source, 2);

            feuille1.UserData = 157;
            Assert.AreEqual(feuille1.UserData, destination.Prop1, "binding doesn't work !");
            Assert.AreEqual(feuille1.UserData, 157, "binding doesn't work !");
            Assert.AreEqual(157, destination.Prop1, "binding doesn't work !");

            //changement de l'ancienne valeur
            feuille.UserData = 456;
            Assert.AreEqual(157, destination.Prop1, "binding doesn't work !");
        }
Пример #5
0
        public void Test6()
        {
            BaseNode     destination = CreateSourceTree("root", 2);
            SourceOfData source      = new SourceOfData();

            DataBinder.AddCompiledBinding(source, "Prop1", destination, "Left.Right.UserData");
            source.Prop1 = 25;
            MyNode <int> feuille = GetFeuille(destination, 2);

            Assert.AreEqual(25, feuille.UserData, "binding doesn't work !");
        }
Пример #6
0
        public void Test1()
        {
            SourceOfData source      = new SourceOfData();
            SourceOfData destination = new SourceOfData();

            DataBinder.AddCompiledBinding(source, "Prop1", destination, "Prop1");

            source.Prop1 = 25;
            Assert.AreEqual(source.Prop1, destination.Prop1, "simple binding doesn't work !");
            source.Prop1 = 155;
            Assert.AreEqual(source.Prop1, destination.Prop1, "simple binding doesn't work !");
        }
Пример #7
0
        public void Test23()
        {
            SourceDataNotifyOnPropertyChanged source = new SourceDataNotifyOnPropertyChanged();

            source.IntProperty = 123456;
            SourceOfData destination = new SourceOfData();

            DataBinder.AddCompiledBinding(source, "IntProperty", destination, "Prop1");
            Assert.AreEqual(123456, destination.Prop1);
            source.IntProperty = 456789;
            Assert.AreEqual(456789, destination.Prop1);
        }
Пример #8
0
        public void Test2()
        {
            BaseNode     source      = CreateSourceTree("root", 2);
            SourceOfData destination = new SourceOfData();

            DataBinder.AddCompiledBinding(source, "Left.Right.UserData", destination, "Prop1");

            MyNode <int> feuille = GetFeuille(source, 2);

            feuille.UserData = 25;
            Assert.AreEqual(feuille.UserData, destination.Prop1, "binding doesn't work !");
            feuille.UserData = 155;
            Assert.AreEqual(feuille.UserData, destination.Prop1, "binding doesn't work !");
        }
Пример #9
0
        public void Test13()
        {
            SourceOfData source      = new SourceOfData();
            SourceOfData destination = new SourceOfData();

            DataBinder.AddCompiledBinding(source, "Prop1", destination, "Prop1");
            source.Prop1 = 123;
            Assert.AreEqual(123, destination.Prop1, "binding doesn't work !");
            Assert.AreEqual(source.Prop1, destination.Prop1, "binding doesn't work !");
            Console.WriteLine("binding count : {0}", DataBinder.Bindings.Count);
            DataBinder.EnableDisableBinding(source, "Prop1", false);
            source.Prop1 = 456;
            Assert.AreEqual(456, source.Prop1, "binding doesn't work !");
            Assert.AreEqual(123, destination.Prop1, "binding doesn't work !");
            DataBinder.EnableDisableBinding(source, "Prop1", true);
            source.Prop1 = 789;
            Assert.AreEqual(789, destination.Prop1, "binding doesn't work !");
            Assert.AreEqual(source.Prop1, destination.Prop1, "binding doesn't work !");
        }
Пример #10
0
        public void Test5()
        {
            SourceOfData source      = new SourceOfData();
            SourceOfData destination = new SourceOfData();

            DataBinder.AddCompiledBinding(source, "Prop1", destination, "Prop1");
            source.Prop1 = 123;
            Assert.AreEqual(123, destination.Prop1, "binding doesn't work !");
            Assert.AreEqual(source.Prop1, destination.Prop1, "binding doesn't work !");
            bool finalized = false;

            destination.OnFinalized += delegate(object sender, EventArgs e)
            {
                finalized = true;
            };
            destination = null;
            GC.Collect();
            GC.WaitForPendingFinalizers();
            Assert.IsTrue(finalized);

            source      = new SourceOfData();
            destination = new SourceOfData();
            DataBinder.AddCompiledBinding(source, "Prop1", destination, "Prop1");
            source.Prop1 = 123;
            Assert.AreEqual(123, destination.Prop1, "binding doesn't work !");
            Assert.AreEqual(source.Prop1, destination.Prop1, "binding doesn't work !");
            finalized           = false;
            source.OnFinalized += delegate(object sender, EventArgs e)
            {
                finalized = true;
            };
            source = null;
            GC.Collect();
            GC.WaitForPendingFinalizers();
            Assert.IsTrue(finalized);
        }