public void SetupRethrowExceptionInstanceArrangement()
        {
            // Given
            var type         = typeof(IFooFuncValueTypeParameterless <int>);
            var methodName   = nameof(IFooFuncValueTypeParameterless <int> .MethodWithoutParameter);
            var signature    = type.GetMethod(methodName) ?? throw new MethodInfoException(type, methodName);
            var arrangements = new ArrangementCollection();
            var mockBehavior = new MockBehavior <IFooFuncValueTypeParameterIn <int> >(arrangements);
            var callBehavior = new CallBehavior <IFooFuncValueTypeParameterIn <int>, int>(arrangements, signature, mockBehavior);

            // When
            callBehavior.Throws(new Exception());

            // Then
            Assert.Single(arrangements);
            var arrangement = arrangements.First() as ExceptionArrangement;

            Assert.NotNull(arrangement);
        }
예제 #2
0
        public void SetupThrowExceptionArrangement()
        {
            // Given
            var type         = typeof(IFooActionParameterless);
            var methodName   = nameof(IFooActionParameterless.MethodWithoutParameter);
            var signature    = type.GetMethod(methodName) ?? throw new MethodInfoException(type, methodName);
            var arrangements = new ArrangementCollection();
            var mockBehavior = new MockBehavior <IFooActionParameterless>(arrangements);
            var callBehavior = new CallBehavior <IFooActionParameterless>(arrangements, signature, mockBehavior);

            // When
            callBehavior.Throws <ArgumentException>();

            // Then
            Assert.Single(arrangements);
            var arrangement = arrangements.First() as ExceptionArrangement;

            Assert.NotNull(arrangement);
        }