コード例 #1
0
        public void RemovePropertyChanged()
        {
            var obj = new PropertyChangedEventObject {
                StringValue = "Hello",
            };
            var left = "";

            var b = Binding.Create(() => left == obj.StringValue);

            Assert.AreEqual(1, obj.StringValueChangedCount);

            Assert.AreEqual(obj.StringValue, left);

            obj.StringValue = "Goodbye";

            Assert.AreEqual(obj.StringValue, left);

            b.Unbind();

            Assert.AreEqual(0, obj.StringValueChangedCount);

            obj.StringValue = "Hello Again";

            Assert.AreEqual("Goodbye", left);
        }
コード例 #2
0
        public void PropertyChanged()
        {
            var obj = new PropertyChangedEventObject {
                StringValue = "Hello",
            };
            var left = "";

            Binding.Create(() => left == obj.StringValue);

            Assert.AreEqual(1, obj.StringValueChangedCount);

            Assert.AreEqual(obj.StringValue, left);

            obj.StringValue = "Goodbye";

            Assert.AreEqual(obj.StringValue, left);
        }
コード例 #3
0
ファイル: ChangeTrackingTest.cs プロジェクト: koltsov-ps/Bind
        public void ComplexPropertyChanged()
        {
            var obj = new PropertyChangedEventObject {
                StringValue = "Hello",
            };
            var leftA = true;

            Binding.Create (() => leftA == string.IsNullOrEmpty(obj.StringValue));

            Assert.AreEqual (1, obj.StringValueChangedCount);

            Assert.AreEqual (false, leftA);

            obj.StringValue = "";

            Assert.AreEqual (true, leftA);
        }
コード例 #4
0
        public void MultiplePropertyChanged()
        {
            var obj = new PropertyChangedEventObject {
                StringValue = "Hello",
            };
            var leftA = "";
            var leftB = "";

            Binding.Create(() => leftA == obj.StringValue);
            Binding.Create(() => leftB == obj.StringValue + "...");

            Assert.AreEqual(1, obj.StringValueChangedCount);

            Assert.AreEqual("Hello", leftA);
            Assert.AreEqual("Hello...", leftB);

            obj.StringValue = "Goodbye";

            Assert.AreEqual("Goodbye", leftA);
            Assert.AreEqual("Goodbye...", leftB);
        }
コード例 #5
0
ファイル: ChangeTrackingTest.cs プロジェクト: jorik041/Bind
        public void MultiplePropertyChanged()
        {
            var obj = new PropertyChangedEventObject {
                StringValue = "Hello",
            };
            var leftA = "";
            var leftB = "";

            Binding.Create (() => leftA == obj.StringValue);
            Binding.Create (() => leftB == obj.StringValue + "...");

            Assert.AreEqual (1, obj.StringValueChangedCount);

            Assert.AreEqual ("Hello", leftA);
            Assert.AreEqual ("Hello...", leftB);

            obj.StringValue = "Goodbye";

            Assert.AreEqual ("Goodbye", leftA);
            Assert.AreEqual ("Goodbye...", leftB);
        }
コード例 #6
0
        public void MultipleObjectPropertyChanged()
        {
            var objA = new PropertyChangedEventObject {
                StringValue = "Hello",
            };
            var objB = new PropertyChangedEventObject {
                StringValue = "World",
            };
            var left = "";

            Binding.Create(() => left == objA.StringValue + ", " + objB.StringValue);

            Assert.AreEqual("Hello, World", left);

            objA.StringValue = "Goodbye";

            Assert.AreEqual("Goodbye, World", left);

            objB.StringValue = "Mars";

            Assert.AreEqual("Goodbye, Mars", left);
        }
