예제 #1
0
        public void Interchangable_For_System_Exception_class_Registered()
        {
            Person  person       = new Person();
            Poison  poison       = new Poison();
            IPoison poisonTarget = poison.As <IPoison>();
            IPerson personTarget = person.As <IPerson>(
                GooseTypePair.Create <Poison, IPoison>(),
                GooseTypePair.Create <Exception, IException>());

            var ex = Assert.Throws <WrappedException <IException> >(() => personTarget.Drink(poisonTarget));

            Assert.NotNull(ex.Exception);
            Assert.Equal(typeof(Exception), ex.Exception.GetSource <Exception>().GetType());
        }