Esempio n. 1
0
 /// <summary>
 /// Tests whether the action result is <see cref="Microsoft.AspNetCore.Mvc.VirtualFileResult"/>
 /// with the same file virtual path, content type, and download name as the provided ones.
 /// </summary>
 /// <typeparam name="TActionResult">Type of the action result.</typeparam>
 /// <param name="shouldReturnTestBuilder">Instance of <see cref="IShouldReturnTestBuilder{TActionResult}"/> type.</param>
 /// <param name="virtualPath">Expected file virtual path.</param>
 /// <param name="contentType">Expected content type.</param>
 /// <param name="fileDownloadName">Expected file download name.</param>
 /// <returns>Test builder of <see cref="IAndTestBuilder"/> type.</returns>
 public static IAndTestBuilder File <TActionResult>(
     this IShouldReturnTestBuilder <TActionResult> shouldReturnTestBuilder,
     string virtualPath,
     string contentType,
     string fileDownloadName)
 => shouldReturnTestBuilder
 .File(virtualPath, contentType, fileDownloadName, false);
Esempio n. 2
0
 /// <summary>
 /// Tests whether the action result is <see cref="Microsoft.AspNetCore.Mvc.FileContentResult"/>
 /// with the same file contents, content type, and download name as the provided ones.
 /// </summary>
 /// <typeparam name="TActionResult">Type of the action result.</typeparam>
 /// <param name="shouldReturnTestBuilder">Instance of <see cref="IShouldReturnTestBuilder{TActionResult}"/> type.</param>
 /// <param name="fileContents">Expected file contents.</param>
 /// <param name="contentType">Expected content type.</param>
 /// <param name="fileDownloadName">Expected file download name.</param>
 /// <returns>Test builder of <see cref="IAndTestBuilder"/> type.</returns>
 public static IAndTestBuilder File <TActionResult>(
     this IShouldReturnTestBuilder <TActionResult> shouldReturnTestBuilder,
     byte[] fileContents,
     string contentType,
     string fileDownloadName)
 => shouldReturnTestBuilder
 .File(fileContents, contentType, fileDownloadName, false);
Esempio n. 3
0
 /// <summary>
 /// Tests whether the action result is <see cref="Microsoft.AspNetCore.Mvc.VirtualFileResult"/>
 /// with the same file virtual path, content type, last modified value, and entity tag as the provided ones.
 /// </summary>
 /// <typeparam name="TActionResult">Type of the action result.</typeparam>
 /// <param name="shouldReturnTestBuilder">Instance of <see cref="IShouldReturnTestBuilder{TActionResult}"/> type.</param>
 /// <param name="virtualPath">Expected file virtual path.</param>
 /// <param name="contentType">Expected content type.</param>
 /// <param name="lastModified">Expected last modified value.</param>
 /// <param name="entityTag">Expected entity tag.</param>
 /// <returns>Test builder of <see cref="IAndTestBuilder"/> type.</returns>
 public static IAndTestBuilder File <TActionResult>(
     this IShouldReturnTestBuilder <TActionResult> shouldReturnTestBuilder,
     string virtualPath,
     string contentType,
     DateTimeOffset?lastModified,
     EntityTagHeaderValue entityTag)
 => shouldReturnTestBuilder
 .File(virtualPath, contentType, lastModified, entityTag, false);
Esempio n. 4
0
 /// <summary>
 /// Tests whether the action result is <see cref="Microsoft.AspNetCore.Mvc.FileStreamResult"/>
 /// with the same file stream, content type, download name,
 /// last modified value, and entity tag as the provided ones.
 /// </summary>
 /// <typeparam name="TActionResult">Type of the action result.</typeparam>
 /// <param name="shouldReturnTestBuilder">Instance of <see cref="IShouldReturnTestBuilder{TActionResult}"/> type.</param>
 /// <param name="fileStream">Expected file stream.</param>
 /// <param name="contentType">Expected content type.</param>
 /// <param name="fileDownloadName">Expected file download name.</param>
 /// <param name="lastModified">Expected last modified value.</param>
 /// <param name="entityTag">Expected entity tag.</param>
 /// <returns>Test builder of <see cref="IAndTestBuilder"/> type.</returns>
 public static IAndTestBuilder File <TActionResult>(
     this IShouldReturnTestBuilder <TActionResult> shouldReturnTestBuilder,
     Stream fileStream,
     string contentType,
     string fileDownloadName,
     DateTimeOffset?lastModified,
     EntityTagHeaderValue entityTag)
 => shouldReturnTestBuilder
 .File(fileStream, contentType, fileDownloadName, lastModified, entityTag, false);
Esempio n. 5
0
 /// <summary>
 /// Tests whether the action result is <see cref="Microsoft.AspNetCore.Mvc.FileContentResult"/>
 /// with the same file contents, content type, and end range processing value as the provided ones.
 /// </summary>
 /// <typeparam name="TActionResult">Type of the action result.</typeparam>
 /// <param name="shouldReturnTestBuilder">Instance of <see cref="IShouldReturnTestBuilder{TActionResult}"/> type.</param>
 /// <param name="fileContents">Expected file contents.</param>
 /// <param name="contentType">Expected content type.</param>
 /// <param name="enableRangeProcessing">Expected boolean value.</param>
 /// <returns>Test builder of <see cref="IAndTestBuilder"/> type.</returns>
 public static IAndTestBuilder File <TActionResult>(
     this IShouldReturnTestBuilder <TActionResult> shouldReturnTestBuilder,
     byte[] fileContents,
     string contentType,
     bool enableRangeProcessing)
 => shouldReturnTestBuilder
 .File(result => result
       .WithContents(fileContents)
       .WithContentType(MediaTypeHeaderValue.Parse(contentType))
       .WithEnabledRangeProcessing(enableRangeProcessing));
