Example #1
0
        public void NotifyBase_NothingChanged_DoesNotFire()
        {
            int i      = 0;
            var notify = new NotifyMock();

            notify.Test             = "Hello";
            notify.PropertyChanged += (s, e) => i++;
            notify.Test             = "Hello";

            Assert.IsTrue(i == 0);
        }
Example #2
0
        public void NotifyBase_PropertyChanged_Fires()
        {
            int i      = 0;
            var notify = new NotifyMock();

            notify.Test             = "Hello";
            notify.PropertyChanged += (s, e) => i++;
            notify.Test             = "Hello Again";

            Assert.IsTrue(i == 1);
        }
Example #3
0
        public void NotifyBase_PropertyChanged_EventHasCorrectPropertyName()
        {
            var notify = new NotifyMock();

            string name = null;

            notify.Test             = "Hello";
            notify.PropertyChanged += (s, e) => name = e.PropertyName;
            notify.Test             = "Hello Again";

            Assert.IsTrue(name == nameof(NotifyMock.Test));
        }