Exemple #1
0
        public void WhenSettingAPropertyToAnInvalidValue_ThenEntityHasErrors()
        {
            var testEntity = new TestEntity();

            testEntity.SomeValue = 5;

            Assert.IsTrue(testEntity.HasErrors);
            Assert.IsTrue(testEntity.GetErrors("SomeValue").Cast<object>().Any());
            Assert.IsFalse(testEntity.GetErrors("SomeOtherValue").Cast<object>().Any());
        }
Exemple #2
0
        public void WhenInvokingRaisePropertyChanged_ThenRaisesEVent()
        {
            var testEntity = new TestEntity();

            string notifiedProperty = null;
            testEntity.PropertyChanged += (s, a) => notifiedProperty = a.PropertyName;

            testEntity.SomeValue = 10;

            Assert.AreEqual("SomeValue", notifiedProperty);
        }