public void ConstructorThrowsTargetInvocationExceptionIsUnwrappedAndRethrown()
    {
        MethodInfo      method        = typeof(SpyWithConstructorThrow).GetMethod("PassedTest");
        IMethodInfo     wrappedMethod = Reflector.Wrap(method);
        FactCommand     factCommand   = new FactCommand(wrappedMethod);
        LifetimeCommand command       = new LifetimeCommand(factCommand, wrappedMethod);

        SpyWithConstructorThrow.Reset();

        Exception ex = Record.Exception(() => command.Execute(null));

        Assert.IsType <InvalidOperationException>(ex);
    }
    public void ConstructorThrowsTestNotCalledDisposeNotCalled()
    {
        MethodInfo      method        = typeof(SpyWithConstructorThrow).GetMethod("PassedTest");
        IMethodInfo     wrappedMethod = Reflector.Wrap(method);
        TestCommand     testCommand   = new FactCommand(wrappedMethod);
        LifetimeCommand command       = new LifetimeCommand(testCommand, wrappedMethod);

        SpyWithConstructorThrow.Reset();

        Record.Exception(() => command.Execute(null));

        Assert.Equal(1, SpyWithConstructorThrow.ctorCalled);
        Assert.Equal(0, SpyWithConstructorThrow.testCalled);
        Assert.Equal(0, SpyWithConstructorThrow.disposeCalled);
    }