Пример #1
0
            public static NonInterceptableTestCase Create(Expression <Action> expression, string failReason)
            {
                var result = InterceptionTestCase.Create <NonInterceptableTestCase>(expression);

                result.FailReason = failReason;
                return(result);
            }
Пример #2
0
 public static IEnumerable <object[]> InterceptableMethods()
 {
     return(TestCases.FromObject(
                InterceptionTestCase.Create(() => new object().ToString()),
                InterceptionTestCase.Create(() =>
                                            ((IBInterface)A.Fake <IAInterface>(builder => builder.Implements(typeof(IBInterface))))
                                            .Method())));
 }
Пример #3
0
        public void Should_succeed_for_interceptable_methods(InterceptionTestCase testCase)
        {
            // Arrange
            string reason = null;

            // Act
            var result = this.validator.MethodCanBeInterceptedOnInstance(testCase.Method, testCase.Target, out reason);

            // Assert
            Assert.That(result, Is.True);
            Assert.That(reason, Is.Null);
        }
        public void Should_succeed_for_interceptable_methods(InterceptionTestCase testCase)
        {
            Guard.AgainstNull(testCase, nameof(testCase));

            // Arrange

            // Act
            var result = this.validator.MethodCanBeInterceptedOnInstance(testCase.Method, testCase.Target, out var reason);

            // Assert
            result.Should().BeTrue();
            reason.Should().BeNull();
        }