示例#1
0
        public void OnSet_for_Virtual_ReferenceTypes()
        {
            var notifier = new ExplicitValueTypeNotifier();

            notifier.OnSetVirtualObject = new object();
            notifier.OnSetVirtualObject = notifier.OnSetVirtualObject;
            Assert.AreEqual(4, notifier.ChangeCount);
        }
示例#2
0
        public void OnChange_for_Virtual_ValueTypes()
        {
            var notifier = new ExplicitValueTypeNotifier();

            notifier.OnChangeVirtualInt = 43;
            notifier.OnChangeVirtualInt = 43;
            Assert.AreEqual(3, notifier.ChangeCount);
        }
示例#3
0
        public void OnChange_for_inherited_properties()
        {
            var notifier = new ExplicitValueTypeNotifier();

            notifier.OnChangeBaseInt = 43;
            notifier.OnChangeBaseInt = 43;
            Assert.AreEqual(1, notifier.ChangeCount);
        }
示例#4
0
        public void OnChange_calls_NotifyTarget_with_one_argument()
        {
            var expectedProperties = new[] { "OnChangeInt", "OnChangeInt" };
            var notifier           = new ExplicitValueTypeNotifier();

            notifier.OnChangeInt = 71;
            notifier.OnChangeInt = 9;
            CollectionAssert.AreEqual(expectedProperties, notifier.Changes, $"Expected '{string.Join(",", expectedProperties)}' but got {string.Join(",", notifier.Changes)}.");
        }
示例#5
0
        public void OnChange_for_Nullable_ValueTypes()
        {
            var notifier = new ExplicitValueTypeNotifier();

            notifier.OnChangeNullableInt = 43;
            notifier.OnChangeNullableInt = 43;
            notifier.OnChangeNullableInt = null;
            notifier.OnChangeNullableInt = null;
            Assert.AreEqual(2, notifier.ChangeCount);
        }
示例#6
0
        public void OnChange_for_ValueTypes()
        {
            var notifier = new ExplicitValueTypeNotifier();

            notifier.OnChangeInt    = 43;
            notifier.OnChangeInt    = 43;
            notifier.OnChangeBool   = true;
            notifier.OnChangeBool   = true;
            notifier.OnChangeDouble = 3.14159261;
            notifier.OnChangeDouble = 3.14159261;
            Assert.AreEqual(3, notifier.ChangeCount);
        }