/// <summary> /// Tests whether the action result is <see cref="Microsoft.AspNetCore.Mvc.PhysicalFileResult"/> /// with the same physical file 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="physicalPath">Expected physical file 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 PhysicalFile <TActionResult>( this IShouldReturnTestBuilder <TActionResult> shouldReturnTestBuilder, string physicalPath, string contentType, string fileDownloadName) => shouldReturnTestBuilder .PhysicalFile(physicalPath, contentType, fileDownloadName, false);
/// <summary> /// Tests whether the action result is <see cref="Microsoft.AspNetCore.Mvc.PhysicalFileResult"/> /// with the same physical file 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="physicalPath">Expected physical file 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 PhysicalFile <TActionResult>( this IShouldReturnTestBuilder <TActionResult> shouldReturnTestBuilder, string physicalPath, string contentType, DateTimeOffset?lastModified, EntityTagHeaderValue entityTag) => shouldReturnTestBuilder .PhysicalFile(physicalPath, contentType, lastModified, entityTag, false);
/// <summary> /// Tests whether the action result is <see cref="Microsoft.AspNetCore.Mvc.PhysicalFileResult"/> /// with the same physical file path, 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="physicalPath">Expected physical file path.</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 PhysicalFile <TActionResult>( this IShouldReturnTestBuilder <TActionResult> shouldReturnTestBuilder, string physicalPath, string contentType, bool enableRangeProcessing) => shouldReturnTestBuilder .PhysicalFile(result => result .WithPath(physicalPath) .WithContentType(MediaTypeHeaderValue.Parse(contentType)) .WithEnabledRangeProcessing(enableRangeProcessing));
/// <summary> /// Tests whether the action result is <see cref="Microsoft.AspNetCore.Mvc.PhysicalFileResult"/> /// with the same physical file 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="physicalPath">Expected physical file 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 PhysicalFile <TActionResult>( this IShouldReturnTestBuilder <TActionResult> shouldReturnTestBuilder, string physicalPath, string contentType, DateTimeOffset?lastModified, EntityTagHeaderValue entityTag, bool enableRangeProcessing) => shouldReturnTestBuilder .PhysicalFile(result => result .WithPath(physicalPath) .WithContentType(MediaTypeHeaderValue.Parse(contentType)) .WithLastModified(lastModified) .WithEntityTag(entityTag) .WithEnabledRangeProcessing(enableRangeProcessing));