public static NonInterceptableTestCase Create(Expression <Action> expression, string failReason) { var result = InterceptionTestCase.Create <NonInterceptableTestCase>(expression); result.FailReason = failReason; return(result); }
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()))); }
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(); }