Exemple #1
0
 /// <summary>
 /// Resets the state of the factory.
 /// </summary>
 /// <remarks>
 /// Use this method after expected exceptions.
 /// </remarks>
 public void ClearExpectations()
 {
     _currentMockObjectFactory            = new CastleMockObjectFactory();  //ReflectiveMockObjectFactory(); //
     _expectations                        = new UnorderedExpectationList(null);
     _thrownUnexpectedInvocationException = null;
     FirstIncompleteExpectationException  = null;
 }
Exemple #2
0
        /// <summary>
        /// Pushes the specified new ordering on the expectations stack.
        /// </summary>
        /// <param name="newOrdering">The new ordering.</param>
        /// <returns>Disposable popper.</returns>
        private Popper Push(ExpectationListBase newOrdering)
        {
            _expectations.AddExpectation(newOrdering);
            ExpectationListBase oldOrdering = _expectations;

            _expectations = newOrdering;
            return(new Popper(this, oldOrdering));
        }
		/// <summary>
		/// Initializes a new instance of the <see cref="OrderedExpectationList"/> class.
		/// </summary>
		/// <param name="parent">The parent <see cref="IExpectationList"/> of this <see cref="OrderedExpectationList"/></param>
		public OrderedExpectationList(ExpectationListBase parent)
			: base(parent)
		{
			if (parent != null)
				depth = parent.Depth + 1;

			prompt = "Ordered {";
		}
		/// <summary>
		/// Initializes a new instance of the <see cref="UnorderedExpectationList"/> class.
		/// </summary>
		/// <param name="parent">The parent <see cref="IExpectationList"/> of this instance.</param>
		public UnorderedExpectationList(ExpectationListBase parent)
			: base(parent)
		{
			if (parent != null)
				depth = parent.Depth + 1;
			else
				depth = 0;

			if (depth == 0)
				prompt = "MockFactory Expectations:";
			else
				prompt = "Unordered {";
		}
Exemple #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Popper"/> class.
 /// </summary>
 /// <param name="mockFactory">The mockFactory.</param>
 /// <param name="previous">The previous.</param>
 public Popper(MockFactory mockFactory, ExpectationListBase previous)
 {
     this.previous    = previous;
     this.mockFactory = mockFactory;
 }
Exemple #6
0
 /// <summary>
 /// Pops the specified old ordering from the expectations stack.
 /// </summary>
 /// <param name="oldOrdering">The old ordering.</param>
 private void Pop(ExpectationListBase oldOrdering)
 {
     _expectations = oldOrdering;
 }