private Expectation ParseRecursiveExpectation(IMockExpectationContainer container, Expectation current, Type type)
        {
            var typeInstance = IdentifyReturnType(type);
            var typeContainer = typeInstance as IMockExpectationContainer;
            if (typeContainer == null)
                return current;

            var genericType = typeof(ExpectMethod<>);
            var replaceType = genericType.MakeGenericType(type);
            var replaceInstance = Activator.CreateInstance(replaceType) as Expectation;
            replaceInstance.SetReturnValue(typeInstance);
            container.RemoveExpectation(current);
            container.AddExpectation(replaceInstance);

            typeContainer.MarkForExpectation(current);
            return replaceInstance;
        }
Esempio n. 2
0
 /// <summary>
 /// Removes the given expectation from
 /// consideration
 /// </summary>
 /// <param name="expectation"></param>
 public void RemoveExpectation(Expectation expectation)
 {
     container.Remove(expectation);
 }
Esempio n. 3
0
        /// <summary>
        /// Set an expectation for consideration
        /// </summary>
        /// <param name="expectation"></param>
        public void MarkForAssertion(Expectation expectation)
        {
            ExpectationMarked = true;

            stack.Push(expectation);
        }
Esempio n. 4
0
        /// <summary>
        /// Add an expectation into consideration
        /// </summary>
        /// <param name="expectation"></param>
        public void MarkForExpectation(Expectation expectation)
        {
            ExpectationMarked = true;

            container.Add(expectation);
            stack.Push(expectation);
        }
Esempio n. 5
0
 /// <summary>
 /// Add an expectation without consideration
 /// </summary>
 /// <param name="expectation"></param>
 public void AddExpectation(Expectation expectation)
 {
     container.Add(expectation);
 }