コード例 #1
0
 public void Should_use_configuration_values()
 {
     IConfigManager fake = new FakeConfigurationManager();
     //setup state
     fake.FooSetting = "foo";
     var sut = new Class2Test(fake);
     Assert.AreEqual("foo", sut.methodToTest());
 }
コード例 #2
0
        private void OnSetup()
        {
            this.configurationFactory = A.Fake <IConfigurationFactory>();
            this.callExpressionParser = new CallExpressionParser();
            this.interceptionAsserter = A.Fake <IInterceptionAsserter>();

            this.ruleFactory = x => null;

            this.configurationManager = this.CreateManager();
        }
コード例 #3
0
        public FakeConfigurationManagerTests()
        {
            this.configurationFactory = A.Fake <IConfigurationFactory>();
            this.callExpressionParser = new CallExpressionParser();
            this.interceptionAsserter = A.Fake <IInterceptionAsserter>();

            ExpressionCallRule.Factory ruleFactory = A.Dummy <ExpressionCallRule.Factory>();

            this.configurationManager = new FakeConfigurationManager(
                this.configurationFactory,
                ruleFactory,
                this.callExpressionParser,
                this.interceptionAsserter);
        }
コード例 #4
0
        private void OnSetup()
        {
            this.configurationFactory = A.Fake <IConfigurationFactory>();
            this.callExpressionParser = new CallExpressionParser();
            this.interceptionAsserter = A.Fake <IInterceptionAsserter>();

            Expression <Action <IFoo> > dummyExpression = x => x.Bar();
            var parsedDummyExpression = this.callExpressionParser.Parse(dummyExpression);

            this.ruleReturnedFromFactory = ServiceLocator.Current.Resolve <ExpressionCallRule.Factory>().Invoke(parsedDummyExpression);
            this.ruleFactory             = x => this.ruleReturnedFromFactory;

            this.configurationManager = this.CreateManager();
        }
コード例 #5
0
        private void OnSetup()
        {
            this.configurationFactory = A.Fake <IConfigurationFactory>();
            this.expressionParser     = A.Fake <IExpressionParser>();
            this.callExpressionParser = new CallExpressionParser();
            this.interceptionAsserter = A.Fake <IInterceptionAsserter>();

            Expression <Action <IFoo> > dummyExpression = x => x.Bar();

            this.ruleReturnedFromFactory = ServiceLocator.Current.Resolve <ExpressionCallRule.Factory>().Invoke(dummyExpression);
            this.ruleFactory             = x =>
            {
                return(this.ruleReturnedFromFactory);
            };

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

            A.CallTo(() => this.expressionParser.GetFakeManagerCallIsMadeOn(A <LambdaExpression> ._)).ReturnsLazily(x => this.fakeObjectReturnedFromParser);

            this.configurationManager = this.CreateManager();
        }
コード例 #6
0
        private void OnSetUp()
        {
            this.configurationFactory = A.Fake <IConfigurationFactory>();
            this.expressionParser     = A.Fake <IExpressionParser>();
            this.proxyGenerator       = A.Fake <IProxyGenerator>();
            A.CallTo(() => this.proxyGenerator.MemberCanBeIntercepted(A <MemberInfo> .Ignored)).Returns(true);

            this.callSpecification = ExpressionHelper.CreateExpression <IFoo>(x => x.Bar());

            Expression <Action <IFoo> > dummyExpression = x => x.Bar();

            this.ruleReturnedFromFactory = ServiceLocator.Current.Resolve <ExpressionCallRule.Factory>().Invoke(dummyExpression);
            this.ruleFactory             = x =>
            {
                return(this.ruleReturnedFromFactory);
            };

            this.fakeObjectReturnedFromParser = new FakeObject();

            A.CallTo(() => this.expressionParser.GetFakeObjectCallIsMadeOn(A <LambdaExpression> .Ignored)).Returns(x => this.fakeObjectReturnedFromParser);

            this.configurationManager = this.CreateManager();
        }
コード例 #7
0
        private void OnSetUp()
        {
            this.configurationFactory = A.Fake<IConfigurationFactory>();
            this.expressionParser = A.Fake<IExpressionParser>();
            this.callExpressionParser = new CallExpressionParser();
            this.interceptionAsserter = A.Fake<IInterceptionAsserter>();

            Expression<Action<IFoo>> dummyExpression = x => x.Bar();
            this.ruleReturnedFromFactory = ServiceLocator.Current.Resolve<ExpressionCallRule.Factory>().Invoke(dummyExpression);
            this.ruleFactory = x =>
                {
                    return this.ruleReturnedFromFactory;
                };

            this.fakeObjectReturnedFromParser = new FakeManager();

            A.CallTo(() => this.expressionParser.GetFakeManagerCallIsMadeOn(A<LambdaExpression>._)).ReturnsLazily(x => this.fakeObjectReturnedFromParser);

            this.configurationManager = this.CreateManager();
        }
コード例 #8
0
        private void OnSetup()
        {
            this.configurationFactory = A.Fake<IConfigurationFactory>();
            this.callExpressionParser = new CallExpressionParser();
            this.interceptionAsserter = A.Fake<IInterceptionAsserter>();

            Expression<Action<IFoo>> dummyExpression = x => x.Bar();
            var parsedDummyExpression = this.callExpressionParser.Parse(dummyExpression);
            this.ruleReturnedFromFactory = ServiceLocator.Current.Resolve<ExpressionCallRule.Factory>().Invoke(parsedDummyExpression);
            this.ruleFactory = x => this.ruleReturnedFromFactory;

            this.configurationManager = this.CreateManager();
        }