Пример #1
0
        public void ShouldSetValue()
        {
            var entity  = new Entity();
            var adapter = new DependencyPropertyAdapter(entity, Entity.SampleProperty);

            adapter.SetValue(5);
            Assert.AreEqual(5, entity.Sample);
        }
Пример #2
0
        public void ShouldNotCallValueChangedCallbackWhenSettingValue()
        {
            var  entity         = new Entity();
            var  adapter        = new DependencyPropertyAdapter(entity, Entity.SampleProperty);
            bool callbackCalled = false;

            adapter.ValueChangedCallback = newValue => { callbackCalled = true; };

            adapter.SetValue(5);

            Assert.IsFalse(callbackCalled);
        }
Пример #3
0
        public void ShouldDoNothingWhenSettingValueToReadOnlyProperty()
        {
            var entity  = new Entity();
            var adapter = new DependencyPropertyAdapter(entity, Entity.SampleReadOnlyProperty);

            try
            {
                adapter.SetValue(5);
            }
            catch
            {
                Assert.Fail();
            }
        }