Catel.Test.Data.ModelBaseFacts.SuspendChangeNotificationFacts.SuspendsChangeNotificationsAndRaisesPropertiesOnResumeWithScopes C# (CSharp) Метод

SuspendsChangeNotificationsAndRaisesPropertiesOnResumeWithScopes() приватный Метод

private SuspendsChangeNotificationsAndRaisesPropertiesOnResumeWithScopes ( ) : void
Результат void
            public void SuspendsChangeNotificationsAndRaisesPropertiesOnResumeWithScopes()
            {
                var model = new SuspendableTestModel();

                // First change without change notifications so IsDirty = true
                model.FirstName = "1";

                var changedProperties = new List<string>();

                model.PropertyChanged += (sender, e) =>
                {
                    changedProperties.Add(e.PropertyName);
                };

                using (model.SuspendChangeNotifications())
                {
                    using (model.SuspendChangeNotifications())
                    {
                        model.FirstName = "A";
                        model.LastName = "B";

                        Assert.AreEqual(0, changedProperties.Count);
                    }

                    // We still haven't released all scopes
                    Assert.AreEqual(0, changedProperties.Count);
                }

                Assert.AreEqual(2, changedProperties.Count);

                Assert.AreEqual("FirstName", changedProperties[0]);
                Assert.AreEqual("LastName", changedProperties[1]);
            }
        }