public void Should_set_file_name_to_empty_when_it_could_not_be_found_in_header() { // Given var stream = BuildStreamForSingleFile( "name", null, null, null ); // When var boundary = new HttpMultipartBoundary(stream); // Then boundary.Filename.ShouldBeEmpty(); }
public void Should_extract_file_name_from_boundary_headers_when_available() { // Given var stream = BuildStreamForSingleFile( "name", "sample.txt", null, null ); // When var boundary = new HttpMultipartBoundary(stream); // Then boundary.Filename.ShouldEqual("sample.txt"); }
public void Should_handle_non_ASCII_filenames() { // Given var stream = BuildStreamForSingleFile( "file_content", "Данные.txt", "application/octet-stream", null ); // When var boundary = new HttpMultipartBoundary(stream); // Then boundary.Filename.ShouldEqual("Данные.txt"); }
public void Should_extract_name_from_boundary_headers() { // Given var stream = BuildStreamForSingleFile( "name", null, null, null ); // When var boundary = new HttpMultipartBoundary(stream); // Then boundary.Name.ShouldEqual("name"); }
public void Should_extract_empty_value_from_boundary_when_not_available() { // Given var stream = BuildStreamForSingleFile( "name", "sample.txt", "text/plain", null ); // When var boundary = new HttpMultipartBoundary(stream); // Then GetValueAsString(boundary.Value).ShouldBeEmpty(); }
public void Should_extract_content_type_from_boundary_headers_when_available() { // Given var stream = BuildStreamForSingleFile( "name", null, "text/plain", null ); // When var boundary = new HttpMultipartBoundary(stream); // Then boundary.ContentType.ShouldEqual("text/plain"); }
/// <summary> /// Initializes a new instance of the <see cref="HttpFile"/> class, /// using the provided <paramref name="boundary"/>. /// </summary> /// <param name="boundary">The <see cref="HttpMultipartBoundary"/> that contains the file information.</param> public HttpFile(HttpMultipartBoundary boundary) : this(boundary.ContentType, boundary.Filename, boundary.Value, boundary.Name) { }
public void Should_extract_value_from_boundary_when_available() { // Given var stream = BuildStreamForSingleFile( "name", "sample.txt", "text/plain", "This is some contents" ); // When var boundary = new HttpMultipartBoundary(stream); // Then GetValueAsString(boundary.Value).ShouldEqual("This is some contents"); }