예제 #1
0
        /// <summary>
        /// Reset the selected expectation on this mock object
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="mock">The mock.</param>
        /// <param name="options">The options to reset the expectations on this mock.</param>
        public static void BackToRecord <T>(this T mock, BackToRecordOptions options)
        {
            IMockedObject mockedObject = MockRepository.GetMockedObject(mock);
            var           mocks        = mockedObject.Repository;

            mocks.BackToRecord(mock, options);
        }
예제 #2
0
 /// <summary>
 /// Clears the state of the object, remove original calls, property behavior, subscribed events, etc.
 /// </summary>
 public void ClearState(BackToRecordOptions options)
 {
     if (eventsSubscribers != null &&
         (options & BackToRecordOptions.EventSubscribers) != 0)
     {
         eventsSubscribers.Clear();
     }
     if (originalMethodsToCall != null &&
         (options & BackToRecordOptions.OriginalMethodsToCall) != 0)
     {
         originalMethodsToCall.Clear();
     }
     if (propertiesValues != null &&
         (options & BackToRecordOptions.PropertyBehavior) != 0)
     {
         propertiesValues.Clear();
     }
     if (propertiesToSimulate != null &&
         (options & BackToRecordOptions.PropertyBehavior) != 0)
     {
         propertiesToSimulate.Clear();
     }
 }
예제 #3
0
 /// <summary>
 /// Clears the state of the object, remove original calls, property behavior, subscribed events, etc.
 /// </summary>
 /// <param name="options">
 /// The options.
 /// </param>
 public virtual void ClearState(BackToRecordOptions options)
 {
     if (eventsSubscribers != null &&
         (options & BackToRecordOptions.EventSubscribers) != 0)
         eventsSubscribers.Clear();
     if (originalMethodsToCall != null &&
         (options & BackToRecordOptions.OriginalMethodsToCall) != 0)
         originalMethodsToCall.Clear();
     if (propertiesValues != null &&
         (options & BackToRecordOptions.PropertyBehavior) != 0)
         propertiesValues.Clear();
     if (propertiesToSimulate != null &&
         (options & BackToRecordOptions.PropertyBehavior) != 0)
         propertiesToSimulate.Clear();
 }