public async Task ReadChangeSetOperationRequest_NullReader_Throws() { // Arrange Mock <HttpContext> mockContext = new Mock <HttpContext>(); await ExceptionAssert.ThrowsArgumentNullAsync( () => ODataBatchReaderExtensions.ReadChangeSetOperationRequestAsync(null, mockContext.Object, Guid.NewGuid(), Guid.NewGuid(), CancellationToken.None), "reader"); }
public void ReadChangeSetOperationRequest_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.ReadChangeSetOperationRequestAsync(reader.CreateODataBatchReader(), Guid.NewGuid(), Guid.NewGuid(), false), "The current batch reader state 'Initial' is invalid. The expected state is 'Operation'."); }
public async Task ReadChangeSetOperationRequest_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.ReadChangeSetOperationRequestAsync(reader.CreateODataBatchReader(), mockContext.Object, Guid.NewGuid(), Guid.NewGuid(), CancellationToken.None), "The current batch reader state 'Initial' is invalid. The expected state is 'Operation'."); }
public async Task ReadChangeSetOperationRequest_NullReader_Throws() { await ExceptionAssert.ThrowsArgumentNullAsync( () => ODataBatchReaderExtensions.ReadChangeSetOperationRequestAsync(null, Guid.NewGuid(), Guid.NewGuid(), false), "reader"); }
public void ReadChangeSetOperationRequest_NullReader_Throws() { Assert.ThrowsArgumentNull( () => ODataBatchReaderExtensions.ReadChangeSetOperationRequestAsync(null, Guid.NewGuid(), Guid.NewGuid(), false), "reader"); }