コード例 #7
0
        public void RemoveMultiplePropertyChanged()
        {
            var obj = new PropertyChangedEventObject {
                StringValue = "Hello",
            };
            var leftA = "";
            var leftB = "";

            var bA = Binding.Create(() => leftA == obj.StringValue);
            var bB = Binding.Create(() => leftB == obj.StringValue + "...");

            Assert.AreEqual(1, obj.StringValueChangedCount);

            Assert.AreEqual("Hello", leftA);
            Assert.AreEqual("Hello...", leftB);

            obj.StringValue = "Goodbye";

            Assert.AreEqual("Goodbye", leftA);
            Assert.AreEqual("Goodbye...", leftB);

            bA.Unbind();

            Assert.AreEqual(1, obj.StringValueChangedCount);

            obj.StringValue = "Hello Again";

            Assert.AreEqual("Goodbye", leftA);
            Assert.AreEqual("Hello Again...", leftB);

            bB.Unbind();

            Assert.AreEqual(0, obj.StringValueChangedCount);

            obj.StringValue = "Goodbye Again";

            Assert.AreEqual("Goodbye", leftA);
            Assert.AreEqual("Hello Again...", leftB);
        }
コード例 #8
0
ファイル: ChangeTrackingTest.cs プロジェクト: jorik041/Bind
        public void MultipleObjectPropertyChanged()
        {
            var objA = new PropertyChangedEventObject {
                StringValue = "Hello",
            };
            var objB = new PropertyChangedEventObject {
                StringValue = "World",
            };
            var left = "";

            Binding.Create (() => left == objA.StringValue + ", " + objB.StringValue);

            Assert.AreEqual ("Hello, World", left);

            objA.StringValue = "Goodbye";

            Assert.AreEqual ("Goodbye, World", left);

            objB.StringValue = "Mars";

            Assert.AreEqual ("Goodbye, Mars", left);
        }
コード例 #9
0
ファイル: ChangeTrackingTest.cs プロジェクト: jorik041/Bind
        public void RemovePropertyChanged()
        {
            var obj = new PropertyChangedEventObject {
                StringValue = "Hello",
            };
            var left = "";

            var b = Binding.Create (() => left == obj.StringValue);

            Assert.AreEqual (1, obj.StringValueChangedCount);

            Assert.AreEqual (obj.StringValue, left);

            obj.StringValue = "Goodbye";

            Assert.AreEqual (obj.StringValue, left);

            b.Unbind ();

            Assert.AreEqual (0, obj.StringValueChangedCount);

            obj.StringValue = "Hello Again";

            Assert.AreEqual ("Goodbye", left);
        }
コード例 #10
0
ファイル: ChangeTrackingTest.cs プロジェクト: jorik041/Bind
        public void RemoveMultiplePropertyChanged()
        {
            var obj = new PropertyChangedEventObject {
                StringValue = "Hello",
            };
            var leftA = "";
            var leftB = "";

            var bA = Binding.Create (() => leftA == obj.StringValue);
            var bB = Binding.Create (() => leftB == obj.StringValue + "...");

            Assert.AreEqual (1, obj.StringValueChangedCount);

            Assert.AreEqual ("Hello", leftA);
            Assert.AreEqual ("Hello...", leftB);

            obj.StringValue = "Goodbye";

            Assert.AreEqual ("Goodbye", leftA);
            Assert.AreEqual ("Goodbye...", leftB);

            bA.Unbind ();

            Assert.AreEqual (1, obj.StringValueChangedCount);

            obj.StringValue = "Hello Again";

            Assert.AreEqual ("Goodbye", leftA);
            Assert.AreEqual ("Hello Again...", leftB);

            bB.Unbind ();

            Assert.AreEqual (0, obj.StringValueChangedCount);

            obj.StringValue = "Goodbye Again";

            Assert.AreEqual ("Goodbye", leftA);
            Assert.AreEqual ("Hello Again...", leftB);
        }
コード例 #11
0
ファイル: ChangeTrackingTest.cs プロジェクト: jorik041/Bind
        public void PropertyChanged()
        {
            var obj = new PropertyChangedEventObject {
                StringValue = "Hello",
            };
            var left = "";

            Binding.Create (() => left == obj.StringValue);

            Assert.AreEqual (1, obj.StringValueChangedCount);

            Assert.AreEqual (obj.StringValue, left);

            obj.StringValue = "Goodbye";

            Assert.AreEqual (obj.StringValue, left);
        }