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

            notificationCache.AddPropertyNameToNotify(FirstProperty, SecondProperty);
            notificationCache.AddPropertyNameToNotify(SecondProperty, FirstProperty);
            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 AddPropertyNameToNotify_PropertyNameToNotifyNull_ThrowsArgumentNullException()
        {
#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type.
            Assert.Throws <ArgumentNullException>(() => NotificationCache.AddPropertyNameToNotify(FirstProperty, null));
#pragma warning restore CS8625 // Cannot convert null literal to non-nullable reference type.
        }
Exemple #4
0
 public void AddPropertyNameToNotify_SameName_ThrowsArgumentException()
 {
     Assert.Throws <ArgumentException>(() => NotificationCache.AddPropertyNameToNotify(FirstProperty, FirstProperty));
 }
 public void AddPropertyNameToNotify_PropertyNameToNotifyNull_ThrowsArgumentNullException()
 {
     Assert.Throws <ArgumentNullException>(() => NotificationCache.AddPropertyNameToNotify(FirstProperty, null));
 }