public void WhenEnumTypeIsProvidedForIntParameterConversionWillBeAttempted()
        {
            var ci  = typeof(CtorWithInt).GetTypeInfo().DeclaredConstructors.Single();
            var cpb = new ConstructorParameterBinding(
                ci, new[] { new PositionalParameter(0, Foo.B), }, new ContainerBuilder().Build());
            var instance = (CtorWithInt)cpb.Instantiate();

            Assert.Equal(1, instance.Value);
        }
        public void WhenAnExceptionIsThrownFromAConstructor_TheInnerExceptionIsWrapped()
        {
            var ci  = typeof(ThrowsInCtor).GetTypeInfo().DeclaredConstructors.Single();
            var cpb = new ConstructorParameterBinding(
                ci, Enumerable.Empty <Parameter>(), new ContainerBuilder().Build());
            var dx = Assert.Throws <DependencyResolutionException>(() =>
                                                                   cpb.Instantiate());

            Assert.True(dx.Message.Contains(typeof(ThrowsInCtor).Name));
            Assert.Equal(ThrowsInCtor.Message, dx.InnerException.Message);
        }
        public void WhenAnExceptionIsThrownFromAConstructor_TheInnerExceptionIsWrapped()
        {
            var ci  = typeof(ThrowsInCtor).GetConstructor(new Type[0]);
            var cpb = new ConstructorParameterBinding(
                ci, Enumerable.Empty <Parameter>(), Container.Empty);
            var dx = Assert.Throws <DependencyResolutionException>(() =>
                                                                   cpb.Instantiate());

            Assert.That(dx.Message.Contains(typeof(ThrowsInCtor).Name));
            Assert.AreEqual(ThrowsInCtor.Message, dx.InnerException.Message);
        }