Beispiel #1
0
        public async Task ReadOperationRequest_NullReader_Throws()
        {
            // Arrange
            Mock <HttpContext> mockContext = new Mock <HttpContext>();

            // Act & Assert
            await ExceptionAssert.ThrowsArgumentNullAsync(
                () => ODataBatchReaderExtensions.ReadOperationRequestAsync(null, mockContext.Object, Guid.NewGuid(), CancellationToken.None),
                "reader");
        }
        public void ReadOperationRequest_InvalidState_Throws()
        {
            var httpContent = new StringContent(String.Empty, Encoding.UTF8, "multipart/mixed");

            httpContent.Headers.ContentType.Parameters.Add(new NameValueHeaderValue("boundary", Guid.NewGuid().ToString()));
            var reader = httpContent.GetODataMessageReaderAsync(new ODataMessageReaderSettings()).Result;

            Assert.Throws <InvalidOperationException>(
                () => ODataBatchReaderExtensions.ReadOperationRequestAsync(reader.CreateODataBatchReader(), Guid.NewGuid(), false),
                "The current batch reader state 'Initial' is invalid. The expected state is 'Operation'.");
        }
Beispiel #3
0
        public async Task ReadOperationRequest_InvalidState_Throws()
        {
            // Arrange
            StringContent httpContent = new StringContent(String.Empty, Encoding.UTF8, "multipart/mixed");

            httpContent.Headers.ContentType.Parameters.Add(new NameValueHeaderValue("boundary", Guid.NewGuid().ToString()));
            ODataMessageReader reader = await httpContent.GetODataMessageReaderAsync(new ODataMessageReaderSettings(), CancellationToken.None);

            Mock <HttpContext> mockContext = new Mock <HttpContext>();

            // Act & Assert
            ExceptionAssert.Throws <InvalidOperationException>(
                () => ODataBatchReaderExtensions.ReadOperationRequestAsync(reader.CreateODataBatchReader(), mockContext.Object, Guid.NewGuid(), CancellationToken.None),
                "The current batch reader state 'Initial' is invalid. The expected state is 'Operation'.");
        }
Beispiel #4
0
 public async Task ReadOperationRequest_NullReader_Throws()
 {
     await ExceptionAssert.ThrowsArgumentNullAsync(
         () => ODataBatchReaderExtensions.ReadOperationRequestAsync(null, Guid.NewGuid(), false),
         "reader");
 }
Beispiel #5
0
 public void ReadOperationRequest_NullReader_Throws()
 {
     Assert.ThrowsArgumentNull(
         () => ODataBatchReaderExtensions.ReadOperationRequestAsync(null, Guid.NewGuid(), false),
         "reader");
 }