public void PropertiesAreActuallyRegisteredWithDefaultValues() { var instance = new ClassWithPropertiesRegisteredByNonMagicStringOverload(); Assert.AreEqual(ClassWithPropertiesRegisteredByNonMagicStringOverload.StringPropertyWithSpecifiedDefaultValueProperty.GetDefaultValue <string>(), instance.StringPropertyWithSpecifiedDefaultValue); Assert.AreEqual(ClassWithPropertiesRegisteredByNonMagicStringOverload.StringPropertyProperty.GetDefaultValue <string>(), instance.StringProperty); Assert.AreEqual(ClassWithPropertiesRegisteredByNonMagicStringOverload.IntPropertyWithPropertyChangeNoticationProperty.GetDefaultValue <int>(), instance.IntPropertyWithPropertyChangeNotication); Assert.AreEqual(ClassWithPropertiesRegisteredByNonMagicStringOverload.IntPropertyExcludedFromSerializationAndBackupProperty.GetDefaultValue <int>(), instance.IntPropertyExcludedFromSerializationAndBackup); }
public void PropertiesAreActuallyRegistered() { var instance = new ClassWithPropertiesRegisteredByNonMagicStringOverload(); Assert.IsTrue(instance.IsPropertyRegistered("StringProperty")); Assert.IsTrue(instance.IsPropertyRegistered("StringPropertyWithSpecifiedDefaultValue")); Assert.IsTrue(instance.IsPropertyRegistered("IntPropertyWithPropertyChangeNotication")); Assert.IsTrue(instance.IsPropertyRegistered("IntPropertyExcludedFromSerializationAndBackup")); }
public void PropertiesAreRegisteredWithPropertyChangeNotification() { Assert.IsNotNull(ClassWithPropertiesRegisteredByNonMagicStringOverload.IntPropertyWithPropertyChangeNoticationProperty.PropertyChangedEventHandler); var random = new Random(); int maxPropertyChanges = random.Next(0, 15); var instance = new ClassWithPropertiesRegisteredByNonMagicStringOverload(); for (int i = 0; i < maxPropertyChanges; i++) { instance.IntPropertyWithPropertyChangeNotication = random.Next(1000); } Assert.IsTrue(0 <= instance.IntPropertyWithPropertyChangeNoticationsCount && instance.IntPropertyWithPropertyChangeNoticationsCount <= maxPropertyChanges); }