public void DtoFactoryTest() { AdaptiveFactory <object> rawFactory = AdaptiveFactory.CreateDtoFactory <object>(null, null); IDTO dto = Activator.CreateInstance(rawFactory.Implement <IDTO>()) as IDTO; dto.Key = 42; Assert.AreEqual(42, dto.Key); AdaptiveFactory <NotifyPropertySub> changeFactory = AdaptiveFactory.CreateDtoFactory <NotifyPropertySub>("OnChanging", "OnChanged"); dto = Activator.CreateInstance(changeFactory.Implement <IDTO>()) as IDTO; Assert.IsTrue(dto is INotifyPropertyChanged); Assert.IsTrue(dto is INotifyPropertyChanging); List <string> changed = new List <string>(); List <string> changing = new List <string>(); ((INotifyPropertyChanged)dto).PropertyChanged += (s, e) => changed.Add(e.PropertyName); ((INotifyPropertyChanging)dto).PropertyChanging += (s, e) => changing.Add(e.PropertyName); dto.Key = 42; Assert.AreEqual(1, changed.Count); Assert.AreEqual(1, changing.Count); Assert.AreEqual("Key", changed[0]); }