Exemple #1
0
        public void GetPropertyNamesToNotify()
        {
            var notificationCache = new NotificationCache();

            notificationCache.AddPropertyNameToNotify(FirstProperty, SecondProperty);
            var expectedPropertyNames = Enumerable.Repeat(SecondProperty, 1);
            var propertyNames         = notificationCache.GetPropertyNamesToNotify(FirstProperty);

            Assert.Equal(expectedPropertyNames, propertyNames);
        }
Exemple #2
0
        public void GetPropertyNamesToNotify_IndirectPropertyNames()
        {
            var notificationCache = new NotificationCache();

            notificationCache.AddPropertyNameToNotify(FirstProperty, SecondProperty);
            notificationCache.AddPropertyNameToNotify(SecondProperty, ThirdProperty);
            var expectedPropertyNames = new List <string> {
                SecondProperty, ThirdProperty
            }.OrderBy(name => name);
            var propertyNames = notificationCache.GetPropertyNamesToNotify(FirstProperty).OrderBy(name => name);

            Assert.Equal(expectedPropertyNames, propertyNames);
        }
Exemple #3
0
        public void GetPropertyNamesToNotify_propertyName_null_throws_ArgumentNullException()
        {
#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type.
            Assert.Throws <ArgumentNullException>(() => NotificationCache.GetPropertyNamesToNotify(null));
#pragma warning restore CS8625 // Cannot convert null literal to non-nullable reference type.
        }
 public void GetPropertyNamesToNotify_propertyName_null_returns_empty_collection()
 {
     Assert.Empty(NotificationCache.GetPropertyNamesToNotify(null));
 }