/// <summary>
        /// Initializes a new instance of the <see cref="ExpressionCallRule"/> class.
        /// </summary>
        /// <param name="expressionMatcher">The expression matcher to use.</param>
        public ExpressionCallRule(ExpressionCallMatcher expressionMatcher)
        {
            Guard.AgainstNull(expressionMatcher, nameof(expressionMatcher));

            this.ExpressionMatcher = expressionMatcher;
            this.SetOutAndRefParametersValueProducer(expressionMatcher.GetOutAndRefParametersValueProducer());
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ExpressionCallRule"/> class.
        /// </summary>
        /// <param name="expressionMatcher">The expression matcher to use.</param>
        public ExpressionCallRule(ExpressionCallMatcher expressionMatcher)
        {
            Guard.AgainstNull(expressionMatcher, "expressionMatcher");

            this.ExpressionMatcher = expressionMatcher;
            this.OutAndRefParametersValueProducer = expressionMatcher.GetOutAndRefParametersValueProducer();
        }
        public void SetUp()
        {
            this.fake = Fake.GetFakeManager(A.Fake<IFoo>());
            
            this.fakeAsserter = A.Fake<IFakeAsserter>();
            
            this.matcher = A.Fake<ExpressionCallMatcher>(x => x.WithArgumentsForConstructor(() =>
                new ExpressionCallMatcher(
                    ExpressionHelper.CreateExpression<IFoo>(_ => Console.WriteLine("")),
                    ServiceLocator.Current.Resolve<ArgumentConstraintFactory>(),
                    ServiceLocator.Current.Resolve<MethodInfoManager>())));

            this.callMatcherFactory = A.Fake<IExpressionCallMatcherFactory>();
            A.CallTo(() => this.callMatcherFactory.CreateCallMathcer(A<LambdaExpression>.Ignored)).ReturnsLazily(x => this.matcher);

            this.fakeAsserterFactory = x =>
                {
                    this.argumentToFakeAsserterFactory = x;
                    return this.fakeAsserter;
                };

            this.assertions = new FakeAssertions<IFoo>(this.fake, this.callMatcherFactory, this.fakeAsserterFactory);

            this.FakedFoo.Bar();
            this.FakedFoo.Baz();
        }
 public ExpressionCallRuleTests()
 {
     this.callMatcher = A.Fake<ExpressionCallMatcher>();
 }
Exemple #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ExpressionCallRule"/> class.
        /// </summary>
        /// <param name="callSpecification">The call specification.</param>
        public ExpressionCallRule(ExpressionCallMatcher expressionMatcher)
        {
            Guard.IsNotNull(expressionMatcher, "expressionMatcher");

            this.ExpressionMatcher = expressionMatcher;
        }
 public void Setup()
 {
     this.callMatcher = A.Fake<ExpressionCallMatcher>();
 }