Beispiel #1
0
        public void disconnect_calls_disconnect_on_value_binding()
        {
            var obj = new TestClass();
            var mockValueBinding = new Mock <IValueBinding>();

            var testObject = new ObjectPropertyBinding("X", typeof(int), obj, mockValueBinding.Object);

            mockValueBinding.Verify(m => m.Connect(obj.X), Times.Never());

            testObject.Disconnect();

            mockValueBinding.Verify(m => m.Disconnect(), Times.Once());
        }
Beispiel #2
0
        public void connect_does_not_call_disconnect_when_not_connected()
        {
            var obj = new TestClass();
            var mockValueBinding = new Mock <IValueBinding>();

            var testObject = new ObjectPropertyBinding("X", typeof(int), obj, mockValueBinding.Object);

            testObject.Disconnect();

            var otherObj = new TestClass()
            {
                X = 10
            };

            testObject.Connect(otherObj);

            mockValueBinding.Verify(m => m.Disconnect(), Times.Once());

            mockValueBinding.Verify(m => m.Connect(otherObj.X), Times.Once());
        }
        public void connect_does_not_call_disconnect_when_not_connected()
        {
            var obj = new TestClass();
            var mockValueBinding = new Mock<IValueBinding>();

            var testObject = new ObjectPropertyBinding("X", typeof(int), obj, mockValueBinding.Object);

            testObject.Disconnect();

            var otherObj = new TestClass()
            {
                X = 10
            };

            testObject.Connect(otherObj);

            mockValueBinding.Verify(m => m.Disconnect(), Times.Once());

            mockValueBinding.Verify(m => m.Connect(otherObj.X), Times.Once());
        }
        public void disconnect_calls_disconnect_on_value_binding()
        {
            var obj = new TestClass();
            var mockValueBinding = new Mock<IValueBinding>();

            var testObject = new ObjectPropertyBinding("X", typeof(int), obj, mockValueBinding.Object);

            mockValueBinding.Verify(m => m.Connect(obj.X), Times.Never());

            testObject.Disconnect();

            mockValueBinding.Verify(m => m.Disconnect(), Times.Once());
        }