Exemple #1
0
        public void ShouldClearValue()
        {
            BusinessObject component = new BusinessObject() { Name = "TestName" };
              PropertyItem property = new PropertyItem(new PropertyGrid(), component, BusinessObject.ExtractProperty("Name"));

              Assert.AreEqual<string>("TestName", property.GetValue().ToString());

              property.ClearValue();

              Assert.AreEqual<string>("DefaultName", property.GetValue().ToString());
        }
Exemple #2
0
        public void ShouldClearValue()
        {
            BusinessObject component = new BusinessObject()
            {
                Name = "TestName"
            };
            PropertyItem property = new PropertyItem(new PropertyGrid(), component, BusinessObject.ExtractProperty("Name"));

            Assert.AreEqual <string>("TestName", property.GetValue().ToString());

            property.ClearValue();

            Assert.AreEqual <string>("DefaultName", property.GetValue().ToString());
        }
Exemple #3
0
        public void ShouldNotifyOnValueCleared()
        {
            BusinessObject component = new BusinessObject()
            {
                Name = "TestName"
            };
            PropertyItem property = new PropertyItem(new PropertyGrid(), component, BusinessObject.ExtractProperty("Name"));
            bool         cleared  = false;

            property.PropertyChanged += (sender, e) => { if (e.PropertyName == "PropertyValue")
                                                         {
                                                             cleared = true;
                                                         }
            };

            property.ClearValue();
            Assert.IsTrue(cleared);
        }
Exemple #4
0
        public void ShouldNotifyOnValueCleared()
        {
            BusinessObject component = new BusinessObject() { Name = "TestName" };
              PropertyItem property = new PropertyItem(new PropertyGrid(), component, BusinessObject.ExtractProperty("Name"));
              bool cleared = false;
              property.PropertyChanged += (sender, e) => { if (e.PropertyName == "PropertyValue") cleared = true; };

              property.ClearValue();
              Assert.IsTrue(cleared);
        }