public void SetUp() { this.fake = Fake.GetFakeObject(ServiceLocator.Current.Resolve <FakeObjectFactory>().CreateFake(typeof(IFoo), null, false)); this.fakeAsserter = A.Fake <FakeAsserter>(); this.matcher = A.Fake <ExpressionCallMatcher>(() => new ExpressionCallMatcher( ExpressionHelper.CreateExpression <IFoo>(x => Console.WriteLine("")), ServiceLocator.Current.Resolve <ArgumentValidatorFactory>(), ServiceLocator.Current.Resolve <MethodInfoManager>())); this.callMatcherFactory = A.Fake <IExpressionCallMatcherFactory>(); A.CallTo(() => this.callMatcherFactory.CreateCallMathcer(A <LambdaExpression> .Ignored)).Returns(() => 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 void SetUp() { this.fake = new FakeObject(typeof(IFoo)); this.fakeAsserter = A.Fake <FakeAsserter>(() => new FakeAsserter(new List <IFakeObjectCall>())); this.matcher = A.Fake <ExpressionCallMatcher>(() => new ExpressionCallMatcher( ExpressionHelper.CreateExpression <IFoo>(x => Console.WriteLine("")), ServiceLocator.Current.Resolve <ArgumentValidatorFactory>(), ServiceLocator.Current.Resolve <MethodInfoManager>())); this.callMatcherFactory = x => { this.argumentToCallMatcherFactory = x; return(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 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(); }
private static string GetExpressionDescription(ParsedCallExpression parsedCallExpression) { var matcher = new ExpressionCallMatcher( parsedCallExpression, ServiceLocator.Current.Resolve <ExpressionArgumentConstraintFactory>(), ServiceLocator.Current.Resolve <MethodInfoManager>()); return(matcher.DescriptionOfMatchingCall); }
private string GetExpressionDescription <TValue>(Expression <Func <TValue> > expression) { var matcher = new ExpressionCallMatcher( expression, ServiceLocator.Current.Resolve <ExpressionArgumentConstraintFactory>(), ServiceLocator.Current.Resolve <MethodInfoManager>(), this.callExpressionParser); var expressionDescription = matcher.DescriptionOfMatchingCall; return(expressionDescription); }
public void Setup() { this.callMatcher = A.Fake <ExpressionCallMatcher>(); }
public ExpressionCallRuleTests() { this.callMatcher = A.Fake <ExpressionCallMatcher>(); }
public void SetUp() { Expression <Action <IFoo> > dummyCall = x => x.Bar(); this.callMatcher = A.Fake <ExpressionCallMatcher>(() => new ExpressionCallMatcher(dummyCall, A.Fake <ArgumentValidatorFactory>(), A.Fake <MethodInfoManager>())); }
private static void ThrowWhenNotCalledWithCorrectRepeat(ExpressionCallMatcher matcher, Expression <Func <int, bool> > repeatValidation, int repeat) { var messageTemplate = ExceptionMessages.WasCalledWrongNumberOfTimes.FormatInvariant(matcher.ToString(), repeatValidation.ToString(), repeat); throw new ExpectationException(messageTemplate); }
public void SetUp() { Expression <Action <IFoo> > dummyCall = x => x.Bar(); this.callMatcher = A.Fake <ExpressionCallMatcher>(); }