Example #1
0
        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();
        }
        internal CallCollection(FakeObject fake, ExpressionCallMatcher.Factory matcherFactory)
        {
            Guard.IsNotNull(fake, "fake");
            Guard.IsNotNull(matcherFactory, "matcherFactory");

            this.Fake           = fake;
            this.matcherFactory = matcherFactory;
        }
        internal CallCollection(FakeObject fake, ExpressionCallMatcher.Factory matcherFactory)
        {
            Debug.Assert(fake != null);
            Debug.Assert(matcherFactory != null);

            this.Fake           = fake;
            this.matcherFactory = matcherFactory;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="FakeAsserter&lt;TFake&gt;"/> class.
        /// </summary>
        /// <param name="fake">The fake.</param>
        public FakeAsserter(FakeObject fake, ICallCollectionFactory callCollectionFactory, ExpressionCallMatcher.Factory callMatcherFactory)
        {
            Guard.IsNotNull(fake, "fake");
            Guard.IsNotNull(callCollectionFactory, "callCollectionFactory");
            Guard.IsNotNull(callMatcherFactory, "callMatcherFactory");

            this.Fake = fake;
            this.callCollectionFactory = callCollectionFactory;
            this.callMatcherFactory    = callMatcherFactory;
        }
Example #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FakeAsserter&lt;TFake&gt;"/> class.
        /// </summary>
        /// <param name="fake">The fake.</param>
        public FakeAssertions(FakeObject fake, ExpressionCallMatcher.Factory callMatcherFactory, FakeAsserter.Factory fakeAsserterFactory)
        {
            Guard.IsNotNull(fake, "fake");
            Guard.IsNotNull(callMatcherFactory, "callMatcherFactory");
            Guard.IsNotNull(fakeAsserterFactory, "fakeAsserterFactory");

            this.callMatcherFactory  = callMatcherFactory;
            this.fakeAsserterFactory = fakeAsserterFactory;
            this.fake = fake;
        }
Example #6
0
 public void SetUp()
 {
     this.callMatcherFactory = ServiceLocator.Current.Resolve <ExpressionCallMatcher.Factory>();
     this.fake     = new FakeObject(typeof(IFoo));
     this.asserter = new FakeAsserter <IFoo>(this.fake, A.Fake <ICallCollectionFactory>(), this.callMatcherFactory);
 }