Ejemplo n.º 1
0
        /// <summary>
        /// Validates the requests sent, updates the expected state, and produces the expected response data for a single call to SaveChanges
        /// </summary>
        /// <param name="contextData">The context data at the time save-changes was called</param>
        /// <param name="propertyValuesBeforeSave">The property values of the tracked client objects before the call to SaveChanges</param>
        /// <param name="options">The save changes options used</param>
        /// <param name="requestResponsePairs">The observed HTTP traffic during save-changes</param>
        /// <returns>The expected response data</returns>
        public DataServiceResponseData ValidateAndTrackChanges(DataServiceContextData contextData, IDictionary <object, IEnumerable <NamedValue> > propertyValuesBeforeSave, SaveChangesOptions options, IEnumerable <KeyValuePair <HttpRequestData, HttpResponseData> > requestResponsePairs)
        {
            ExceptionUtilities.CheckArgumentNotNull(contextData, "contextData");
            ExceptionUtilities.CheckArgumentNotNull(requestResponsePairs, "requestResponsePairs");

            var castPairs = requestResponsePairs.Select(p => new KeyValuePair <IHttpRequest, HttpResponseData>(p.Key, p.Value));
            var emulator  = new PipelineEmulator(this, contextData, propertyValuesBeforeSave, options, castPairs);

            return(emulator.Run());
        }
        /// <summary>
        /// Validates the requests sent, updates the expected state, and produces the expected response data for a single call to SaveChanges
        /// </summary>
        /// <param name="contextData">The context data at the time save-changes was called</param>
        /// <param name="propertyValuesBeforeSave">The property values of the tracked client objects before the call to SaveChanges</param>
        /// <param name="options">The save changes options used</param>
        /// <param name="requestResponsePairs">The observed HTTP traffic during save-changes</param>
        /// <returns>The expected response data</returns>
        public DataServiceResponseData ValidateAndTrackChanges(DataServiceContextData contextData,  IDictionary<object, IEnumerable<NamedValue>> propertyValuesBeforeSave, SaveChangesOptions options, IEnumerable<KeyValuePair<HttpRequestData, HttpResponseData>> requestResponsePairs)
        {
            ExceptionUtilities.CheckArgumentNotNull(contextData, "contextData");
            ExceptionUtilities.CheckArgumentNotNull(requestResponsePairs, "requestResponsePairs");

            var castPairs = requestResponsePairs.Select(p => new KeyValuePair<IHttpRequest, HttpResponseData>(p.Key, p.Value));
            var emulator = new PipelineEmulator(this, contextData, propertyValuesBeforeSave, options, castPairs);
            return emulator.Run();
        }