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();
        }
示例#2
0
        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();
        }
示例#3
0
        public RuleBuilderTests()
        {
            this.asserter = A.Fake <IFakeAsserter>();
            this.ruleProducedByFactory = A.Fake <BuildableCallRule>();

            this.fakeManager = new FakeManager(typeof(object), new object());

            this.builder = this.CreateBuilder();
        }
示例#4
0
        public RuleBuilderTests()
        {
            this.asserter = A.Fake <IFakeAsserter>();
            this.ruleProducedByFactory = A.Fake <BuildableCallRule>();

            this.fakeManager = A.Fake <FakeManager>(o => o.CallsBaseMethods());

            this.builder = this.CreateBuilder();
        }
示例#5
0
        public void SetUp()
        {
            this.fakedObject   = A.Fake <IFoo>();
            this.fakeObject    = Fake.GetFakeManager(fakedObject);
            this.recordedRule  = A.Fake <RecordedCallRule>(x => x.WithArgumentsForConstructor(() => new RecordedCallRule(A.Fake <MethodInfoManager>())));
            this.callFormatter = A.Fake <IFakeObjectCallFormatter>();

            this.asserter = A.Fake <IFakeAsserter>();

            this.asserterFactory = x =>
            {
                this.argumentUsedForAsserterFactory = x;
                return(this.asserter);
            };
        }
        public void Setup()
        {
            this.fakedObject = A.Fake<IFoo>();
            this.fakeObject = Fake.GetFakeManager(this.fakedObject);
            this.recordedRule = A.Fake<RecordedCallRule>(x => x.WithArgumentsForConstructor(() => new RecordedCallRule(A.Fake<MethodInfoManager>())));
            this.callFormatter = A.Fake<IFakeObjectCallFormatter>();

            this.asserter = A.Fake<IFakeAsserter>();

            this.asserterFactory = x =>
                {
                    this.argumentUsedForAsserterFactory = x;
                    return this.asserter;
                };
        }