Exemple #1
0
        /// <summary>
        /// Prevents a default instance of the <see cref="ODataWriterWrapper"/> class from being created.
        /// </summary>
        /// <param name="odataWriter">The odata writer.</param>
        /// <param name="requestPipeline">The request pipeline configuration.</param>
        private ODataWriterWrapper(ODataWriter odataWriter, DataServiceClientRequestPipelineConfiguration requestPipeline)
        {
            Debug.Assert(odataWriter != null, "odataWriter != null");
            Debug.Assert(requestPipeline != null, "DataServiceClientRequestPipelineConfiguration != null");

            this.odataWriter     = odataWriter;
            this.requestPipeline = requestPipeline;
        }
        /// <summary>
        /// Prevents a default instance of the <see cref="ODataWriterWrapper"/> class from being created.
        /// </summary>
        /// <param name="odataWriter">The odata writer.</param>
        /// <param name="requestPipeline">The request pipeline configuration.</param>
        private ODataWriterWrapper(ODataWriter odataWriter, DataServiceClientRequestPipelineConfiguration requestPipeline)
        {
            Debug.Assert(odataWriter != null, "odataWriter != null");
            Debug.Assert(requestPipeline != null, "DataServiceClientRequestPipelineConfiguration != null");

            this.odataWriter = odataWriter;
            this.requestPipeline = requestPipeline;
        }
        public void AllPublicConfigurationMethodsShouldThrowOnNullInput()
        {
            var pipeline = new DataServiceClientRequestPipelineConfiguration();

            foreach (var publicMethodWithConfigurationArg in pipeline.GetType().GetMethods().Where(mi => mi.ReturnType == typeof(DataServiceClientRequestPipelineConfiguration)))
            {
                MethodInfo methodUnderTest = publicMethodWithConfigurationArg;
                var parameter = publicMethodWithConfigurationArg.GetParameters()[0];
                Action test = () => methodUnderTest.Invoke(pipeline, BindingFlags.Instance | BindingFlags.Public, null, new object[] { null }, CultureInfo.InvariantCulture);
                var fluentException = test.ShouldThrow<TargetInvocationException>().WithInnerException<ArgumentNullException>();
                fluentException.And.As<TargetInvocationException>().InnerException.As<ArgumentNullException>().ParamName.Should().Be(parameter.Name);
            }
        }
Exemple #4
0
 internal static ODataWriterWrapper CreateForEntryTest(ODataWriter writer, DataServiceClientRequestPipelineConfiguration requestPipeline)
 {
     return(new ODataWriterWrapper(writer, requestPipeline));
 }
Exemple #5
0
 /// <summary>
 /// Creates the odata entry writer.
 /// </summary>
 /// <remarks>We never create a feed writer as the client doesn't support deep insert, if we did this would need to change</remarks>
 /// <param name="messageWriter">The message writer.</param>
 /// <param name="requestPipeline">The request pipeline configuration.</param>
 /// <returns>The odata Writer Wrapper</returns>
 internal static ODataWriterWrapper CreateForEntry(ODataMessageWriter messageWriter, DataServiceClientRequestPipelineConfiguration requestPipeline)
 {
     return(new ODataWriterWrapper(messageWriter.CreateODataEntryWriter(), requestPipeline));
 }
 internal static ODataWriterWrapper CreateForEntryTest(ODataWriter writer, DataServiceClientRequestPipelineConfiguration requestPipeline)
 {
     return new ODataWriterWrapper(writer, requestPipeline);
 }
 /// <summary>
 /// Creates the odata entry writer.
 /// </summary>
 /// <remarks>We never create a feed writer as the client doesn't support deep insert, if we did this would need to change</remarks>
 /// <param name="messageWriter">The message writer.</param>
 /// <param name="requestPipeline">The request pipeline configuration.</param>
 /// <returns>The odata Writer Wrapper</returns>
 internal static ODataWriterWrapper CreateForEntry(ODataMessageWriter messageWriter, DataServiceClientRequestPipelineConfiguration requestPipeline)
 {
     return new ODataWriterWrapper(messageWriter.CreateODataEntryWriter(), requestPipeline);
 }