public async Task GivenUnSupportedContentType_WhenReading_ThenShouldThrowUnsupportedMediaTypeExceptionAsync() { await Assert.ThrowsAsync <UnsupportedMediaTypeException>(() => _dicomInstanceEntryReader.ReadAsync( "not/application/dicom", _stream, CancellationToken.None)); }
public async Task GivenBodyPartWithValidContentTypeExceedLimit_ThrowError() { var dicomInstanceEntryReaderLowLimit = new DicomInstanceEntryReaderForSinglePartRequest(_seekableStreamConverter, CreateStoreConfiguration(1)); using var source = new CancellationTokenSource(); Stream stream = new MemoryStream(); stream.Write(Encoding.UTF8.GetBytes("someteststring")); stream.Seek(0, SeekOrigin.Begin); await Assert.ThrowsAsync <DicomFileLengthLimitExceededException>( () => dicomInstanceEntryReaderLowLimit.ReadAsync( DefaultContentType, stream, source.Token)); }