Esempio n. 6
0
 /// <summary>
 /// Tests whether the action result is <see cref="Microsoft.AspNetCore.Mvc.VirtualFileResult"/>
 /// with the same file virtual path, content type, download name, and end range processing value as the provided ones.
 /// </summary>
 /// <typeparam name="TActionResult">Type of the action result.</typeparam>
 /// <param name="shouldReturnTestBuilder">Instance of <see cref="IShouldReturnTestBuilder{TActionResult}"/> type.</param>
 /// <param name="virtualPath">Expected file virtual path.</param>
 /// <param name="contentType">Expected content type.</param>
 /// <param name="fileDownloadName">Expected file download name.</param>
 /// <param name="enableRangeProcessing">Expected boolean value.</param>
 /// <returns>Test builder of <see cref="IAndTestBuilder"/> type.</returns>
 public static IAndTestBuilder File <TActionResult>(
     this IShouldReturnTestBuilder <TActionResult> shouldReturnTestBuilder,
     string virtualPath,
     string contentType,
     string fileDownloadName,
     bool enableRangeProcessing)
 => shouldReturnTestBuilder
 .File(result => result
       .WithName(virtualPath)
       .WithContentType(MediaTypeHeaderValue.Parse(contentType))
       .WithDownloadName(fileDownloadName)
       .WithEnabledRangeProcessing(enableRangeProcessing));
Esempio n. 7
0
 /// <summary>
 /// Tests whether the action result is <see cref="Microsoft.AspNetCore.Mvc.VirtualFileResult"/>
 /// with the same file virtual path, content type, last modified value, entity tag,
 /// and end range processing value as the provided ones.
 /// </summary>
 /// <typeparam name="TActionResult">Type of the action result.</typeparam>
 /// <param name="shouldReturnTestBuilder">Instance of <see cref="IShouldReturnTestBuilder{TActionResult}"/> type.</param>
 /// <param name="virtualPath">Expected file virtual path.</param>
 /// <param name="contentType">Expected content type.</param>
 /// <param name="lastModified">Expected last modified value.</param>
 /// <param name="entityTag">Expected entity tag.</param>
 /// <param name="enableRangeProcessing">Expected boolean value.</param>
 /// <returns>Test builder of <see cref="IAndTestBuilder"/> type.</returns>
 public static IAndTestBuilder File <TActionResult>(
     this IShouldReturnTestBuilder <TActionResult> shouldReturnTestBuilder,
     string virtualPath,
     string contentType,
     DateTimeOffset?lastModified,
     EntityTagHeaderValue entityTag,
     bool enableRangeProcessing)
 => shouldReturnTestBuilder
 .File(result => result
       .WithName(virtualPath)
       .WithContentType(MediaTypeHeaderValue.Parse(contentType))
       .WithLastModified(lastModified)
       .WithEntityTag(entityTag)
       .WithEnabledRangeProcessing(enableRangeProcessing));
Esempio n. 8
0
 /// <summary>
 /// Tests whether the action result is <see cref="Microsoft.AspNetCore.Mvc.FileStreamResult"/>
 /// with the same file stream, content type, download name, last modified value,
 /// entity tag, and end range processing value as the provided ones.
 /// </summary>
 /// <typeparam name="TActionResult">Type of the action result.</typeparam>
 /// <param name="shouldReturnTestBuilder">Instance of <see cref="IShouldReturnTestBuilder{TActionResult}"/> type.</param>
 /// <param name="fileStream">Expected file stream.</param>
 /// <param name="contentType">Expected content type.</param>
 /// <param name="fileDownloadName">Expected file download name.</param>
 /// <param name="lastModified">Expected last modified value.</param>
 /// <param name="entityTag">Expected entity tag.</param>
 /// <param name="enableRangeProcessing">Expected boolean value.</param>
 /// <returns>Test builder of <see cref="IAndTestBuilder"/> type.</returns>
 public static IAndTestBuilder File <TActionResult>(
     this IShouldReturnTestBuilder <TActionResult> shouldReturnTestBuilder,
     Stream fileStream,
     string contentType,
     string fileDownloadName,
     DateTimeOffset?lastModified,
     EntityTagHeaderValue entityTag,
     bool enableRangeProcessing)
 => shouldReturnTestBuilder
 .File(result => result
       .WithStream(fileStream)
       .WithContentType(MediaTypeHeaderValue.Parse(contentType))
       .WithDownloadName(fileDownloadName)
       .WithLastModified(lastModified)
       .WithEntityTag(entityTag)
       .WithEnabledRangeProcessing(enableRangeProcessing));
Esempio n. 9
0
 /// <summary>
 /// Tests whether the action result is <see cref="Microsoft.AspNetCore.Mvc.FileStreamResult"/>
 /// with the same file stream and content type as the provided ones.
 /// </summary>
 /// <typeparam name="TActionResult">Type of the action result.</typeparam>
 /// <param name="shouldReturnTestBuilder">Instance of <see cref="IShouldReturnTestBuilder{TActionResult}"/> type.</param>
 /// <param name="fileStream">Expected file stream.</param>
 /// <param name="contentType">Expected content type.</param>
 /// <returns>Test builder of <see cref="IAndTestBuilder"/> type.</returns>
 public static IAndTestBuilder File <TActionResult>(
     this IShouldReturnTestBuilder <TActionResult> shouldReturnTestBuilder,
     Stream fileStream,
     string contentType)
 => shouldReturnTestBuilder
 .File(fileStream, contentType, false);