[Test] public void GetTargetOnTargetReturnsItself() { { var mock = MockRepository.GenerateStub <IBar>(); var target = NotifyPropertyChangeFactory.GetTarget(mock); Assert.That(target, Is.SameAs(mock)); } { var mock = MockRepository.GenerateStub <IEnumerator <IBar> >(); var target = NotifyPropertyChangeFactory.GetTarget(mock); Assert.That(target, Is.SameAs(mock)); } { var mock = MockRepository.GenerateStub <IEnumerable <IBar> >(); var target = NotifyPropertyChangeFactory.GetTarget(mock); Assert.That(target, Is.SameAs(mock)); } { var mock = MockRepository.GenerateStub <ICollection <IBar> >(); var target = NotifyPropertyChangeFactory.GetTarget(mock); Assert.That(target, Is.SameAs(mock)); } { var mock = MockRepository.GenerateStub <IList <IBar> >(); var target = NotifyPropertyChangeFactory.GetTarget(mock); Assert.That(target, Is.SameAs(mock)); } { var mock = MockRepository.GenerateStub <IDictionary <int, IBar> >(); var target = NotifyPropertyChangeFactory.GetTarget(mock); Assert.That(target, Is.SameAs(mock)); } }
[Test] public void GetTargetGetsNullOnNullProxy() { Assert.That(NotifyPropertyChangeFactory.GetTarget((IFoo)null), Is.Null); Assert.That(NotifyPropertyChangeFactory.GetTarget((IEnumerator <IFoo>)null), Is.Null); Assert.That(NotifyPropertyChangeFactory.GetTarget((IEnumerable <IFoo>)null), Is.Null); Assert.That(NotifyPropertyChangeFactory.GetTarget((ICollection <IFoo>)null), Is.Null); Assert.That(NotifyPropertyChangeFactory.GetTarget((IList <IFoo>)null), Is.Null); Assert.That(NotifyPropertyChangeFactory.GetTarget((IDictionary <int, IFoo>)null), Is.Null); }